AIEvent.GetEventString()?

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
User avatar
Xander
Route Supervisor
Route Supervisor
Posts: 485
Joined: 18 May 2007 12:47
Location: Oxford
Contact:

AIEvent.GetEventString()?

Post by Xander »

We have .GetLastErrorString() for errors, can someone do the same thing for events?
Real Tycoons do it on Trains!

JAMI: Just Another Moronic Intelligence
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AIEvent.GetEventString()?

Post by Yexo »

What is the point of it? For errors it's easy to print what kind of error occured, but for events I see no reason. Either you handle a certain event or it's unknown and you ignore it.
User avatar
Xander
Route Supervisor
Route Supervisor
Posts: 485
Joined: 18 May 2007 12:47
Location: Oxford
Contact:

Re: AIEvent.GetEventString()?

Post by Xander »

Yexo wrote:What is the point of it? For errors it's easy to print what kind of error occured, but for events I see no reason. Either you handle a certain event or it's unknown and you ignore it.
Same reason you print errors, to see which one occurred and print it to the AILog.
Real Tycoons do it on Trains!

JAMI: Just Another Moronic Intelligence
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AIEvent.GetEventString()?

Post by Yexo »

In my opinion there is a difference. Unknown errors are interesting to see, but unknown events are not interesting (if your AI doesn't handle it at all, why log it?) For those events you already have you can easily log the names yourself.
Chruker
Engineer
Engineer
Posts: 49
Joined: 01 Jun 2009 20:13

Re: AIEvent.GetEventString()?

Post by Chruker »

During development it would be nice to just be able to print them without too much switch+case.
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: AIEvent.GetEventString()?

Post by fanioz »

What if this would go to AICommon.Library instead.
Some time I convert AIVehicleType enumeration to string too. To ease debugging. :D
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests