IPB

Welcome Guest ( Log In | Register )

7 Pages V  < 1 2 3 4 5 > »   
Reply to this topicStart new topic
> PyAI bug hunting, could be something not related to PyAi at all, but here goes.
Jørn Holm    Denmark
Jul 19 2008, 05:42 AM    Post #41
That did the job. Thanks Ashara!


 
Go to the top of the page +
poiuy_qwert    Canada
Jul 19 2008, 09:23 AM    Post #42
Yes sorry that was my fault and I forgot to put the fix in a public thread. Thanks for clearing that up for me Ashara.


 
Go to the top of the page +
Jørn Holm    Denmark
Jul 20 2008, 12:39 PM    Post #43
Maybe you can help me with another problem instead poiuy_qwert :-)

When I try to change the TBL file from PyAI and then save, I get the following error:

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Programmer\Python\lib\lib-tk\Tkinter.py", line 1403, in __call__
return self.func(*args)
File "C:\Documents and Settings\joern\Skrivebord\BWAI\PyMSwithGUIs\PyAI.pyw", line 2698, in save
self.tbl.compile(file, extra=True)
TypeError: compile() got an unexpected keyword argument 'extra'


Another thing I was wondering about ... when I try to compile ASC3 to PyAI from the editor, I get a wonderful compiled script with block names and comments intact smile.gif But when I then save, exit, start again, and decompile my aiscript/bwscript, comments and block names are gone. Can I avoid this in any way?

Best Regards,
Jørn Holm


 
Go to the top of the page +
poiuy_qwert    Canada
Jul 20 2008, 01:16 PM    Post #44
Heh, stupid mistake. Here is a manual fix till next update:
1) Open PyAI.pyw with a text editor
2) Goto line 2698
3) Remove the ", extra=False" part
4) Goto line 2704
5) Add ", extra=self.extrainfo.get()" before the )
So the are you are looking at is like this (lines 2698-2704):
CODE
                    self.tbl.compile(file, extra=True)
                except PyMSError, e:
                    ErrorDialog(self, e)
                    return
                self.tbledited = False
        try:
            self.ai.compile(ai, bw)

it should be like:
CODE
                    self.tbl.compile(file)
                except PyMSError, e:
                    ErrorDialog(self, e)
                    return
                self.tbledited = False
        try:
            self.ai.compile(ai, bw, extra=self.extrainfo.get())


First off, there is no way to save regular comments as of yet, only extra information comments, which can only be applied to headers or labels. If you need the regular comments you'll have to export the file somewhere. This will be changed in a later version (maybe next version). Also, if you want to save label names and extra information comments, you have to select the button on the toolbar that is a diskette with a +i on it. There are two of the buttons though, the first is in the main window, it saves them to the actual aiscript.bin file on compile. The second is in the Script Editor, which saves them when you compile code through it. So long story short, make sure both are pushed in.


 
Go to the top of the page +
Jørn Holm    Denmark
Jul 20 2008, 01:55 PM    Post #45
Sweet, thanks poiuy!

My block labels are also getting saved now. Maybe I forgot to save somewhere in the process before, because of the TBL errors, dunno, but the important part is that it works now smile.gif

Its an impressive amount of work you have done with PyMS.


 
Go to the top of the page +
poiuy_qwert    Canada
Jul 20 2008, 02:44 PM    Post #46
No problem, im glad to help. Thanks for the complements smile.gif

Also, I forgot to ask, why are you editing the TBL? In truth there should be no reason to use the TBL editor unless the ai script you are loading needs strings you are missing.


 
Go to the top of the page +
Jørn Holm    Denmark
Jul 20 2008, 02:57 PM    Post #47
I was just editing the TBL to name the scripts - is there a better way to do that?


 
Go to the top of the page +
poiuy_qwert    Canada
Jul 20 2008, 03:01 PM    Post #48
Well unless you are creating a mod with a custom StarEdit that people will create custom maps with your ai's in them, noone will really see the name. The only place the name is used for is in the trigger editor of StarEdit.

Edit: Also, if you still want to edit the names, make sure you edit the strings, dont add new ones to the end. If you do, some problems may come up when you distribute the aiscripts. I wont get into details, just letting you know.


 
Go to the top of the page +
Jørn Holm    Denmark
Jul 20 2008, 03:13 PM    Post #49
Noone except myself biggrin.gif
I'm less likely to mess with the wrong script if I keep them named in the editor. Otherwise I only have the script ID as unique identifier, and thats not very expressive when I have multiple scripts to keep track on smile.gif

Edit: It would be nice if you in the next version of the editor, added a column which displays the 'extra info' about the scripts.

Best Regards,
Jørn


 
Go to the top of the page +
poiuy_qwert    Canada
Jul 20 2008, 03:52 PM    Post #50
I was thinking about that just before I saw your edit tongue.gif There may be some problems with doing it but im pretty sure you'll see that in the next version.

Edit: Done.


 
Go to the top of the page +
bajadulce    Santa Cruz, California
Sep 8 2008, 09:50 PM    Post #51
here's another double-click open script obscure bug:

If you return to an open PYAI (v1.8) main window after running Starcraft, AND you've closed the script editor window, PYAI crashes if you try to open a script.

Process:
PYAI -- open aiscript -- double click a scipt -- close script editor.

run starcraft (maybe you're testing your latest script modifications) -- exit starcraft

return to open PYAI main window -- double click on any script in window = crash.


Also, there's no right-click menu in the editor. I think I might have mentioned that already? can't remember.


 
Go to the top of the page +
poiuy_qwert    Canada
Sep 9 2008, 10:22 AM    Post #52
Odd... There should be no conflicts between StarCraft and PyAI... It crashes without an error? I think it might be about time to make it output errors to a file as well as poping up just incase it fully crashes...

And yeah you mentioned the right-click thing, i guess i'll have to add my own.


 
Go to the top of the page +
bajadulce    Santa Cruz, California
Sep 9 2008, 10:30 AM    Post #53
This crash does have an error.. just run the steps to reproduce the crash.

I have been absent from this forum because I haven't been doing any modding. Now that I've started this latest BWAI Gold Project, I have experienced a few total crashes now as well, but haven't been able to recreate them. They appear to happen under similar circumstances. I.e a conflict with Starcraft. Those errors usually report an error with the .exe itself. Next time it happens I will take a screen shot as there is no way to cntrl-c or copy the error.

ADDED:
Logic/Flow error spotted:
With the way import list of files function works, there appears to be a loophole in the logic for subsequent edits. I discovered this when I reopened Entropy II to check some things out.

Now the aiscript.bin compiles properly the first time, but it appears that if it is reopened (such as to be modified at a later date), the key starting blocks get discarded with that "auto discard" function. In this case the "starting point" blocks. Rather than spend 2 pages of text trying to explain how this logic fails, I've created a simple sample below. A quick flowchart will reveal the faulty logic:

Here are the original scripts:
ZMCx(0, 000, aiscript):
start_town()
transports_off()
farms_notiming()
build(1, Zerg Drone, 150)
wait_buildstart(1, Zerg Drone)
build(1, Zerg Hatchery, 150)
wait_buildstart(1, Zerg Hatchery)
build(1, Zerg Overlord, 130)
wait_buildstart(1, Zerg Overlord)

goto(ZMC2:ZMC2_Start)

################# AND

ZMC2(0, 000, aiscript):

# here's something that I don't want the computer to do:
start_town()
give_money()
build(9, Zerg Drone, 1)

# here's what I want the computer to do:
--ZMC2_Start--
build(1, Zerg Spawning Pool, 80)

--loop--
wait(500)
goto(loop)
And here's how the "import a list of files" feature compiles them; which is fine and will work properly in game and there is no problem:
# stat_txt.tbl entry 0: Terran Marine<0>*<0>Ground Units<0>
ZMCx(0, 000, aiscript):
start_town()
transports_off()
farms_notiming()
build(1, Zerg Drone, 150)
wait_buildstart(1, Zerg Drone)
build(1, Zerg Hatchery, 150)
wait_buildstart(1, Zerg Hatchery)
build(1, Zerg Overlord, 130)
wait_buildstart(1, Zerg Overlord)
goto(ZMC2:ZMC2 0000)

AND ##################

# stat_txt.tbl entry 0: Terran Marine<0>*<0>Ground Units<0>
ZMC2(0, 000, aiscript):
start_town()
give_money()
build(9, Zerg Drone, 1)

--ZMC2 0000--
build(1, Zerg Spawning Pool, 80)

--ZMC2 0001--
wait(500)
goto(ZMC2 0001)
However the problem then occurs when these scripts are reopened to edit. (In the case of Entropy II 3 months later). Here is how the compiler then sees these which is bad:
# stat_txt.tbl entry 0: Terran Marine<0>*<0>Ground Units<0>
ZMCx(0, 000, aiscript):
start_town()
transports_off()
farms_notiming()
build(1, Zerg Drone, 150)
wait_buildstart(1, Zerg Drone)
build(1, Zerg Hatchery, 150)
wait_buildstart(1, Zerg Hatchery)
build(1, Zerg Overlord, 130)
wait_buildstart(1, Zerg Overlord)
goto(ZMC2:ZMC2 0000)

AND the Real problem ##########

# stat_txt.tbl entry 0: Terran Marine<0>*<0>Ground Units<0>
ZMC2(0, 000, aiscript):
start_town()
give_money()
build(9, Zerg Drone, 1)
build(1, Zerg Spawning Pool, 80)

--ZMC2 0000--
wait(500)
goto(ZMC2 0000)


 
Go to the top of the page +
poiuy_qwert    Canada
Sep 9 2008, 01:31 PM    Post #54
Wow that is a really weird error :S (was at school earlier and couldn't check). I might know what is causing the problem, but it looks like it might be a problem in the GUI toolkit itself.

Ok, i'll look into it (actually might have to do with the other script opening error I just fixed).


 
Go to the top of the page +
bajadulce    Santa Cruz, California
Sep 9 2008, 02:21 PM    Post #55
As long as the users keep their original files and only import them as a list of files then it's not a problem. Editing the aiscript.bin directly however will result in errors.

Just a quick heads up:
The ASC3 --> to PYAI button is a great little tool and it works great btw, love it! However in order for the compiler to use these, one must use the SCAI External Unit Definitions. Make sure your eventual help file/example demonstration explains this. It seems really obvious, but took me a good minute to see that it was different.


 
Go to the top of the page +
poiuy_qwert    Canada
Sep 9 2008, 02:41 PM    Post #56
The problem is actually just a limitation on decompiling. The reason you get that is that the label is only used in an external script. You are trying to edit the ZMC2 script by itself, you'll have to select both scripts in the main window, then hit the Script Edit toolbar button (or use Ctrl+E) to edit them both at the same time. The reason this happens is that there is currently no way to tell that the ZMCx script is externally jumping to it, so it doesn't know the first jump is even there. I'll see if i can change that for the next version, im pretty sure i know how to do it.

Good point, i'll remember that. I might also make the asc3 to PyAI converter accept a unitdef.ini at the top of the script and it will be converted too, though that would take extra work for the user, having to manually open the unitdef.ini and copying it into the script editor. Any better ideas? Maybe i should just make it so when you click on the asc3 to PyAI button it prompts for the asc3 and unitdef.ini files instead of using whats in the script editor?


 
Go to the top of the page +
bajadulce    Santa Cruz, California
Sep 9 2008, 03:01 PM    Post #57
QUOTE(poiuy_qwert @ Sep 9 2008, 02:41 PM) *
select both scripts in the main window, then hit the Script Edit toolbar button (or use Ctrl+E) to edit them both at the same time.
Ok beautiful. Works great. Now all of these instructions/notes should be included in our wiki! I don't see a PYAI tutorial there yet tho. sad.gif

actually nothing much is there.


 
Go to the top of the page +
poiuy_qwert    Canada
Sep 9 2008, 03:12 PM    Post #58
Yeah, when I have time i'll be able to put stuff up on the wiki. Not only will it have info for users but i'll also put up info for developers so people can write their own programs with the PyAI libs (like that DAT editing thing I made for you). Don't worry, it takes time to get a wiki going, but it'll happen.


 
Go to the top of the page +
bajadulce    Santa Cruz, California
Sep 19 2008, 08:31 AM    Post #59
I used the new ASC3-> PYAI converter to import an old script, but then spent a good hour trying to figure out why the script wouldn't train any lurkers? Turns out the unitdef.txt included with PyMS is in error:

military lurker = 13

I'd fix that asap. If I find another, I'll report, but you should double check to be sure all the other id's are correct as well.


 
Go to the top of the page +
poiuy_qwert    Canada
Sep 19 2008, 10:16 AM    Post #60
ohmy.gif Will be updated asap. Thanks!


 
Go to the top of the page +

7 Pages V  < 1 2 3 4 5 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 7th September 2010 - 07:05 PM