API
Moderator: OpenTTD Developers
Error
Uh... I have made a folder at OpenTTD/AI named "MyNewAI", with the info.nut file:
...and main.nut file:
...but if I type
...I get the error:
Code: Select all
class MyNewAI extends AIInfo {
function GetAuthor() { return "Bennievv"; }
function GetName() { return "MyNewAI"; }
function GetDescription() { return "An example AI by following the tutorial at http://wiki.openttd.org/"; }
function GetVersion() { return 1; }
function GetDate() { return "2012-02-15"; }
function CreateInstance() { return "MyNewAI"; }
function GetShortName() { return "XXXX"; }
function GetAPIVersion() { return "1.0"; }
}
RegisterAI(MyNewAI());
Code: Select all
class MyNewAI extends AIController
{
function Start();
}
function MyNewAI::Start()
{
while (true) {
AILog.Info("I am a very new AI with a ticker called MyNewAI and I am at tick " + this.GetTick());
this.Sleep(50);
}
}
Code: Select all
start_ai MyNewAI
Code: Select all
WARNING: Failed to load the specified AI
Re: API
Do you have the AI files stored in the correct directory, so that OpenTTD can find them?
In other words: does you AI show up in the ingame (GUI) list?
In other words: does you AI show up in the ingame (GUI) list?
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: API
My best bet is "some of the necessary info is missing". Hard to tell.
Call OpenTTD in debug mode to check:
You can test the detected AI and libraries by calling "openttd --help" in the command line. And possibly by calling it in debug mode: "openttd -d script=X" where X is a number 1...9. The higher the more spammy it will get.
Call OpenTTD in debug mode to check:
You can test the detected AI and libraries by calling "openttd --help" in the command line. And possibly by calling it in debug mode: "openttd -d script=X" where X is a number 1...9. The higher the more spammy it will get.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Who is online
Users browsing this forum: No registered users and 34 guests