Replies: 56 comments
-
Так же добавить функцию позволяющей задать приоритет выполнения hook обработчика для register_hook_proc функции относительно других обработчиков, при этом register_hook должен всегда иметь наивысший приориет, но не выше чем у hs_ скрипта.. |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
Oh, I thought hs_ always has higher priority than global script. |
Beta Was this translation helpful? Give feedback.
-
Сейчас выполняется все в обратном порядке (метод LIFO), т.е первый добавленный обработчик выполняется последним, ( самым первым добавляемым скриптом является hs_ скрипты.) Тогда получается, что обработчик в hs_ скрипте является последним головным обработчиком куда стекаются все изменения произведенные в gl обработчиках, в принципе это логично сделано, и тогда менять ничего не нужно. !!! Но сейчас имеется не разрешаемый конфликт скриптов hs_barterprice из ECCO и gl_ обработчика в скрипте фильтра. Т.е. при такой конфигурации скрипт из Ecco должен всегда выполняться первым, а затем уже обработчики из gl скриптов. |
Beta Was this translation helpful? Give feedback.
-
yes, that’s what it was intended to be. |
Beta Was this translation helpful? Give feedback.
-
Хм. Тогда получается, что нужна дополнительная функция позволяющаяя зарегистрировать скрипт после hs_ скриптом, (т.е. в программном смысле поместить скрипт в начало вектора).
|
Beta Was this translation helpful? Give feedback.
-
Нужно ли изменять поведение для
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure what's the current order of execution for the same hook. Is it: The global scripts themselves are executed by filename order, at least for two global scripts |
Beta Was this translation helpful? Give feedback.
-
The execution order of the |
Beta Was this translation helpful? Give feedback.
-
Gl_01 - register_hook_proc |
Beta Was this translation helpful? Give feedback.
-
Uh, now my head hurts... Let's see if I understand the example correctly:
Then it registers
Since the chain itself follows LIFO (stack) principle, when HOOK_BLAH is triggered, sfall runs:
EDIT: OK, I made four test scripts like the example. The current order of execution in game is: |
Beta Was this translation helpful? Give feedback.
-
Changes to the start of scripts will not be affected.
We get it as you wrote.
|
Beta Was this translation helpful? Give feedback.
-
Do you mean you got a different result in the current build (my test scripts should be the same as your example right?), or you're proposing to change the order like in your example above? |
Beta Was this translation helpful? Give feedback.
-
It is how I suggest changing. Current: |
Beta Was this translation helpful? Give feedback.
-
But then if don't make many changes in the sfall code for register_hook, the principle will change from LIFO to FIFO
So I think it's worth changing it. |
Beta Was this translation helpful? Give feedback.
-
It doesn't work if converting EcCo's hs_barterprice to some gl_z_eccobarter to make it run after your inven filter? |
Beta Was this translation helpful? Give feedback.
-
И что?, появится другой скрипт который зарегистрируется после. Я же написал что нужна некая гарантия (пусть даже псевдо), того что скрипт будет выполняться последним. And what?, another script will appear that will register after. I wrote that we need some kind of guarantee (even it’s pseudo) that the script will be executed last. |
Beta Was this translation helpful? Give feedback.
-
no. |
Beta Was this translation helpful? Give feedback.
-
IMO your BTW, why it's called _spec not something like _last? _spec for special? |
Beta Was this translation helpful? Give feedback.
-
A new register_hook option is needed to reduce one “big race” based on file names. |
Beta Was this translation helpful? Give feedback.
-
yes, for exceptional situations, I think "spec" hints at it. |
Beta Was this translation helpful? Give feedback.
-
But in reality you have already increase the number of races from one (filenames only) to three (filenames for each register_hook* functions). If you keep old behavior for register_hook, at least there will be only two races (new register_hook_proc_spec and old register_hook* functions). And your goal was to need some hook to "run last", which is done by the new register_hook_spec, why not just keep other old ones in their default behavior? I think that's a good compromise for keeping compatibility (existing scripts still work in exactly the same order) while solving your problem (new script with register_hook_proc_spec runs last to avoid certain issues). For gl_001~004 + hs_* script, before the execution chain was:
The only race (or order sorting) was depend on the filenames of gl_001~004. With your commit it becomes:
Each register_hook* function has its own sorting to deal with, like the weight class in boxing.
From my POV
For abbreviation like "spec" itself my first impression is "specification" not "special". |
Beta Was this translation helpful? Give feedback.
-
I do not see a problem with the new register_hook, show me scripts that depend on the position of the register_hook script, are there any? With the new register_hook, we can change the position regardless of the script name, this will give the outdated little-used function new features. Can make the new option of enable a new registration behavior for register_hook if you are so worried about compatibility? |
Beta Was this translation helpful? Give feedback.
-
It's not true,
Sure. But I can say the same thing that not seeing any reason changing existing register_hook/_proc, since you already got what you want with register_hook_proc_spec. And for me |
Beta Was this translation helpful? Give feedback.
-
The documentation says it's preferable to use register_hook_proc. |
Beta Was this translation helpful? Give feedback.
-
OK. I'm still curious if converting EcCo's hs_barterprice to gl_ script and renaming it to run after your inven filter script fixes your issue. (didn't see you answer this) |
Beta Was this translation helpful? Give feedback.
-
yes, this solves the problem + adding function set_sfall_arg() to it |
Beta Was this translation helpful? Give feedback.
-
I keep saying that and there's no response.
And that too. |
Beta Was this translation helpful? Give feedback.
-
Давно уже написал, что конфликт в очередности выполнения. |
Beta Was this translation helpful? Give feedback.
-
Не знаю как кому-то еще, но мне это ни о чем не говорит. Конкретно-то в чем проблема? Может быть можно переделать, чтобы конфликта не было? |
Beta Was this translation helpful? Give feedback.
-
Изменить порядок выполнения для hs скриптов, так чтобы они выполнялись перед подписанными обработчиками в gl скриптах.
Beta Was this translation helpful? Give feedback.
All reactions