API changes at 2009-01-15 [UPDATE]

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

API changes at 2009-01-15 [UPDATE]

Post by TrueBrain »

Today too, we have a change in the API, which makes all current AIs fail to load. And yes, it is really needed.

In your info.nut and libary.nut you need to add a new function called:

GetShortName()

It should return a 4 (four) character string, which is unique throughout the world (well .. for AIs and AI Libraries related to OpenTTD that is of course ;)). Example:

GetShortName() { return "TEST"; }

Returning a string of any other size will make your AI unloadable. We will use this ShortName to track your AI better.

If you start using a ShortName in public, make sure to post your tag in the topic about it (sticky, in this forum).

[Update]

All AI Libraries should now have this function in their library.nut:

GetCategory()

Which returns a string of the category the library belongs to. This should be equal to the directory it is in for now. Soon you will understand why those changes are needed :)
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: API changes at 2009-01-15

Post by Zutty »

If they must be unique then should we make a list somewhere to help ensure they don't collide? I knows unlikely given the small number of AIs out today, but still!

I'll be PZLA :D
PathZilla - A networking AI - Now with tram support.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: API changes at 2009-01-15

Post by Yexo »

ADML is mine :)

I don't think they'll collide anytime soon though, seeing how it still works with newgrfs
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: API changes at 2009-01-15

Post by Zutty »

Yexo wrote:I don't think they'll collide anytime soon though, seeing how it still works with newgrfs
Oh I see. Shows how much I really know about OpenTTD!
PathZilla - A networking AI - Now with tram support.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 29 guests