News:

Happy 20th, FFvT3R!

Main Menu

A question about ffx.py

Started by spydermann93, December 17, 2013, 06:18:46 AM

Previous topic - Next topic

spydermann93

Hello,

I am wondering if there is any limit to the number of custom attributes (or even the amount of lines that is considered to be the "max" for the file) that one could add to the ffx.py file.

The reason for my asking is that once I add attributes beyond a certain number, FFX3.3 does not work anymore; the scripts just won't function.  I know that it isn't the syntax of the code as I tried adding attributes that do work and I get the same result.

hoss20

I believe there is a limit. I know when I was adding a number of my own combo attributes in ffxmulti.py, I kept getting a script error. After determining that I may have had too many attributes, I removed some of the ones I knew I wouldn't be using (both from ffxmulti.py and in FFEdit) and everything worked fine. Hopefully, one of our more knowledgeable FFX/scripting/game parameter type members can chime in to give the definitive answer.

stumpy

There is a limit to the file size. I don't know the exact size, but the version of python used in FF (and FFvT3R - they are the same) runs up against a limit and we found that out when adding things to FFX3 for the last couple releases. I believe that is (part of) the reason there are files like ffx2.py in the package. We moved a bunch of FFX attributes and related code to that module to keep things under the limit.

For new attributes, the fix is relatively simple, in concept. Put the code for the new attribute in another python module and import that module into FFX. In practice, some care is needed in the process to make sure namespace errors don't crop up.

The best process is to clear enough space from ffx.py that you can prototype and test new attributes there. That's the easiest place to test new functions. When the new attributes are debugged and working right, move them into their own modules and then import them into ffx.py. Moving them into their own modules is the part that requires some care (and thoroughness) with the namespaces. It isn't hard, but it can be tedious and it is an error-prone process.

I wrote a bit of python code that automates this process of converting an attribute from an internal FFX attribute to one that has its own module that is then imported into FFX. It was intended for use by the FFX team, most of whom know the innards of FFX pretty well. However, it is probably usable by anyone who knows enough to write a proper FFX attribute. Here is a link to an archive with that converter code and some instructions on how to use it.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

spydermann93

Quote from: stumpy on December 18, 2013, 07:14:44 AM
There is a limit to the file size. I don't know the exact size, but the version of python used in FF (and FFvT3R - they are the same) runs up against a limit and we found that out when adding things to FFX3 for the last couple releases. I believe that is (part of) the reason there are files like ffx2.py in the package. We moved a bunch of FFX attributes and related code to that module to keep things under the limit.

For new attributes, the fix is relatively simple, in concept. Put the code for the new attribute in another python module and import that module into FFX. In practice, some care is needed in the process to make sure namespace errors don't crop up.

The best process is to clear enough space from ffx.py that you can prototype and test new attributes there. That's the easiest place to test new functions. When the new attributes are debugged and working right, move them into their own modules and then import them into ffx.py. Moving them into their own modules is the part that requires some care (and thoroughness) with the namespaces. It isn't hard, but it can be tedious and it is an error-prone process.

I wrote a bit of python code that automates this process of converting an attribute from an internal FFX attribute to one that has its own module that is then imported into FFX. It was intended for use by the FFX team, most of whom know the innards of FFX pretty well. However, it is probably usable by anyone who knows enough to write a proper FFX attribute. Here is a link to an archive with that converter code and some instructions on how to use it.

Cool, I'll have to look at this.

Thanks for the help, you guys! If I can't figure something out, I'll be back with more questions. :P