- Joined
- Jan 3, 2022
- Messages
- 364
Hello, I'm back with another WC3 scripting insight that has cost me more time than I'm willing to admit... Timer and Trigger frequencies.
What's the minimum interval of a Timer? "0.0" definitely works for a "fastest possible" setting.
What's the minimum interval of a Periodic Trigger? The famous... it depends!
WorldEdit let's you set both to 0.00 in GUI triggers but their speed was changed in a 1.32.x patch. Periodic triggers can only run at 0.010 (every 10ms) now in Reforged. This shouldn't have any effect on most maps, because in WE you could either set 0.01s or 0.00s. I don't think there're many maps that really relied on the 0.0s triggers. However, timers were not changed in Reforged. Here's a table:
In other words, you cannot have a regular Periodic trigger <10ms with new patches. If you need one, you must use timers to execute it at low timeouts.
The table below describes frequences in the screenshot:
1.32.10 Reforged: 100ms trigger periodic.
Test map below, the map script was injected with MPQEditor, don't try to open the map in WE or the code will be lost! The v1.0 WE wouldn't let me save at all, even with default melee triggers. If the map doesn't show in old Warcraft, rename it to have a shorter name.
PS: TriggerRegisterTimerEvent is used by as TriggerRegisterTimerEventPeriodic, TriggerRegisterTimerEventSingle, PostTriggerExecuteBJ.
What's the minimum interval of a Timer? "0.0" definitely works for a "fastest possible" setting.
What's the minimum interval of a Periodic Trigger? The famous... it depends!
WorldEdit let's you set both to 0.00 in GUI triggers but their speed was changed in a 1.32.x patch. Periodic triggers can only run at 0.010 (every 10ms) now in Reforged. This shouldn't have any effect on most maps, because in WE you could either set 0.01s or 0.00s. I don't think there're many maps that really relied on the 0.0s triggers. However, timers were not changed in Reforged. Here's a table:
ROC v1.0 | Reforged 1.32.10 | |
TimerStart(myTimer, 0.000, true, function callback) | ~10000 times a second | ~10000 Hz |
TriggerRegisterTimerEventPeriodic(thisTrig, 0.00) | ~10000 Hz | 100 Hz |
In other words, you cannot have a regular Periodic trigger <10ms with new patches. If you need one, you must use timers to execute it at low timeouts.
The table below describes frequences in the screenshot:
Trigger or Timer \ Tick count | ROC 1.0 | Reforged 1.32.10 |
1s (1000ms) Trigger Periodic | 1 Hz | 1 Hz |
100ms Trg Periodic | 10 | 10 |
20ms Trg Periodic | 50 | 50 |
10ms Trg Periodic | 100 | 100 |
5ms Trg Periodic | 200 | 100 |
1ms Trg Periodic | 1000 | 100 |
0ms Trg Periodic | ~10000 | 100 |
GetTimeOfDay() changes per sec | 200 Hz | 200 Hz |
1ms Timer | 1000 | 1000 |
0ms Timer | ~10000 | ~10000 |
Tested versions:
v1.0 ROC, 1.27.0 ROC/TFT, 1.31.1.12173 (last PTR): high speed trigger periodic1.32.10 Reforged: 100ms trigger periodic.
Test map below, the map script was injected with MPQEditor, don't try to open the map in WE or the code will be lost! The v1.0 WE wouldn't let me save at all, even with default melee triggers. If the map doesn't show in old Warcraft, rename it to have a shorter name.
PS: TriggerRegisterTimerEvent is used by as TriggerRegisterTimerEventPeriodic, TriggerRegisterTimerEventSingle, PostTriggerExecuteBJ.
Attachments
Last edited: