Chaosy
Tutorial Reviewer
- Joined
- Jun 9, 2011
- Messages
- 13,219
I had an idea of a 'new' way to create MUI stuff. I had some issues and messaged Edo about it. After a few fixes my WIP system seemed to work fine but Edo was claiming more than once that it shouldn't work at all due the GetTriggeringTrigger.
JASS:
globals
hashtable hash = InitHashtable()
endglobals
function someFunc takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer h = GetHandleId(t)
local integer counter = LoadInteger(hash, h, 3)
local integer goal = LoadInteger(hash, h, 2)
if counter < goal then
call TriggerExecute(LoadTriggerHandle(hash, h, 1))
set counter = counter + 1
call SaveInteger(hash, h, 3, counter)
else
//will this actually destroy the trigger?
call BJDebugMsg("asd")
call DestroyTrigger(LoadTriggerHandle(hash, h, 4))
call FlushChildHashtable(hash, h)
endif
endfunction
function applyTimer takes trigger t, integer interval, integer times returns nothing
local trigger newTrigger = CreateTrigger()
local timer tempTimer = CreateTimer()
call SaveTriggerHandle(hash, GetHandleId(newTrigger), 1, t)
call SaveInteger(hash, GetHandleId(newTrigger), 2, times)
call SaveInteger(hash, GetHandleId(newTrigger), 3, 0)
call SaveTriggerHandle(hash, GetHandleId(newTrigger), 4, newTrigger)
call TriggerRegisterTimerExpireEvent(newTrigger, tempTimer )
call TriggerAddAction(newTrigger, function someFunc )
call TimerStart(tempTimer, interval, true, null)
endfunction
-
call
-
Events
- Map initialization
- Conditions
-
Actions
- Set t = periodic <gen>
- Custom script: call applyTimer(udg_t, 2, 3)
-
Events
-
periodic
- Events
- Conditions
-
Actions
- Game - Display to (All players) the text: derp