CIM Internals Notes about the internal game mechanic of Cities in Motion by eis_os Last Update: 2012-04-01 Changelog: rev 15: Colors for Bitmaps rev 14: GRID Items Script Language Strings Charsets rev 12: CIM Update to 1.0.22 (2011-12-18) metro.gs ja.gs rev 11: tokyo.gs - update 2011-12-09 vehiclepack03.gs - update 2011-12-07 rev 10: Script Bugs / Internal Bugs rev 9: Some small changes on diagonals and variation rev 8: Changes in Tokyo.gs rev 7: Script System: Maps & Arrays. some small clarifactions List of Filesystem functions Objects: Describe Objects and their Flags better, includes the station stuff. Path relevant flags Variations Removed Fileformat parts. rev 6: Tool Mode / Mouse Mode / Object Variations rev 5: Changes between 0.17->0.19 rev 4: Notes on changing Lines "online" rev 3: Explain how CIM creates a price rev 2: Moved debug to scripting Added all GRID constants. Moved the 3D Object format to the end. Added # array size rev 1: Getting the Ticket Prices without copying Vehicle Events Getting a Path to your Script and load scripts (In Addons) rev 0: Tram Roundabouts Debugging console. Start to decode the basic structure of the object fileformat, references to other "old" games. If you have any groundbreaking information, let me know via email cim bytetransfer.de, thank you. [Warning] This file is my main scratchpad for informations gained from changing and creating new scripts for CIM and do a load/play cycle. Please note, it's more a personal scratchpad then a tutorial, the informations are in a very raw form. You have been warned, still there will be direct advices for your own information or development of an addon. [/Warning] ========================================== Known bugs in the internals of CIM ========================================== Script Errors effect other objects ------------------------------------------ Anything infront of a error in a script is still accessible and may crash CIM badly. Script errors affect later loaded scripts. Never forget a semicolon at the end of a script if there is a need for one. Strange things happen on other scripts. No way to detect if a script is "broken". Garbage Collection ------------------------------------------ Script unloading isn't done in exact reverse order. addons.script ------------------------------------------ Company logos are searched in /company-logos/ but later loaded from /logos/ Easy fix: Copy logos to the other directory. Lines ------------------------------------------ The internal line object and the script representation seems to disagree sometimes about the mood of passengers. Grid ------------------------------------------ Pathfinding can report errors but the location of the error isn't reported. MAIN.$grid.graph.onPathError::() should be able to show / report the error to fix maps. ========================= Tool Modes & Object Variations ========================= selectTool($tool, $mode = 0, $variation = 0, $sizeable = false, $levelable = false, $texture = 0); $player.editMode = $tool; GRIDMODE_LAY_TRACK Metro GRIDMODE_LAY_TRAM_TRACK GRIDMODE_LAY_ROAD GRIDMODE_CREATE_STOP $player.toolMode = $mode; GRIDMODE_LAY_TRACK: GRIDMETRO_ELEVATED GRIDMETRO_SUBWAY GRIDMETRO_GROUND GRIDTRACK_DOUBLE GRIDMODE_LAY_TRAM_TRACK No Constant defined GRIDMODE_CREATE_STOP GRIDSTOP_* GRIDMODE_LAY_ROAD GRIDROAD_* GRIDRAMP_* GRIDMODE_LAY_BRIDGE GRIDMODE_LAY_TUNNEL GRIDROAD_* GRIDTRACK_DOUBLE GRIDMODE_SET_VARIATION Variation Num GRIDMODE_REMOVE_OBJECTS Mode: 0 = editor, 1 = ingame GRIDMODE_SET_PAVEMENT Pavement Variant $player.toolType = $variation; -= 128 += 128 changes the height of object. Variation of Object GRIDMODE_LAY_TRACK: 0 = Metro 1 = Tokyo Monorail? GRIDMODE_LAY_TRAM_TRACK: unknown GRIDMODE_LAY_BRIDGE Bridge Variant GRIDMODE_LAY_ROAD: 1 = crossing GRIDMODE_CREATE_STOP GRIDSTOP_* Stop Type $player.toolSize = Level or Size for Tool or $texture The variation can be set in the object script via (Changing a loaded object won't work!): this.variation = 2; You should use a high number for your own variation, something between 500 and not more then 0xFFFF ========================= Changes in Tokyo.gs ========================= Rev 2 (2011-12-09): - Changes in ja.strings Rev 1: - Tokyo grid was changed - The balancing was changed: Tokyo Mono Engine 01 Capacity to 10>8 Speed lowered. Baseprice 100000>75000 Reliability 0.60>0.70 Attractiveness 0.95>0.80 Speed 80>70 Tokyo Mono Car 01 Capacity to 10>9 Tokyo Mono Engine 02 Capacity to 10>13 Speed raised. Baseprice 100000>120000 Reliability 0.60>0.65 ElectricityConsumption 13>16 Attractiveness 0.95>0.90 Speed 80>85 Tokyo Mono Car 02 Capacity to 10>13 - Robot Prop changed: /addons/tokyo/props/robot -> park-props/standing-statue - Skytree building was changed. - Version Check added, shows warning if CIM is older then 1.0.17 ========================= Changes in vehiclepack03.gs ========================= Rev 1 (2011-12-07): \tram01\ tram10.script (this.turning changed from 1.4 to 0.8) ========================= Changelog for game updates ========================= Changes between 0.21 -> 0.22 (2011-12-18) ---------------------------------------------- metro.gs \scripts\ debug.script new debug console command flatten-timeline, could be a way to map timeline changes to date 1.1.1920 init.script add sanity checks for /userdata/settings.script, can be loaded right? if not, setttings will be reset to defaults. main.script loadScore: new MAIN.$score.$winterPassengers, set to zero if doesn't exists. saveScore: export winterPassengers player.script onCitizenArrive: when month is between Nov and January increase $score.$winterPassengers, unlock achievement 47 if 1000 \strings\ *.strings new achievement 47 = "Winter Wonder"; \ui\achievement\ achievement.script add winter-achievement at position 47 in $achievementData winter-achievement.dds new file \ui\petitionpanel\ petitionpanel.script showPetition: change $yesButton.left if exitGame to 190 ja.gs see metro.gs strings Changes between 0.20 -> 0.21 ---------------------------------------------- metro.gs: \fonts\*\ ja.fnt and ja*.dds (changes, added and removed files) \ui\menus\ campaign.script (add 5 pixel to $itemsArea) \ui\moneybar\ moneybar.script (in thread "gameUI", wait time set to 0.51 again) Changes between 0.19 -> 0.20 ---------------------------------------------- metro.gs: \fonts\tahoma-8\ ja.fnt and ja*.dds (changed) ja_14.dds (removed) \scripts\ main.states (changed) system.script (changeing MAIN.$window.enabled was commented out when in pause mode) \strings\ en_US.strings (new achievement 47 : "Summer in the City") \ui\achievement\ summer-in-the-city.dds (new file) achievement.script ($achievements.logIn() disabled) \ui\menus\ shop.dds (new file) shop.script (new file) trophies.script (get Text from MAIN.$achievement.$achievementData if no string is defined for it) \ui\moneybar\ moneybar.script (in thread "gameUI", changed wait time from 0.51 to 1.51, so less reputation calculating, perfomance) \ui\toolbar\ submenu.script (addButton function will check text if button is already defined, so it won't be added twice) \ store (new file) Changes between 0.17 -> 0.19 ---------------------------------------------- data.gs: sky.fragment final.fragment final.vertex default.shader fog.fragment metro.gs: on-board.dds engine.script (Camera .smoothness = 0.75); system.script (Pause mode, MAIN.$window.enabled will be set to disabled) ui.script (event $stop.itemUpdated::() change attractiveness and maintenance) de.strings (stop rename texts, Mac Port) en_US.strings es.strings fr.strings achievement.script ($achievements.gamecode = "citiesinmotion"; ) linepanel.script (Rename Button code, new tracer for Linenumber in function spawnBus ) graphics.script (Check for Platform, Frequency only on windows) minimap.script (MAIN.$grid.viewMode forced mode check) petitionbar.script ( Set $era = 0; on init) cameratarget.script (new event $target.itemUpdated listener, changed $camera.owner to $camera.target) secondaryview.script ( calcs maintenance cost right, $camera.owner to $camera.target changes) build.script (Version, what else?) config.script (Use Mac control keys on Mac) controls-mac.keys (New file) Internals: New Constant: PLATFORM New Event $stop.itemUpdated:: validatePackage? Internal downloader? ========================= Price calculations ========================= The toolbar shown prices are calculated on it's own. The economy calculations are in economy.script. // Returns a price changed by economy (economyHistory) smoothed. // If the price is special = 2000000000 nothing is changed MAIN.$economy.getPrice($price) The main calculations are in hoverinfo.script: ---------------------------------------------- MAIN.$hoverinfo.getPrice($model); This function is a bit more complicate: $model is a GridObject (you know loadGridObject...) a) Does the gridobject script have a $price variable return it: b) Is it a GRID_ITEM_BUILDING? $result = $model.width * $model.length * 12000; No? Get the price from $priceClasses[$model.type] Check the connections this gridobject has, if it has an even and uneven bit set, use second entry in $priceClasses[$model.type] -> it costs more Additional it sets hoverinfo.script local variable $playerStructure. Flow: ----- Hovering onHoverConstruct and onHoverDemolish. (Note: The functions do a bit more, only money flow is described) Reset $price, $reputation, $playerStructure For each item build or removed set $p to getPrice of item. if the economy is enabled, alter value with MAIN.$economy.getPrice($p) add $p to $price. Change $reputation. When demolishing: if $playerStructure == true reset reputation if a campaign is run multiply by MAIN.$campaign.$campaign.$demolishCost percentage. else divide the price by 4 (Don't ask me why) tryApplyTool: Check and confirm if a object should be removed? Can the money MAIN.$playerData.spendMoney($price) be spend or show error dialog and end. Show Effect, Play Sound Try apply the tool on success alter company value, and use earnMoney by negative price to reduce money. ========================= Lines: ========================= $grid.lines.createLine(); MAIN.$gameData.$lines[] ? Removing stations still in a line crashes 1.0.13, 1.0.14 may be more tollerant. Removing lines while active seems to work in 1.0.17 without a problem. However adding a line still may crash the whole game as soon as next entry for vehicle changes and slots-dump.raw is written. Adding a stop isn't scriptable and is done via gsGridPlayer: MAIN.$toolbar.selectTool(GRIDMODE_ADD_STOP, $selectedLine.type); $player.toolLine == $selectedLine ========================= Tram Roundabouts ========================= tram_large_small_ra* are the roundabouts for trams. Loading them won't work directly, the bitmaps are missing, using the roads bmps will allow loading them and building them. The result is a graphical mess, but a tram path will clearly shows a roundabout. Loading and rendering shows that the whole object file seems to be broken. ========================= Objects: ========================= Scripts: ------------------------- this.width this.length this.height this.displayName Sets name, usally by MAIN.$strings.* Objects without name may not be destroyed ingame! this.connection = 0xDDCCBBAA AA = Small Road / Small Tram BB = Large Road / Large Tram CC = Avenue Road DD = Metro 0x80 0x01 0x02 0x40 -- 0x04 0x20 0x10 0x08 this.connections2 used by bridges, ramps, tunnels, port this.diagonals = 0xABCD Edge Cut for diagonal parts. A#####B ####### ####### D#####C Example: this.diagonals = 0x0123 ######\ ####### _###### __####_ this.flags = GRID_ITEM_* | ... GRID_ITEM_STOP GRID_ITEM_ALIGN_4 Align the object GRID_ITEM_COVER CIM won't draw the ground texture. Speed improvment for object that really cover the whole space. (streets as example) Usefull for objects that want to show the underground aswell. GRID_ITEM_BLOCK GRID_ITEM_LOCK_GROUND Always build on ground. GRID_ITEM_BRIDGE GRID_ITEM_TUNNEL GRID_ITEM_SLOPE_1p2 GRID_ITEM_SLOPE_1p4 GRID_ITEM_SLOPE_1p8 GRID_ITEM_SLOPE_1p16 GRID_ITEM_CONCAVE Used by tracks and roads, specially handling for curves and junctions? GRID_ITEM_SPECIAL0 Used by port / porta roads and large_small_end45r GRID_ITEM_SPECIAL1 Used by portb roads and large_small_end45l GRID_ITEM_DISABLE_TRAM Don't build trams here, used by express objects GRID_ITEM_ENABLE_BASE GRID_ITEM_PAVEMENT Adds a pavement texture around object. GRID_ITEM_SHOW_CHARACTER Show the character when visiting building. (marketstand) GRID_ITEM_PILLAR GRID_ITEM_OPTIONAL GRID_ITEM_HIDE_LOD Seems to be used to hide objects when zoomed out, like for fences this.type = GRID_ITEM_* or 0 for general object. GRID_ITEM_BUILDING calculates the cost by size. this.variation Variations can be loaded for types. As example addional streets/tram tracks Low numbers will be used by CO. High numbers should be safe for the community. Something afer 500 and not more then 0xFFFF should be safe. this.vertexGeneration = true/false this.storeMesh = true/false this.offsetx this.offsetz $price = number; 2000000000 = can't be destroyed this.addVisitPlaces(GRID_VISIT_*, factor); this.addWorkPlaces(GRID_CITIZEN_*, factor); Events: ------------------------- .onLoaded::() .onPlace::($c, $x, $y, $z, $a) .onLoaded::() .onDestroy::() used to destroy sounds Paths in Scripts: ------------------------- Change Path Flags in onLoaded: this.setPathFlags(name, constant); constants can be a combination of: GRID_PATH_START GRID_PATH_END GRID_PATH_STOP GRID_PATH_ALTERNATIVE_STOP GRID_PATH_LANE_CHANGE = For Avenues GRID_PATH_TRAM_TRACK Used by Tokyo Mono to convert metro parts to tram path parts. GRID_PATH_ROAD_EXPRESS Marks part as road express. GRID_PATH_ROAD_SMALL Used for gate object GRID_PATH_IGNORE_TRAFFIC Used on Express Ways. GRID_PATH_INTERSECTION Used on crossings, used by mono so trains reserve the path GRID_PATH_EXTERNAL Used by Tokyo *port* objects... GRID_PATH_CONNECT_TO GRID_PATH_CONNECT_FROM Seems to connect parking garage with street? GRID_PATH_PARK Parking space Adding Paths (used for vehicle doors): this.addPath(name, constant, vector1, QUAT_IDENT, vector2, QUAT_IDENT); this.onPlace::($c, $x, $y, $z, $a) ------------------------- $c is an array stream of $object, $x, $y, $z, $a where: $object = CONSTANT or string. $x = West to East $y = Groundlevel $z = North to South $a = Flags / Additional Data: GRID_ITEM_SUBWAY_METRO flags in 32bit? service_metrou0 rotation of object? if $object = GRID_ITEM_*_METRO or other paths, it is a connection map. Bitmaps: ------------------------- *-y.bmp = Height Map as big as the object size in script. 128 color units = 1 tile (= 3 meters) 64 color units max height change people accept reaching a point *.bmp = Pedestrian Map, size*4. White (255, 255, 255) free space, citizens can spawn. Green (0, 255, 0) free space, no spawning and walk only if necessery. Blue (0, 0, 255) crosswalk. Black (0, 0, 0) blocked area. Black Color = People should not use this part of object Blue color in BMP seems pathway for people? *b variant for diagonal objects If the bitmap doesn't have the right size, citizen won't use the object. Textures: ------------------------- this.setTextureVariation(variationnumber, loadMaterial(MAIN.$window.video, "somematerial.material"));) Vehicle (BUS) Object? ------------------------- onSpawn onUnspawn onDestroy onGetPassenger::($passenger, $waitTime, $alreadyPaid) onBroken onFixed ? onCannotReach::($pos) onJammed .getModel(); = object? Vehicles are at: MAIN.$gameData.$ownVehicles[.$id]; And get attached to Line objects. ========================== Script Language ========================== Comments: // /* */ MAIN = main script object Encoding (Charset) ------------------------- .script ASCII .strings UTF16 LE with BOM Debugging console. ------------------------- In settings.script: $debug = true; $disableDebug = false; consoleCommands are undefined, eval isn't compiled into CIM (it is used to be in Skies) F11/F12 can be used to display / hide console. Console commands can be added like this: function myfunctionname() { } MAIN.$consoleCommands["mycommand"] = myfunctionname; Enableing Debug enables the timeline editor Threads: ------------------------------ thread :: { } = "GameUI" A gameui thread? use delete to destroy own threads... Events: ------------------------------ There are several events, keyevents and state maschine events. A statemaschine object can be controlled via .perform("something") changes the internal state maschine to this state. Strings ------------------------------ Positions are zero based, -1 means not found/error $string = substr($str, $start, $len); $pos = findstr($str, $searchstr); #$str Stringlen $expandedstring = (will expand %0 %1 to the variables passed to the function) $outstr = escapePattern($instr); Always used together in the UI: escapePattern(expandPattern($strings.$sample, ...)) Maps / Array: ------------------------------ CIM knows both types: $myarray = [] $mymap = map [] Arrays: #$array = array size; Note @ means reference to variable! array_splice($array, $pos, $num); array_erase($array, $item); array_shuffle($array); Maps: Traversing by keys: foreach (keys $mymap) { $key = current; } or via foreach_reverse Traversing by values (CIM sorts by key): foreach (values $mymap) { $value = current; } map_erase($map, $mapkey); Filesystem Functions: ------------------------------ changeFileExt($filename, $newextension) extractFileExt extractFilePath extractFileDir extractFileName getMyDocumentsFolder init_userdata updateFileSystem file_exists list_files list_dirs mkdir rmdir freset fappend copy_file delete_file write_file read_file read_lines load Loads a script file, relative to the current script path or absolute starting with "/" Object Editor? ------------------------------ EDITOR_MODE_CREATE_PATH EDITOR_MODE_DEFAULT new_editor? The useable map editor seems to be a different kind of editor? There isn't a call to new_editor in metro scripts. Are these parts of the internal SDK? GRID_* Constants: ------------------------------ GRID_VIEW_SPECIAL GRID_VIEW_WATERBUS GRID_VIEW_METRO GRID_VIEW_TRAM GRID_VIEW_BUS GRID_VIEW_VEHICLETYPE GRID_VIEW_UNEMPLOYED GRID_VIEW_PENSIONER GRID_VIEW_TOURIST GRID_VIEW_STUDENT GRID_VIEW_BUSINESS GRID_VIEW_WHITECOLLAR GRID_VIEW_BLUECOLLAR GRID_VIEW_CITIZENTYPE GRID_VIEW_POPULARITY GRID_VIEW_CATCHMENT GRID_VIEW_TRAFFIC GRID_VIEW_GOVERNMENT GRID_VIEW_LEISURE GRID_VIEW_SHOPPING GRID_VIEW_WORKPLACES GRID_VIEW_HOMES GRID_VIEW_UNDERGROUND GRID_VIEW_DEFAULT GRID_VISIT_ARMY GRID_VISIT_EMERGENCY_POLICE GRID_VISIT_EMERGENCY_FIRE GRID_VISIT_EMERGENCY_INJURY GRID_VISIT_EMERGENCY GRID_VISIT_DELIVERY GRID_VISIT_HEAVY_INDUSTRIAL GRID_VISIT_GOVERNMENT GRID_VISIT_LEISURE GRID_VISIT_SHOPPING GRID_VISIT_WORK GRID_VISIT_HOME GRID_VISIT_GENERIC GRID_CITIZEN_TRAVEL GRID_CITIZEN_DRIVE GRID_CITIZEN_WALK GRID_CITIZEN_IDLE GRID_CITIZEN_UNEMPLOYED GRID_CITIZEN_PENSIONER GRID_CITIZEN_TOURIST GRID_CITIZEN_STUDENT GRID_CITIZEN_BUSINESS GRID_CITIZEN_WHITE_COLLAR GRID_CITIZEN_BLUE_COLLAR GRID_PATH_WALK GRID_PATH_WATER GRID_PATH_RUNWAY GRID_PATH_METRO_TRACK GRID_PATH_TRAIN_TRACK GRID_PATH_TRAM_TRACK GRID_PATH_ROAD_EXPRESS GRID_PATH_ROAD_LARGE GRID_PATH_ROAD_SMALL GRID_PATH_BLOCKER GRID_PATH_PARK GRID_PATH_EXTERNAL GRID_PATH_IGNORE_TRAFFIC GRID_PATH_CONNECT_FROM GRID_PATH_CONNECT_TO GRID_PATH_ALTERNATIVE_STOP GRID_PATH_END GRID_PATH_START GRID_PATH_STOP GRID_PATH_LANE_CHANGE GRID_PATH_INTERSECTION GRID_ITEM_TIMER GRID_ITEM_SPAWNPOINT GRID_ITEM_MARKER GRID_ITEM_BUILDING GRID_ITEM_HELIPORT GRID_ITEM_DOCK GRID_ITEM_METRO_STATION GRID_ITEM_TREE GRID_ITEM_ELEVATED_METRO GRID_ITEM_SUBWAY_METRO GRID_ITEM_GROUND_METRO GRID_ITEM_AVENUE_TRAM GRID_ITEM_LARGE_TRAM GRID_ITEM_SMALL_TRAM GRID_ITEM_DOUBLE_TRACK GRID_ITEM_SINGLE_TRACK GRID_ITEM_EXPRESS_ROAD GRID_ITEM_AVENUE_ROAD GRID_ITEM_LARGE_ROAD GRID_ITEM_ELEVATED_RAMP GRID_ITEM_GROUND_RAMP GRID_ITEM_SMALL_ROAD GRID_ITEM_ALLEY GRID_ITEM_NONE GRID_ITEM_ERROR GRID_ITEM_TEMP GRID_ITEM_SHOW_CHARACTER GRID_ITEM_ALIGN_4 GRID_ITEM_HIDE_LOD GRID_ITEM_PAVEMENT GRID_ITEM_PILLAR GRID_ITEM_OPTIONAL GRID_ITEM_SPECIAL1 GRID_ITEM_SPECIAL0 GRID_ITEM_DISABLE_TRAM GRID_ITEM_BLOCK GRID_ITEM_TUNNEL GRID_ITEM_BRIDGE GRID_ITEM_STOP GRID_ITEM_CROSS_TRACK GRID_ITEM_CONCAVE GRID_ITEM_SLOPE_1p2 GRID_ITEM_SLOPE_1p4 GRID_ITEM_SLOPE_1p8 GRID_ITEM_SLOPE_1p16 GRID_ITEM_LOCK_GROUND GRID_ITEM_COVER GRID_ITEM_ENABLE_BASE GRIDSTOP_HELICOPTER GRIDSTOP_BOAT GRIDSTOP_METRO GRIDSTOP_TRAM GRIDSTOP_BUS GRIDMETRO_ELEVATED GRIDMETRO_SUBWAY GRIDMETRO_GROUND GRIDTRACK_DOUBLE GRIDROAD_EXPRESS GRIDROAD_AVENUE GRIDROAD_LARGE GRIDRAMP_ELEVATED GRIDRAMP_GROUND GRIDROAD_SMALL GRIDMODE_SET_VARIATION GRIDMODE_RENAME GRIDMODE_RUIN GRIDMODE_LAY_ALLEY GRIDMODE_LAY_TRAM_TRACK GRIDMODE_SET_FIELD GRIDMODE_SET_PAVEMENT GRIDMODE_GROW_TREES GRIDMODE_TOGGLE_WATER GRIDMODE_LAY_TUNNEL GRIDMODE_LAY_BRIDGE GRIDMODE_CREATE_STOP GRIDMODE_ADD_STOP GRIDMODE_REMOVE_OBJECTS GRIDMODE_PLACE_OBJECT GRIDMODE_LAY_TRACK GRIDMODE_LAY_ROAD GRIDMODE_SOFTEN_TERRAIN GRIDMODE_LEVEL_TERRAIN GRIDMODE_SHIFT_TERRAIN GRIDMODE_SELECT_OBJECT GRIDMODE_NONE GRIDVEHICLE_CRASHED GRIDVEHICLE_BROKEN GRIDVEHICLE_HELICOPTER_DUST ========================== Creating Addons ========================== addons\\scripts For easier debugging, add echo statements, like so: echo "Loading game.script"; Then you and others can see if your addon load properly. game.script seem to need a function: function updateERA($year) { } Getting a Path to your Script and load scripts (Sample Loader): ------------------------------ Be sure to have proper Destroy events in subscripts, if a subscript fails to load properly, the game won't stop. (Or compiling fails) $modpath = extractFileDir(this.scriptFilename); $modscripts = []; function doload() { $modscripts[] = load "/"+$modpath+"/somescript.script"; } function dounload() { foreach ($modscripts) { if (current) { delete current; current = null; } } $modscripts = []; } event this.onDestroy::() { dounload(); } doload(); /* // For Debugging: event MAIN.$player.keyDown::["O"]() { echo "Reloading Scripts in " + this.scriptFilename; dounload(); doload(); } */ Access Menu: ------------------------------ $buildMenu = MAIN.$buildMenu; $toolbar = MAIN.$toolbar; $buildMenu.addButton(/*See other scripts */); event this.onDestroy::() { echo "Destroying game.script"; if (this.$toolbar) { this.$toolbar = null; } if (this.$buildMenu) { this.$buildMenu = null; } } Getting the Ticket Prices ------------------------------ $baseTicketPrices = MAIN.$hqpanel.$tabs[3].$baseTicketPrices; $ticketPriceColors = MAIN.$hqpanel.$tabs[3].$ticketPriceColors; Load Objects: ------------------------------ environment.script: $grid.loadGridObject("", "" ); You can load a object with a different name, and manipulate it's states. $obj = $grid.loadGridObject("", "" ); $obj.property = The type and variation can't be manipulated after loading... Access the menu in addons ------------------------------ $buildMenu = MAIN.$buildMenu; $toolbar = MAIN.$toolbar; $buildMenu.addTypeButton("smallroad"); $buildMenu.addButton("smallroad", "road0", macro :: $toolbar.selectTool(GRIDMODE_LAY_ROAD,0,0), 2000); selectTool seems to be wrong for GRIDMODE_LAY_ROAD. First Number will switch different roads second number 1 = zebra crossing? ========================= 3D Objects ========================= Outdated, see (modifed) gs_tools ========================= Other References for Fileformats and Scripts: ========================= http://www.bytetransfer.de/projects/cim/ http://www.game-artist.net/forums/hiring-mods-volunteers/5848-indie-seeking-character-animator.html http://mathpudding.com/PGD/tss/ (The great-grandfather of the script system?) http://aukiogames.com/skies (The gs file seems to have .objects) http://londongameproject.com (2008)