Hello Hive.
I've got this strange problem with my GameModeSelection system whereby I have set up a dialog which displays perfectly yet the triggers controlling the button press events do not seem to execute.
Triggers:
Sets up the dialog. Works fine seemingly. Ive also tried to set the button globals by using
Shows the dialog then checks if user has chosen within 10 seconds, if not, choose for them.
This is 1 of the button triggers. The others are identical bar the displayed text. The events do not trigger.
When the trigger
What could be going wrong and causing the button events not to register?
I've got this strange problem with my GameModeSelection system whereby I have set up a dialog which displays perfectly yet the triggers controlling the button press events do not seem to execute.
Triggers:
Sets up the dialog. Works fine seemingly. Ive also tried to set the button globals by using
bj_lastCreatedButton
but it doesnt make a difference.
JASS:
//P.S. I don't usually use these global blocks, just the variable editor
//this was one of my attempts at making it work because making a
//dialog variable in the variable editor actualy creates the dialog for you
globals
dialog udg_dialogMode
endglobals
function Trig_createDialog_Actions takes nothing returns nothing
set udg_dialogMode = DialogCreate()
call DialogSetMessage(udg_dialogMode, "Choose Game Mode")
set udg_buttonAss = DialogAddButton(udg_dialogMode, udg_playerColours[0]+"Assault"+"|r", 1)
set udg_buttonCTF = DialogAddButton(udg_dialogMode, udg_playerColours[6]+"CTF"+"|r", 2)
set udg_buttonDom = DialogAddButton(udg_dialogMode, udg_playerColours[1]+"Domination"+"|r", 3)
endfunction
//===========================================================================
function InitTrig_createDialog takes nothing returns nothing
set gg_trg_createDialog = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_createDialog, 0.1, false)
call TriggerAddAction( gg_trg_createDialog, function Trig_createDialog_Actions )
endfunction
Shows the dialog then checks if user has chosen within 10 seconds, if not, choose for them.
JASS:
function checkModeIsSelected takes nothing returns nothing
local integer i = 0
call DestroyTimer(GetExpiredTimer())
if not IsQuestEnabled(udg_questMode) then
call TriggerExecute(gg_trg_diagSelectAss)
endif
endfunction
function Trig_diagShow_Actions takes nothing returns nothing
local timer t
call DialogDisplay(Player(0), udg_dialogMode, true)
set t = CreateTimer()
call TimerStart(t, 10, false, function checkModeIsSelected)
endfunction
//===========================================================================
function InitTrig_diagShow takes nothing returns nothing
set gg_trg_diagShow = CreateTrigger( )
call TriggerRegisterTimerEvent(gg_trg_diagShow, 3, false)
call TriggerAddAction( gg_trg_diagShow, function Trig_diagShow_Actions )
endfunction
This is 1 of the button triggers. The others are identical bar the displayed text. The events do not trigger.
JASS:
function Trig_diagSelectAss_Actions takes nothing returns nothing
local integer i = 0
call DisplayTextToPlayer(Player(0), 0, 0, "selected assault")
call QuestSetTitle(udg_questMode, "Mode:"+udg_playerColours[0]+" Assault|r")
call QuestSetDescription( udg_questMode,"Your objective is to send your forces to attack the statue at the opposing team's base.")
call QuestSetEnabled(udg_questMode, true)
loop
call DisplayTextToPlayer(Player(i), 0, 0, ("Game Mode: "+udg_playerColours[0]+" Assault|r"))
call DisplayTextToPlayer(Player(i), 0, 0, "Your objective is to send your forces to attack the statue at the opposing team's base.")
exitwhen i == 10
set i = i+1
endloop
call FlashQuestDialogButton()
endfunction
//===========================================================================
function InitTrig_diagSelectAss takes nothing returns nothing
set gg_trg_diagSelectAss = CreateTrigger( )
call TriggerRegisterDialogButtonEvent(gg_trg_diagSelectAss, udg_buttonAss)
call TriggerAddAction( gg_trg_diagSelectAss, function Trig_diagSelectAss_Actions )
endfunction
When the trigger
gg_trg_diagSelectAss
is called from the timer function it runs but otherwise it doesn't.call DisplayTextToPlayer(Player(0), 0, 0, "selected assault")
doesn't call.What could be going wrong and causing the button events not to register?