HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

SetTimeOfDayScale crashes game

10-30-2009, 11:48 PM#1
Windexglow
Collapse JASS:
library TimeOfDay12 initializer init
globals 
    private trigger t = CreateTrigger()
endglobals

private function TimeOfDay takes nothing returns nothing
    call SetTimeOfDayScale(2.0)
endfunction

private function init takes nothing returns nothing
    call TriggerRegisterGameStateEventTimeOfDay( t, EQUAL, 12.00 )
    call TriggerAddAction( t, function TimeOfDay)
endfunction
endlibrary

Causes a crash on even a brand new map with only that script active. Removing SetTimeOfDayScale causes the crash to go away.
Using SetTimeOfDayScalePercentBJ also causes a crash.

However, using something that doesn't call SetTimeOfDayScale doesn't cause the trigger to crash.
For example, SetTimeOfDay(12.50) works correctly and doesn't cause the game to crash.
Using BJDebugMsg("This works!") Works correctly.

Is this a known bug? I can't figure out why this is going on.
10-31-2009, 03:34 AM#2
DioD
Event overflow.

why you dont checked event on your own?

Collapse JASS:
library TimeOfDay12 initializer init
globals 
    private trigger t = CreateTrigger()
endglobals

private function TimeOfDay takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call SetTimeOfDayScale(2.00)
    //call EnableTrigger(GetTriggeringTrigger())
endfunction

private function init takes nothing returns nothing
    call TriggerRegisterGameStateEventTimeOfDay( t, EQUAL, 1.0 )
    call TriggerAddAction( t, function TimeOfDay)
endfunction
endlibrary
10-31-2009, 03:36 AM#3
DioD
Collapse JASS:
library TimeOfDay12 initializer init
globals 
    private trigger t = CreateTrigger()
    boolean TRUEx = true
endglobals

private function TimeOfDay takes nothing returns nothing
    if TRUEx then
        set TRUEx = false
        call SetTimeOfDayScale(2.01)
    endif
    call BJDebugMsg("EVENT FIRED")
endfunction

private function init takes nothing returns nothing
    call TriggerRegisterGameStateEventTimeOfDay( t, EQUAL, 1.0 )
    call TriggerAddAction( t, function TimeOfDay)
endfunction
endlibrary
10-31-2009, 03:59 AM#4
DioD
final SANDBOX-PROPER version of jass code to debug this kind of error:

Collapse JASS:
library TimeOfDay12 initializer init
globals 
    private trigger t = CreateTrigger()
    boolean TRUEx = true
    boolean TRUEz = true
    integer calls = 0
endglobals

function BJDebugMsgx takes string msg returns nothing
    local integer i = 0
    loop
        call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYERS
    endloop
    set calls = calls + 1
endfunction

private function TimeOfDay takes nothing returns nothing
    call BJDebugMsgx("EVENT KEY IS " + I2S(GetHandleId(GetTriggerEventId())))
    if GetHandleId(GetTriggerEventId()) == 96 then
        call SetTimeOfDayScale(2.00)
        call BJDebugMsgx("KEY EVENT FIRED")
    else
        call BJDebugMsgx("EVENT FIRED")
        if TRUEx or TRUEz then
            if not TRUEx then
                set TRUEz = false
            endif
            set TRUEx = false
            call SetTimeOfDayScale(2.00)
        endif
    endif
    call BJDebugMsg("Total number of debug(event) calls is:" + I2S(calls) + " this is for 2x SetTimeOfDayScale.")
endfunction

private function init takes nothing returns nothing
    call TriggerRegisterGameStateEventTimeOfDay( t, EQUAL, 1.0 )
    call TriggerAddAction( t, function TimeOfDay)
    call TriggerRegisterPlayerChatEvent(t,Player(0),"",false)
endfunction
endlibrary