• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[AI] How to debug AI

Status
Not open for further replies.
Level 2
Joined
Feb 3, 2010
Messages
4
I tried to use every DisplayText and similar functions I found on the forum, but somehow they do not work in the .ai scripts (scripts that you make in the AI editor and then edit externally). I tried functions in triggers and they do work there, of course.

Is there a way to make them work, or I should use some other method.

What I need is simple text display either on the screen, or above unit, or in the message log (is that possible?), or as a chat message, or even to a log file... Anything! :)

Thanks in advance!
 
Level 2
Joined
Feb 3, 2010
Messages
4
Ok, guys, thank you very much for all your great help!

Anyway, I found a way to debug my AI scripts and also discovered some other related things, maybe this could be helpful for someone else, so let's try to summarize:

- AI scripts cannot use functions from blizzard.j, but can use functions from common.j. If you need to use a function from blizzard.j, you will have to copy and paste it to your .ai file, and probably loose your mind before you find and copy all other necessary parts too (like global variables, helper functions, etc, etc) and finally make it work.
- There is also the common.ai file which contains functions used by AI scripts, but which cannot be used by triggers.
- It proved that finding these three files on the net is not such an easy job. If you need them, I can post here if that is allowed by forum rules.
- The easiest way (as far as I know at this moment) to debug your AI is to use DisplayTimedTextToPlayer(Player(observer),0,0,seconds,message), where observer is the slot number minus one of your player (either who you control or the observer). Messages are not only displayed on the screen, but in the Message Log (F12) too.
- Many functions that can be used in AI scripts (and which compile successfully) simply do not work. The most notorious example is the I2S function, which returns empty string instead of the string representation of a given integer.
That should be enough from me for now according to the interest my posts get here.

Looks to me like Blizzard made very sloppy programming environment for users, and that it is the main reason why they do not provide any support. Good luck!
 
Status
Not open for further replies.
Top