AI Development Problems....AI not seen

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
Codewolf
Engineer
Engineer
Posts: 3
Joined: 29 Dec 2009 09:14

AI Development Problems....AI not seen

Post by Codewolf »

Hi guys, i have been playing OpenTTD for quite a while now and have decided to have a go at creating my own AI, i have followed the Wiki introduction to creating AI's and spent a good hour or so browsing this subforum to fix my problem, the problem being i just cant seem to get OpenTTD to recognise my AI (which currently consists of the 2 wiki example files), when using the command 'list_ai' it produces a blank list, even after trying to force it to reload wth 'rescan_ai'

the current locations of my *.nut files are as follows:

%USERPROFILE%\My Documents\OpenTTD\ai\MyNewAI

as well as

%USERPROFILE%\My Documents\OpenTTD\content_download\ai\MyNewAI

so any ideas if i'm being blind and making a silly mistake, or if they are in the right location.
ps.i have placed them in the 2 seperate directories just to see if they load, no other reason
pps. its a Windows machine.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AI Development Problems....AI not seen

Post by Lord Aro »

i had that problem with my ai as well except that i had made mine into a .tar and for some reason ottd wouldn't read it
i untared it (is that the right word?) and then ottd would read it again :roll:
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: AI Development Problems....AI not seen

Post by Zuu »

%USERPROFILE%\My Documents\OpenTTD\ai\MyNewAI
This should be enough. Better just have your files at one location so that you can be sure that OpenTTD sees the last edits.

It could be that the AI do not get past the compile/recognition stage that makes it appear in openttd --help and the other AI lists. You could run OpenTTD with debug level set to 5 for 'ai' and read what it says about your AI when it tries to compile it.

Code: Select all

openttd -d ai=5
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Codewolf
Engineer
Engineer
Posts: 3
Joined: 29 Dec 2009 09:14

Re: AI Development Problems....AI not seen

Post by Codewolf »

ahh perfect...cheers zuu, i mis-typed a function name
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: AI Development Problems....AI not seen

Post by MinchinWeb »

This has been great in getting my own basic AI into OpenTTD. However, how do you decrypt the error statements? Do they give you the line numbers of the code that is failing? I get output in the console window like (with four lines of the same thing...):

Code: Select all

Error C:\Users\Wm\Documents\OpenTTD\ai\WmDOT\info.nut:15/3: expression expecteddbg: [misc] [squirrel] Failed to compile 'C:\Users\Wm\Documents\OpenTTD\ai\WmDOT\info.nut'
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: AI Development Problems....AI not seen

Post by Kogut »

info.nut:15/3
file: info nut
line number 15, column 3
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests