GetClickedButton() always returns null for some reason. Does anyone know what is going on?
Here is what my code looks like
Code: Select all
set mydialog = DialogCreate()
call DialogSetMessage(mydialog,"You now have 30 seconds\n to vote on game modes")
set mybuttons[0]=DialogAddButton(mydialog,"Don't Care",13)
set mybuttons[1]=DialogAddButton(mydialog,"Normal Mode",78)
set mybuttons[2]=DialogAddButton(mydialog,"Nuke Mode",75)
set mybuttons[3]=DialogAddButton(mydialog,"Space Mode",83)
call TriggerRegisterDialogButtonEvent( TrigDialogClick, mybuttons[0])
call TriggerRegisterDialogButtonEvent( TrigDialogClick, mybuttons[1])
call TriggerRegisterDialogButtonEvent( TrigDialogClick, mybuttons[2])
call TriggerRegisterDialogButtonEvent( TrigDialogClick, mybuttons[3])
loop
exitwhen i>5
call DialogDisplay( Player(i), mydialog, true)
set i=i+1
endloop
Code: Select all
function funcDialog takes nothing returns nothing
local integer i=0
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"A dialog was clicked")
loop
exitwhen i>3
if GetClickedButton() == mybuttons[i] then
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Button " + I2S(i) + " was selected")
endif
set i=i+1
endloop
endfunction