Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Feb 16, 2019 8:40 pm

All times are UTC

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Apr 19, 2017 8:06 pm 

Joined: Mon Dec 29, 2008 10:28 pm
Posts: 27
Location: my own mind
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
PostPosted: Fri Apr 28, 2017 3:44 pm 
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4548
Location: /home/sweden
   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);

My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.