Changes

Jump to navigation Jump to search
971 bytes added ,  15:36, 4 February 2020
Line 279: Line 279:     
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)'''.
 +
 +
==== Script example ====
 +
This script is used in the microphone surveillance feature of the Operating System SoftwareType:
 +
if (Product.GetVar("MicMining", true)) //Check if player has been caught
 +
{
 +
Product.Bugs = Max(0, Product.Bugs - Product.Userbase * 0.01); //Remove 1 bug from product for each 100th active user
 +
if (Random() * Product.Userbase > 1000000 * Product.Category.Popularity) //Random chance of getting caught
 +
{
 +
LaunchLawsuit("SpyingOnUsers", Product.Sum, 1); //Create anonymous lawsuit
 +
Product.DevCompany.AddFans(-Product.Userbase, Product.Category); //Remove fans and market recognition from player in category
 +
Product.Userbase = Product.Userbase * 0.05; //Remove 95% of active users
 +
Product.KillAwareness(); //Remove all marketing
 +
Product.PutVar("MicMining", false); //Mark player as caught for this product
 +
}
 +
}
 +
You should download the mod data zip and check out examples of other scripts in the other vanilla SoftwareTypes.
    
=== Software categories ===
 
=== Software categories ===

Navigation menu