- Joined
- Feb 11, 2011
- Messages
- 1,860
Hello,
I have something like this:
When I test it and click the first button (with text "Button 0"), it displays the text "Something else" instead of "Button 0 clicked!". What am I doing wrong? Perhaps I am missing something, but I can't find it.
Thanks,
Mr_Bean
I have something like this:
JASS:
globals
private dialog d
private button array b
endglobals
private function ClickButton takes nothing returns boolean
if (GetClickedButton() == b[0]) then
call BJDebugMsg("Button 0 clicked!")
else
call BJDebugMsg("Something else")
endif
return false
endfunction
private function CreateDialog takes nothing returns boolean
local trigger t = CreateTrigger()
set d = DialogCreate()
call DialogSetMessage(d, "Click a button::")
set b[0] = DialogAddButton(d, "Button 0", 0)
set b[1] = DialogAddButton(d, "Button 1", 0)
set b[2] = DialogAddButton(d, "Button 2", 0)
call TriggerAddCondition(t, Condition(function ClickButton))
call TriggerRegisterDialogButtonEvent(t, b[0])
call TriggerRegisterDialogButtonEvent(t, b[1])
call TriggerRegisterDialogButtonEvent(t, b[2])
call DialogDisplay(Player(0), d, true)
set t = null
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddCondition(t, Condition(function CreateDialog))
call TriggerRegisterTimerEvent(t, 0.01, false)
set t = null
endfunction
When I test it and click the first button (with text "Button 0"), it displays the text "Something else" instead of "Button 0 clicked!". What am I doing wrong? Perhaps I am missing something, but I can't find it.
Thanks,
Mr_Bean