Senior Member
Join Date: Jul 2019
Posts: 142
|
What is the difference between Phase and Priority?
I'm trying to get an ability to work, and it's just not working, despite the fact that I *think* the code is right. I started thinking that because I'm trying to add an ability that scales with level, it needs to be in a Phase that takes place *after* levels are calculated. So I switched it to "Post-Levels". But I'm not sure what the *Priority* should be. Does Priority even make a difference? |
#1 |
Senior Member
Join Date: May 2015
Posts: 830
|
Imagine the compile process as a line, each phase is a segment, anything in that segment gets completed before the start of the next. Timing gives a location within a segment. Finally Priority is used when multiple things happen at the same phase/timing and order matters. Lets say your thing creates a variable in an eval-script at Post-level/10000/1 now you need a second eval-script to modify it. (You could probably lump everything together but breaking it up makes it easier to follow) so you would set it to Post-level/10000/2 and it is now guaranteed to run after script.
I used the Phase/Timing/Priority notation above, |
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Minous - I'm not sure what you mean by "Timing". If you mean "Index", that is only an identifier - it's used so that when reporting script errors, HL can tell you it's in script #1 vs. script #2 on this particular pick, and has nothing to do with the order things are run in.
Two different scripts that are both set to the same phase and priority will be assigned to be first and second according to some internal rules that are not easy to analyze or discover. You should not count on the order you observe them running in on a particular character at a particular time staying the same if a different user used that same combination on a different character. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
But other than that, Minous is correct - the phase & priority combination is how you decide that this script happens before that script, so that you can look up the results of one script before running the other.
|
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
My rule of thumb for priority selection is to default to 10000. I try my best not to use priorities that are not a multiple of 1000, unless there's a specific pair of other scripts I'm trying to get in-between, which forces me to pick a priority number that's between two other numbers, like a script that needs to operate between other scripts at Post-Levels/9000 and Post-Levels/10000.
|
#5 |
Senior Member
Lone Wolf Staff
Join Date: Apr 2020
Posts: 406
|
Also of note, if you're not able to group multiple scripts together in the same Priority for some reason (which is better for running them), it's generally better to have them run at different Priorities, rather than just a different Index. This allows other scripts to be run between them as needed to modify parts. Probably not really applicable to anything you're doing, but a good habit none the less.
|
#6 |
Thread Tools | |
Display Modes | |
|
|