Loading AI

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
scallas
Engineer
Engineer
Posts: 4
Joined: 04 Nov 2010 07:22

Loading AI

Post by scallas »

Hi there, I'm trying to load the ai I created using the online tutorials at openTTD NoAI site.
But everytime I start OpenTTD (in admin mode) it doesn't load my AI.
I did download other AI's in online content in game and they work, but not the one's I create, Even if I copy and past the contents of the main and info files it doesn't appear in AI settings! :(
Help please!
Using Vista
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Loading AI

Post by Kogut »

Probably your info.nut file is broken. Can you post it?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
scallas
Engineer
Engineer
Posts: 4
Joined: 04 Nov 2010 07:22

Re: Loading AI

Post by scallas »

Just a basic file:

Code: Select all

class CyrusAI extends AIInfo 
{
  function GetAuthor()        { return "scallas"; }
  function GetName()          { return "CyrusAI"; }
  function GetDescription()   { return "My First attempt"; }
  function GetVersion()       { return 1; }
  function MinVersionToLoad() { return 1; }
  function GetDate()          { return "2010-11-02"; }
  function GetShortName()     { return "Cyrus"; }
  function CreateInstance()   { return "CyrusAI"; }
  function GetAPIVersion()    { return "1.0"; }
}

/* Tell the core we are an AI */
RegisterAI(CyrusAI());
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Loading AI

Post by planetmaker »

http://noai.openttd.org/api/trunk/classAIInfo.html tells me that the shortname must be exacly 4 characters long. You use a longer shortname.
scallas
Engineer
Engineer
Posts: 4
Joined: 04 Nov 2010 07:22

Re: Loading AI

Post by scallas »

Thanks. That solved it!!

:lol:
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Loading AI

Post by Yexo »

If you had started openttd with "-d ai=9" you would have gotten an error message telling you what exactly was wrong.
scallas
Engineer
Engineer
Posts: 4
Joined: 04 Nov 2010 07:22

Re: Loading AI

Post by scallas »

Is that loading the debug window?
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests