• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Max Script Length...

GodPole

Well-known member
Greetings all...me again.

Still working on this monster of a script and I have run into a new snag...
Apparently, there is a limit to how long a given EvalScript can be, and mine has breached that limit.

So...I have no problem breaking my script up into multiple scripts, however, this introduces two questions:

1) Do I have a way of halting all script processing completely? I know that "done" or "doneif" will kick me out of the current script, however, is there any way to prevent all scripts in subsequent phases, priority, or indexes from processing as well?

2) Do variable persist from script to script? If I declare the variable "value" as a number in a script and assign it the value "3", in a subsequent script that is run with a priority n+1, can I access the "value" variable and will it maintain the value of "3"?

Thanks in advance.

-GP
 
1) Likely not the best option, but an option would be to add a tag to the Hero indicating processing was aborted. Check for the tag in all appropriate scripts and bail out if its there.

2) Pretty sure that's a no -- I imagine variables are locally scoped, meaning that once you leave the script the memory space that variable consumed is released.
 
I guess here is my situation:

I'm trying to run a script that is checking for a LOT of possible combinations of things. When it encounters the right combination, I want the script to stop.
This is easily done with an embedded "done" statement in each conditional.
However, my script is way longer than the max length for one eval script, so in order to break it up into multiple scripts, I need a later script to know that the condition has been satisfied in the previous script and to stop processing.

Perhaps I can use a custom tag?

How can I create and assign a tag that can then be looked at by a later script and used to kill the script once the condition has been satisfied?

-GP
 
How can I create and assign a tag that can then be looked at by a later script and used to kill the script once the condition has been satisfied?
On just about any Thing in the editor their is a section for User Tags. Click that and take the first option - New Tag - and press OK.

In the new window Tag Unique ID is what you will use in your scripts so make it meaningful. Name and Abbreviation is just helpful text. Press OK and do a Test NOW! to have it compile and create your new tag. So your new tag will be Custom.XXXXXX where XXXXX is what you entered.

Some example scripts you can do with tags:
Code:
~ Pull ALL custom tags on current Thing and push them to the 
~ raBreath Thing.
perform pulltags[Custom.?]
perform master.child[raBreath].pushtags[Custom.?]

~Here are full tag is Custom.Shadow1 and Custom.Shadow2
~ So this pulls both tags and pushes both tags to the raBreath Thing.
perform pulltags[Custom.Shadow?]
perform master.child[raBreath].pushtags[Custom.Shadow?]

~ Assign a specific tag
perform eachpick.assign[Custom.Shadow1]

~ delete a specific tag
perform eachpick.delete[Custom.Shadow1]

~ delete all Custom tags
perform eachpick.delete[Custom.?]

Hope that helps.
 
If you're writing a script that exceeds the maximum length, I have to question whether you're going about your solution the best way. We don't run into the maximum script length problem on our end, and we've written some highly complex scripts for various game systems. So it's quite possible that there's a better way to solve the problem you're striving to tackle.

Please outline exactly what you're trying to achieve. Also give us examples of the how the script has become so complex. Perhaps we can see a different approach that will be easier to implement.

If we can't help out with a better solution, the important detail that ShadowChemosh omitted from his excellent summary is that you should assign your custom tag to the hero. If you assign your tag to the hero, all subsequently executed scripts will be able to readily test for the tag via a "doneif" statement at the start of the script and bail out as appropriate.
 
@rob

I agree with you 100%. However, I have been wrestling with this for a couple of weeks now and this is the only way I have found to get this to work.
What is "this"?? The "Advanced Learning" class feature of the Warmage class from the Complete Arcane sourcebook:
"At 3rd, 6th, 11th, and 16th level, a warmage can add a new spell to his list, representing the result of personal study and experimentation. The spell must be a wizard spell of the evocation school, and of a level no higher than that of the highest-level spell the warmage already knows. Once a new spell is selected, it is forever added to that warmage’s spell list and can be cast just like any other spell on the warmage’s list."

I am using the Secondary Spells functionality to apply this and using my script to manipulate cSecMax based on what they have already chosen (cSecCur).
So, for example, at 3rd lvl, the Warmage gets to choose ONE first lvl spell to add to their list...easy peasy.
At 6th level, the get to add ONE additional spell, but it can be a 1st, 2nd, or 3rd lvl spell. So, the possible combinations they could have at sixth level once they've chosen their Advanced Learning spell are two 1st lvl spells, one 1st and one 2nd, or one 1st and one 3rd lvl spell (3 permutations).
At 11th level, the number of permutations goes up to 11.

I'm handling these permutations via nested conditionals that check what choices they have already made (cSecCur) and once they meet one of the possible combinations, it removes their ability to choose anything else by setting cSecMax for the other spell levels back to zero:

if (level < 16) then
hero.child[cHelpWRM].field[cSecMax].arrayvalue[1] = 3
hero.child[cHelpWRM].field[cSecMax].arrayvalue[2] = 2
hero.child[cHelpWRM].field[cSecMax].arrayvalue[3] = 1
hero.child[cHelpWRM].field[cSecMax].arrayvalue[4] = 1
hero.child[cHelpWRM].field[cSecMax].arrayvalue[5] = 1​

if (cur1 = 3) then​
hero.child[cHelpWRM].field[cSecMax].arrayvalue[1] = 3
hero.child[cHelpWRM].field[cSecMax].arrayvalue[2] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[3] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[4] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[5] = 0​
endif​


if (cur1 = 2) then
if (cur2 = 1) then​
hero.child[cHelpWRM].field[cSecMax].arrayvalue[1] = 2
hero.child[cHelpWRM].field[cSecMax].arrayvalue[2] = 1
hero.child[cHelpWRM].field[cSecMax].arrayvalue[3] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[4] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[5] = 0​
endif
endif
if (cur1 = 2) then
if (cur3 = 1) then​
hero.child[cHelpWRM].field[cSecMax].arrayvalue[1] = 2
hero.child[cHelpWRM].field[cSecMax].arrayvalue[2] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[3] = 1
hero.child[cHelpWRM].field[cSecMax].arrayvalue[4] = 0
hero.child[cHelpWRM].field[cSecMax].arrayvalue[5] = 0​
endif
endif​

Now, up to 11th level, everything fits in one script and works PERFECTLY.
It is when I get up to the possible permutations for 16th level that I run into size issues for there are 63 possible combinations that I have to check for.
Now, I have already done all the scripting. I just need to find a way to fit it into the EvalScript sections. I know I can break up the script into 3 parts, but my problem is that at the beginning of each script, I am resetting the cSecMax fields to their new values based on their new level and I don't want those values reset by part-2 of the script if the condition was met in part-1. That is why I was asking about variable persistence or the ability to prevent future scripts from running.

If you or anyone knows of a better (and simpler) way to do this, I would greatly appreciate it.

Thanks.

-GP
 
Last edited:
I think we'd need more info on what rule you're implementing. I have no idea, based on the code above, what it is that is being done. All I can tell is five values inside an array are set based on some conditions.

It's also hard to piece this together without indentation. It looks like you're checking if cur1 = 2 back to back; I'm pretty sure that could be removed and save you two lines. I also suspect you could condense the array index assignment -- e.g. if cur1 = 2, value 4 and 5 are 0, regardless of cur3 or cur2.
 
Last edited:
I'm not sure what you mean by "rule".

I am trying to create the Warmage class from Complete Arcane.
He has a class feature called Advanced Learning which, at certain levels, allows him to add a new Wiz/evoc spell to his list. This is exactly like a Secondary Spell, but it doesn't allow him to add one every level; only at 3rd, 6th, 11th, and 16th. So I am trying to manipulate the Secondary Spells arrays, cSecMax and cSecCur, via an eval script.

To save space, I initialized all of the 8 cSecCur values as variables "cur1...cur8"...that's what the cur1, cur2, cur3, etc. variables are. It was a lot easier than writing "hero.child[cHelpWRM].field[cSecCur].arrayvalue[#]" over and over again.

For the record, the script works perfectly....it's just the section supporting 16th level is too big to fit into ONE Eval Script window.
I'm trying to find a way to either have one script access a value (variable, tag, etc...) set by another script. (If script 1 was successful, then don't run script 2...something like that).

Does that answer your question?
 
@ShadowChemosh

Yes, it helps greatly.

So, I have created a custom tag called AdvLrn4.

But, if my understanding of tags is correct, a tag either exists or it doesn't exist; you can't assign a value to it like a variable.

Assuming that is correct, I need each script to check for the EXISTENCE of that tag and when a script "succeeds" it needs to ADD that tag??

Am I getting close?

-GP
 
I suspect the Warmage is implemented in Lawful_G's stuff for d20. It's not going to work as is for the Pathfinder system, but you could download his packages and see how he tackled this problem for d20.
 
I'm sorry, but not to sound argumentative...it is working.
The script does exactly what it is supposed to do.
My only problem is the size limitation on the EvalScript window.

-GP
 
SUCCESS!
(I think...)

So, the suggestion about using tags did the trick.
I assign the tag when a conditional is successful and check for it in subsequent scripts...if it is found, (doneif (hero.tagis[Custom.AdvLrn4] <> 0) ) then it does not process the script.

I tested it for all 4 occurrences of Advanced Learning and it seems to work perfectly.

I have attached it in the hopes that you wise sages can take a look at it and tell me if I am being overly optimistic.

Thanks for all the help from everyone.

-GP
 

Attachments

Back
Top