Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Evaluation Timing Confusion (http://forums.wolflair.com/showthread.php?t=64890)

eastsydneyboy October 9th, 2020 06:10 PM

Evaluation Timing Confusion
 
I'm trying to resolve exactly how the timing of evaluated code is determined, as there appear to be multiple, potentially conflicting, definitions.

For example, if we have an <eval> tag within a <field>, then the timing of the execution of this code is determined by the "phase" and "priority" tags on the <eval> tag. So, within a given phase, all code fragments with the same priority are executed one after the other.

Now, I see that the tags <before> and <after> are also allowed, which define other code fragments that must be executed "before" or "after" this fragment.

My confusion comes from the fact that these two systems are potentially ambiguous, as the <before> and <after> tags do not consider the "phase" that the code is executing under. For example, I can't possibly execute a code fragment "before" this one if the code is defined to be executed in a phase after the current phase. Similarly, if the phase is the same, but the priority values are in conflict, what happens?

So what's the actually definition of these <before> and <after> tags. Do they only apply to code fragments within the same phase/priority group? Do the tags just get ignored otherwise?

Also, what happens for <eval> (and other tags) that don't have a "phase" and/or "priority" defined? Is there a default value for these fields?

Thanks for your help...

Mathias October 14th, 2020 08:26 AM

The before and after are tools to help you pick the right phase and priority for a script, and to keep track of which scripts depend on values generated by other scripts. If you've set a reminder that X must come before this, and then you change the phase and priority of X so that it's now after the script with the before, HL will notify you of that at compile time - helps you keep track of your dependencies when you've got hundreds of them, and really helps when you end up with a dependency chain that's 3 or 4 items long, and you find you need to modify the timing of the second one in the chain, because a new script needs to be inserted in the middle of the chain.

The default phase and priority varies by game (it's set in definition.def), but it's usually ultra-early, like it's First/100 in PF1 and d20 and First/1000 in Shadowrun. I consider it very bad practice to ever make use of those defaults, though - it causes so many problems with scripts depending on the results of other scripts to have a group of scripts bunched up at the same phase/priority - it makes it a real hassle to de-tangle timing dependencies once you end up adding something else that has to make use of the results of one of those scripts, and another thing that is needed by that same script.


All times are GMT -8. The time now is 06:21 PM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.