Changes

Jump to navigation Jump to search
147 bytes added ,  17:04, 6 February 2020
Line 307: Line 307:     
You can either write your scripts directly in your [[TyD|TyD]] file as such:
 
You can either write your scripts directly in your [[TyD|TyD]] file as such:
  Script_EndOfDay "if (Product.GetCashflow(false).Last() > 100) { Product.DevCompany.MakeTransaction(-Product.GetCashflow(false).Last() * 0.1, Bills); } //Pay 10% of last days income if it is more than $100"
+
  '''Script_EndOfDay''' "'''if''' (Product.GetCashflow(false).Last() > <span style="color:blue">100</span>) { Product.DevCompany.MakeTransaction(-Product.GetCashflow(false).Last() * <span style="color:blue">0.1</span>, <span style="color:blue">Bills</span>); } <span style="color:green">//Pay 10% of last days income if it is more than $100"</span>
 
Or you can put your script in separate files and refer to them relative to your mod root folder, by starting with a forward slash:
 
Or you can put your script in separate files and refer to them relative to your mod root folder, by starting with a forward slash:
  Script_EndOfDay "/Scripts/MyScript.txt"
+
  '''Script_EndOfDay''' "/Scripts/MyScript.txt"
    
Finally, all SoftwareProduct's have their own local variables that you can read and write to for your scripts, just use '''Product.GetVar(VariableName, DefaultValue)''' and '''Product.PutVar(VariableName, Value)'''.
 
Finally, all SoftwareProduct's have their own local variables that you can read and write to for your scripts, just use '''Product.GetVar(VariableName, DefaultValue)''' and '''Product.PutVar(VariableName, Value)'''.

Navigation menu