Hello,
is there a algorithm / rule which determines which script is executed first and when the other?
Right now I have a use case where script B shall only be executed when a condition is met in script A. It looks like that works when I'm accessing a status variable of script A at the very beginning of script B to check if the rest of B shall be executed.
However, that it works here doesn't mean that is works for other players.
So, is the execution order predictable? Maybe they are executed by name or by object type they are attached to. I remember that I read that all addons content is merged with the game data...
Thanks in advance!
[answered] What is the execution order of scripts?
[answered] What is the execution order of scripts?
Last edited by asmo on 14 Sep 2015, 17:51, edited 2 times in total.
Re: What is the execution order of scripts?
Within a frame local scripts are executed first, then the global scripts. There is no other guaranteed order beyond that. What ever order you are seeing beyond that may change at any time and you certainly should not write scripts that depend on it.
Re: What is the execution order of scripts?
I see - then this has to be arranged by accessing status variables of the other script.Zini wrote:Within a frame local scripts are executed first, then the global scripts. There is no other guaranteed order beyond that. What ever order you are seeing beyond that may change at any time and you certainly should not write scripts that depend on it.
Thanks
Re: [answered] What is the execution order of scripts?
I hope there's not piles of mods that depend on some arbitrary sorting vanilla did ;_;
Re: [answered] What is the execution order of scripts?
I'd like to know this as well:
script A containsIs B executed in the same frame where A came across that command or only in the next one?
Respectively script A containsand my_NPC has a script B. Is B executed in the same frame where my_NPC is placed or only in the next one?
Is both unpredictable or may the implementation change?
script A contains
Code: Select all
startscript B
Respectively script A contains
Code: Select all
PlaceAtPC my_NPC
Is both unpredictable or may the implementation change?
Re: [answered] What is the execution order of scripts?
Could be either way. You can not rely on a specific behaviour here.Is B executed in the same frame where A came across that command or only in the next one?
Same.and my_NPC has a script B. Is B executed in the same frame where my_NPC is placed or only in the next one?