PyAI

Help - Resources - Discussion
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Thu Dec 25, 2008 8:36 pm

Sure thing, I will PM a full script to you containing an instance of this.
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am

Postby poiuy_qwert » Fri Dec 26, 2008 4:39 am

Ok i see what you are talking about, yeah ESYT 0028 loop does get passed my warnings, i'll see if I can come up with a way to catch that for the next version. Thanks!

Also, the part about ESYT 0000 not being referenced is because; its not referenced. You are trying to compile the script on its own, and ANOTHER script is the only thing that references that label (an external jump). To get it to work correctly you need to compile both scripts at the same time.
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Fri Dec 26, 2008 10:38 am

You're very welcome!

Yes, I realize ESYT 0000 is not referenced in that example and the reference comes from an external file which wasn't compiled with it, but I was wondering if the error report was legitimate. As I explained in the PM I wasn't sure if the AI script continues reading off the starting block down into the script, of if it *requires* a GOTO or MULTIRUN label to get to any of the labels.

So what I was asking is, if the AI continues reading down the script from label to label with no stop() command in its way, then isn't 0000 actually used even if it isn't referenced?
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am

Postby poiuy_qwert » Fri Dec 26, 2008 9:52 pm

Yes thats true, but the Label is unused and removed, not the code. When you compile the script, if nothing references ESYT 0000 there is no way to tell that it was there when decompiling, so it warns you that it is being removed. It will go from

Code: Select all

ESYT(0, 000, aiscript):
start_town()
--ESYT 0000--
...

to

Code: Select all

ESYT(0, 000, aiscript):
start_town()
...

I think you're getting confused between:

Code: Select all

The label '__' in AI script '____' is unused, label is discarded

and

Code: Select all

This command and everything up to the next script or block will never be run
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Fri Dec 26, 2008 10:25 pm

Oh, I see - no, I incorrectly assumed if another part of the script could flow into a label freely, it wouldn't count the label as unused, and thus if PyAI said a label was unused it would actually remove the entire section within that label since it was neither referenced nor flowed into.

I assumed this because even if the label isn't actually used, the developer might be using it to help identify certain sections of the code so it's easier to manage, and they might not want it removed on import so that it's intact later if they have to export it and lost their source code. It's fine like this though, now that I'm clear on what exactly is being removed. My bad!
Scourge_Splitter
Posts: 36
Joined: Fri May 11, 2007 12:56 pm

Postby Scourge_Splitter » Thu Jan 29, 2009 9:04 am

Uhm small question.

I used SCAIedit (obviously) but with a modified unitdef.ini file.
I just opened up my aiscript in PYAI to see what is what.
but without the right unitdef I have a strong feeling things won't work out.

does PYAI need this unitdef.ini somewhere?
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am

Postby poiuy_qwert » Thu Jan 29, 2009 11:08 am

Glad to see another new user :)

First of all, there is an unfortunate bug in the current released version of PyAI, its already fixed for the next release, but until that goes public you must go here to download the patch.

For the unitdef.ini, PyAI doesn't NEED the unitdef, you can load your mods TBL file (button with icon that has a file with TBL on it, or Ctrl+T) and use the unit names straight from there. If you want to use the names you used from your SCAIEdit unitdef.ini, then you can either create a custom TBL with your units names replaced with the ones from the unitdef.ini, or you can make a PyAI compatible unitdef by copying the format of unitdef.txt which came with PyMS. PyAI is not limited to one unitdef file, you just got to make sure to load your unitdef into the External Definitions manager (button with icon that has a file with X=Y on it, or Ctrl+X). If you need some help converting it you can post up your unitdef.ini and I will convert it to PyAI format for you.

Also, since you are changing a script from SCAIEdit to PyAI, you will want to use the "Compile SCAIEdit to PyAI" feature in the Script Editor to ensure all of your block names are saved (you don't want to have to deal with funky "PMCx 0001" names for your blocks). Open your aiscript.bin in both PyAI and SCAIEdit, then open the script (or scripts) you want to transfer in SCAIEdit, and open the Script Editor in PyAI (Ctrl+E). Paste the code from SCAIEdit into the Script Editor then hit the "Compile SCAIEdit to PyAI" button (File with gears icon on the right of the toolbar, or Ctrl+Alt+P), then you can save the script to your hard drive in the PyAI format.

If you have any questions dont hesitate to ask!
User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm

Postby Archon_Wing » Thu Jan 29, 2009 9:40 pm

Edit: Nvm :o
Scourge_Splitter
Posts: 36
Joined: Fri May 11, 2007 12:56 pm

Postby Scourge_Splitter » Fri Jan 30, 2009 11:04 pm

allright thanks, i'll try that out.
but I do have a question (not sure wether it has been said and dealt with btw)

I loaded my ai just plainly into PYAI I saw it took the names of the original unit so that indeed is not a problem, but because PYAI should be better at bug ckecking created ai's I thought, hell let's try and see wether SCAIedit can't find something PYAI can.

so I hit the check button (v) thingy.

then I got this message:
Image
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am

Postby poiuy_qwert » Sat Jan 31, 2009 12:49 am

[quote name='poiuy_qwert' post='5838' date='Jan 29 2009, 06:08 AM']First of all, there is an unfortunate bug in the current released version of PyAI, its already fixed for the next release, but until that goes public you must go here to download the patch.[/quote]

Return to “PyMS (poiuy_qwert's complete modding suite)”

Who is online

Users browsing this forum: No registered users and 1 guest