GetAPIVersion() in info.nut
Moderator: OpenTTD Developers
GetAPIVersion() in info.nut
r17214 added GetAPIVersion() as (for now) optional function to info.nut. Currently there are two valid return values: "0.7" and "0.8". If your AI returns "0.7" a compatibility script will be loaded so the API resembles the 0.7 API as much as possible. If you return "0.8" all functions previously marked as deprecated are now unavailable. Returning "0.8" is currently inadvisable, since the 0.8 api may change before a release is made. For AIs that don't implement this function "0.7" will be assumed for now. In the future this default will be removed and AIs without this functions will then no longer load.
Re: GetAPIVersion() in info.nut
Is that mean, in the future, API 0.7 would still available (as long as possible) although 0.8 has been released?
Re: GetAPIVersion() in info.nut
Yesfanioz wrote:Is that mean, in the future, API 0.7 would still available (as long as possible) although 0.8 has been released?

Re: GetAPIVersion() in info.nut
Though in subsequent releases functions can become more expensive in the amount of "ops" they take; if an API wrapper is used it will use some of your N ops per tick.Yexo wrote:Yesfanioz wrote:Is that mean, in the future, API 0.7 would still available (as long as possible) although 0.8 has been released?. The definition of "as long as possible" is still unclear, but it'll definitely be available in 0.8
Re: GetAPIVersion() in info.nut
So the GetAPIVersion() is only optional for the 0.7x branch?
Re: GetAPIVersion() in info.nut
It'll still be optional in 0.8 (otherwise the 0.7 AIs couldn't be loadedChruker wrote:So the GetAPIVersion() is only optional for the 0.7x branch?

Re: GetAPIVersion() in info.nut
Since this topic is still relatively new I'll reuse it to announce some two other changes:
FS#3101 is implemented in r17221. From now on you can give all variables to all string functions requiring a string. Most important use it probably to print integers with AILog::* functions.
FS#2980 is implemented in r17223. From now on if an AI executes a DoCommand / Sleep at an invalid time the AI is crashed. You can't catch this error in squirrel, but you will get a stack trace printed in the AI debug window.
FS#3101 is implemented in r17221. From now on you can give all variables to all string functions requiring a string. Most important use it probably to print integers with AILog::* functions.
FS#2980 is implemented in r17223. From now on if an AI executes a DoCommand / Sleep at an invalid time the AI is crashed. You can't catch this error in squirrel, but you will get a stack trace printed in the AI debug window.
Re: GetAPIVersion() in info.nut
Thats great, would be helpfull for debuggingYexo wrote: ...
FS#2980 is implemented in r17223. From now on if an AI executes a DoCommand / Sleep at an invalid time the AI is crashed. You can't catch this error in squirrel, but you will get a stack trace printed in the AI debug window.

Who is online
Users browsing this forum: No registered users and 5 guests