| 10-16-2002, 06:24 PM | #1 |
Guest | If any of you have ever put together an AI script and had it not work the way you expect, you probably already know that the functions meant for debugging in common.ai don't seem to work (or I can't figure how to get them to work). However, all isn't lost, as you can use some of the functions from common.j to display text to the screen. Namely: DisplayTimedTextToPlayer() Calling this from within an AI script does in fact work, and is a good way to trace the execution of your script on the fly. Unfortunately the integer to string converson functions don't appear to work right from an AI script, so you have to do some workarounds to get an integer value to print. The fact that you can call common.j functions from within an AI script might be common knowledge, but it was news to me :gsmile: I thought it was worth sharing here. It appears that access to common.j is limited, however. For example, I was speaking to someone who was able to create dialog boxes from within an AI script, but the buttons don't seem to work right. BTW, I didn't discover this on my own. AIAndy, over at the battle.net forums brought this to my attention. |
| 10-17-2002, 04:36 AM | #2 |
I have yet to figure exactly what the Native debug stuff does their are threee of them and they take stuff and return nothing. I am guessing they must display. I wish I could find where natives source code was located I would be so happy. Personally I am sure they work, we just don't know how to use them right and also if they actually debug the AI and not just a string or something. Yes use that function here is the code. call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 5, "You incorrectly typed your command.") If the code appears to do nothing. I slap some of those at different intervals to find exactly where it crashed. Als the S2I and I2S work here is how you do it. local integer j = 3 call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 5, I2S(j)) Reason you have to convert it to a string is this function requires a string. Works nice and same for converting a string to integer local string put = "234" if 22 = S2I(put) All Functions within Blizzard.j and common.j can be used they are the JASS Code. The only functions that I know of that don't work was the dialog but that was fixed in the Last patch if Weaadar said right. Same as common.ai you can any function in it and I think, the race specific .ai file for the race you are doing. like human.ai. When Blizzard runs. It basiclly loads all those into memeory they are like one big list not 4 or 3. I could add other files to run and add to the list but to use the functions you have to make sure the .ai file was loaded. Their you go for that holler if you have any other questions. |
| 10-17-2002, 05:39 PM | #3 |
Guest | Yeah, I'm sure the native trace functions work, but I've tried everything I possibly could with them, and have gotten nowhere. My thought is that warcraft probably has to be run in a sort of debug mode for them to actually work, either with a command line parameter, or possibly through the 'Test Map' function in the WE. The problem with that is saving the map in the world editor causes the ai scripts to be removed. I'm eventually going to try adding a test script to war3patch.mpq and using that with the test map function, but I haven't gotten around to it. I know the functions work, because they're used in at least a couple blizzard scripts (human06 for sure) but we just need to figure out how to get them to work. ![]() |
| 10-17-2002, 06:02 PM | #4 |
When you test the trace function and the debug ones, When you run that map do you Run it from the World editor using test map or do you do it through war3. I don't know if there is a difference but I may be worth a try. |
| 11-19-2002, 12:52 AM | #5 |
From just looking that over, my guess is this: It displays the Trace to the actual COMPUTER PLAYER. Thus, you'd mark someone as human but run a computer AI on that slot, then you could watch the AI merrily build while reciving the trace msgs. Well, just a thought :D |
