Transport Tycoon Forums

GSCompanyMode not working properly
Page 1 of 1

Author:  thegreatpl [ Wed Apr 19, 2017 8:06 pm ]
Post subject:  GSCompanyMode not working properly

Either I am trying to use it wrong, or it is not working. Every time I try to use GSCompanyMode to build something (specifically, an airport and levelling the ground around where the airport will go) it fails with an ERR_PRECONDITION_FAILED. From what I can tell, the only precondition that is not valid is the GSCompanyMode.

I've attached the scripts I was using to try this.

I am completely aware I may just have screwed up my script. I have glanced at the SplitScenarioGS though, and can see pretty much the same thing there as what I was trying to do.

IS [14.17 KiB]
Downloaded 22 times

Author:  Zuu [ Fri Apr 28, 2017 3:44 pm ]
Post subject:  Re: GSCompanyMode not working properly

   GSSign.BuildSign(100, "testing"); 
   GSLog.Info("Switched to mode for " + GSCompany.GetName(companyIdx));

You need to store the result from GSCompanyMode() in a variable. The company mode is in effect for as long as this variable is in scope. Basically when the instance is destroyed, the company mode exits. Since you don't store it in a local variable, it is destroyed immediately.

local cm = GSCompanyMode(companyIdx);

Page 1 of 1 All times are UTC
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.