

A usual way is to limit the amount of the function to run to about once every game hour (that's about once every 3 seconds). But be sure that you don't do very heavy calculations every frame, otherwise the game will start running slower. In this function, you can analyze the game state and manipulate it, how you feel like. This is called about 30 times per frame by the game. When you create a mod, it can expose the following functions:

In there, you can do your game logic and access and manipulate the game. This is being called every game logic step. It works like this: You need to define a function object, which has a method named 'run'. Not very useful, but good as example code. This code will send a mail every two game hours to the player, with the current population amount of the city. Game_send_mail('Population: ' + game_get_city().Population, 'hourly report') If (now - this.LastTimeRan < 120) // only run every 120 minutes in game time n = function() // <- called about ~30 times per second by the game
MOD API DOWNLOAD MOD
This.LastTimeRan = 0 // last time this mod ran Open the script.js file and replace it with your own code, for example with this (which is a very simplified version of the detailed city report script):


MOD API DOWNLOAD HOW TO
If you don't have this, you might want to take a look on how to create mods without programming instead.
MOD API DOWNLOAD UPGRADE
The whole information was taken from and the information made available in offline with in the application (file size ~45MB).Application provides an option to view the class information by Alphabetical order or by package.All the content up to API level 23 can be accessed freely with out any adds from Free version.But if you want premium features and want to encourage further development, please, upgrade to premium version using In-App purchase. The Application contains 6500+ (300+ packages) android class information up to API Level 27 (Android 8.1). Offline Android API Reference Mod Offline Android API Reference Mod v3.1 (Premium) Features:
