|
Simutrans-Squirrel-API OTRP v63_4
|
Let us inspect a sample script file. We will have a look into the pak64 Millionaire scenario. The objective of this scenario is to get rich as fast as possible.
As first the savegame is specified:
Then we provide some meta-information about the scenario
Rules and goals are not that special. The texts returned in this functions will be shown in the scenario info window. String constants with leading '@' can span multiple lines.
The method presenting the result text is a little bit more advanced. If the player has enough cash, he has won the scenario.
The get_cash() method accesses the player's bank account via player_x.cash, which is equivalent to calling player_x.get_cash().
Last but not least, the function that computes the actual progress in the scenario. If it returns a negative value, the player has lost. If the return value is larger than 100, this is equivalent to winning the scenario.