How can I move AddSetting from info.nut to other file-solved
Moderator: OpenTTD Developers
Re: How can I move AddSetting from info.nut to other file?
You can include other files in info.nut just like you do in main.nut.
Re: How can I move AddSetting from info.nut to other file?
In several of my scripts I have a separate file called version.nut that is included by both [info/library].nut and main.nut. In this file I keep constants that need to be available in both places. Typically constants are the script version (hence the file name).
In the Beginner Tutorial I have a special .nut file that is written by a script that defines a constant which tells if the script should allow taking over from earlier versions of the same script or not. In the Bananas version this constant is always false, but in order to upgrade the scenario file that is uploaded to bananas I set this constant to true; load the scenario in scenario editor; save; and then turn off this constant. For this I have a script that automates this process to reduce the risk that I make a mistake.
So yea, you can include files and there define eg. a method that adds settings and then call this method from the right place in info.nut.
A bit of warning though. info.nut is read when OpenTTD scans for available AIs and GSs. Thus don't include more into info.nut than a bare minimum to do what you want to accomplish.
In the Beginner Tutorial I have a special .nut file that is written by a script that defines a constant which tells if the script should allow taking over from earlier versions of the same script or not. In the Bananas version this constant is always false, but in order to upgrade the scenario file that is uploaded to bananas I set this constant to true; load the scenario in scenario editor; save; and then turn off this constant. For this I have a script that automates this process to reduce the risk that I make a mistake.
So yea, you can include files and there define eg. a method that adds settings and then call this method from the right place in info.nut.
A bit of warning though. info.nut is read when OpenTTD scans for available AIs and GSs. Thus don't include more into info.nut than a bare minimum to do what you want to accomplish.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: How can I move AddSetting from info.nut to other file-so
Thanks!
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Who is online
Users browsing this forum: No registered users and 11 guests