Loading

Paste #pnqweidrz

  1. class MyNewGS extends GSController
  2. {
  3.  
  4.   function Start()
  5.   {
  6.     //This function is inside the class declaration.
  7.   }
  8.    
  9.   //These are optional prototypes. Notice the ; at the end rather than {}.
  10.   //Squirrel doesn't require it, but some programmers like to use them.
  11.   function Save();
  12.   function Load(version, data);
  13. }
  14.  
  15. function MyNewGS::Save()
  16. {
  17.   GSLog.Info("//This function is outside the class declaration and requires the name of the class so squirrel can assign it to the right place.")
  18.   return {};
  19. }
  20.  
  21. function MyNewGS::Load(version, data)
  22. {
  23.   GSLog.Info("Load")
  24. }
  25.  
  26. function MyNewGS::Start()
  27. {
  28.  local goal_reached = false
  29.   while (true) {
  30.    while (goal_reached == false) {
  31.     local goal = GSController.GetSetting("value")
  32.     local date = GSDate.GetCurrentDate()
  33.     GSLog.Warning("Current Date: " + GSDate.GetYear(date) + "-" + GSDate.GetMonth(date) + "-" + GSDate.GetDayOfMonth(date) + " ; Goal: £" + goal)
  34.     local cid = 0
  35.     while (cid != 15) {
  36.      local cv = GSCompany.GetQuarterlyCompanyValue(cid, GSCompany.CURRENT_QUARTER)
  37.      cid = cid + 1
  38.      GSLog.Info("Company " + cid + ": £" + cv)
  39.      if (cv >= goal) {
  40.       GSLog.Warning("Company " + cid + " has reached the company value goal of £" + goal)
  41.       GSGame.Pause()
  42.       goal_reached = true
  43.       break
  44.      }
  45.     }
  46.     GSLog.Warning(" ")
  47.     this.Sleep(74)
  48.    }
  49.    this.Sleep(500)
  50.   }
  51. }

Comments