Jump to content

IE Recognition of GLOBAL or LOCALS being set


erebusant

Recommended Posts

Is there a specific time involved where difference in processor speed can effect the structure of your scripts? Reason I'm asking is because I've been running into an intermittent issue with David W's dw#hp spell firing twice upon joining an NPC (Alora specifically this time) to where she joins and has 20 HP, you level her up to where she has 26 HP, then the rest of the script continues and it recognizes player1 has greater than 32000 XP so the block fires that sets DMWWLevelUp, LOCALS to 1, along with restoring her to full health and ApplySpellRes dw#hp to remove the equivalent of Max HP (20) from Alora leaving her with 6, however 5 script blocks on down the line the same ApplySpellRes dw#hp fires again and brings Alora down to -14 HP. This always occurs until I add an XPLT check for player1 in that block's triggers even though the triggers for that block has a DMWWLevelUp,LOCALS check, so it appears that it still has not recognized the setting of the LOCAL at that point in time. Hope that made sense....

Link to comment

Without seeing the particular script in question, I can only take a guess. Based on my own script work recently (albeit for IWD+HOW+TOTM), I can say the following things about the setting of GLOBAL and LOCALS variables.

 

First we have to recognize how the script gets executed.

 

Script execution is as follows: Actor does the first block that is all true and then starts over from the top UNLESS there is a Continue() within that block's actions. In which case, the Actor goes through the rest of the script looking for the next block that is true and executes it.

 

So if you set a variable whether it be GLOBAL or LOCALS, it does not get recognized until the script gets started over. This is fine for blocks that do not have a Continue(). For blocks that do have the Continue() their variable will not get set until after the next block that is true gets executed UNLESS that second block also has a Continue(). It then keeps going through the script until it either finds another true block or reaches the end of the script. If it is a large script and many blocks could be true and they all have a continue, it can take a while before the variable is actually set.

 

I think this may be the case for what you have described. By putting in an extra check to make sure that the "work" was done as well as that the variable was set, you kept the script from running a block which was otherwise considered true because the variable had not been updated.

 

I hope this is as clear as mud...

And if anyone has anything to add or correct please feel free to do so...

Link to comment

So the simple answer is... not until the script is completed, and rerun.

 

As the whole script first gets read, then the all the true options at the time are executed, and then all the script blogs write their conclutions. And then it runs again...

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...