- Joined
- Nov 7, 2014
- Messages
- 571
From what fps changes I am seeing it seems that calling
TriggerRegisterVariableEvent
slows the map script execution?
JASS:
struct Script extends array
static real R = 0
static real i
static method set_i takes nothing returns nothing
set i = GetRandomInt(1, 100)
endmethod
static method set_i_loop takes nothing returns nothing
local integer j
set j = 1
loop
exitwhen j > 400
call set_i()
set j = j + 1
endloop
endmethod
static timer tmr = CreateTimer()
static boolean running = false
static method on_esc takes nothing returns nothing
if not running then
set running = true
call BJDebugMsg("started timer")
call TimerStart(tmr, 0.001, true, function thistype.set_i_loop)
else
set running = false
call BJDebugMsg("stoped timer")
call PauseTimer(tmr)
endif
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerEventEndCinematic(t, Player(0))
call TriggerAddAction(t, function thistype.on_esc)
call BJDebugMsg("Enter /fps and then press ESC")
set t = CreateTrigger()
// uncomment to slow the script! =)
//call TriggerRegisterVariableEvent(t, "s__Script_R", GREATER_THAN, -1)
endmethod
endstruct