- Joined
- Dec 12, 2010
- Messages
- 2,070
i just cant handle with it..
i used TriggerRegisterDialogButtonEvent and TriggerRegisterDialogEvent. in first case it always goes to checker as Mode choosing. in second case nothing happen at all.
my goal - is allow to custom setups by dialog boxes. after setting up some stat whole dialog appear again, until "start battle" pressed.
map attached. please, who met dialogs in JASS, not gui, heeelp! i cant get where is my fault.
PS. i moved out therest part cause for now i want at least one first option working, all other i can repeat on example
JASS:
globals
trigger dlgshow
dialog dlg
button mode
button lvl
button gold
button bonusexp
button expmod
button go
button modeFFA
button modeTDM
button kills20
button kills30
button kills40
button kills50
button kills60
button kills70
button kills80
button kills90
button kills100
button level8
button level9
button level10
button level11
button level12
button be0
button be1
button be2
button be3
button be4
button em1
button em2
button em3
button gold800
button gold1000
button gold1100
button gold1200
button gold1500
button gold1600
button gold1700
button gold2000
integer ExpPerSec=0
integer StartingLevel=8
integer StartingGold=1000
integer ExpMult=1
integer GameType=1
hashtable MHT
endglobals
function dlgChangeEM takes nothing returns boolean
local button b=GetClickedButton()
if b==em1 then
set ExpMult=1
elseif b==em2 then
set ExpMult=2
elseif b==em3 then
set ExpMult=3
endif
call DestroyTrigger(GetTriggeringTrigger())
set b=null
call ExecuteFunc("dlgshowmain")
return false
endfunction
function dlgChangeBE takes nothing returns boolean
local button b=GetClickedButton()
if b==be0 then
set ExpPerSec=0
elseif b==be1 then
set ExpPerSec=1
elseif b==be2 then
set ExpPerSec=2
elseif b==be3 then
set ExpPerSec=3
elseif b==be4 then
set ExpPerSec=4
endif
call DestroyTrigger(GetTriggeringTrigger())
set b=null
call ExecuteFunc("dlgshowmain")
return false
endfunction
function dlgChangeGold takes nothing returns boolean
local button b=GetClickedButton()
if b==gold800 then
set StartingGold=800
elseif b==gold1000 then
set StartingGold=1000
elseif b==gold1100 then
set StartingGold=1100
elseif b==gold1200 then
set StartingGold=1200
elseif b==gold1500 then
set StartingGold=1500
elseif b==gold1600 then
set StartingGold=1600
elseif b==gold1700 then
set StartingGold=1700
elseif b==gold2000 then
set StartingGold=2000
endif
call DestroyTrigger(GetTriggeringTrigger())
set b=null
call ExecuteFunc("dlgshowmain")
return false
endfunction
function dlgChangeLevel takes nothing returns boolean
local button b=GetClickedButton()
if b==level8 then
set StartingLevel=8
elseif b==level9 then
set StartingLevel=9
elseif b==level10 then
set StartingLevel=10
elseif b==level11 then
set StartingLevel=11
elseif b==level12 then
set StartingLevel=12
endif
call DestroyTrigger(GetTriggeringTrigger())
set b=null
call ExecuteFunc("dlgshowmain")
return false
endfunction
function dlgChangeMod takes nothing returns boolean
local button b=GetClickedButton()
if b==modeFFA then
set GameType=1
else
set GameType=2
endif
call DestroyTrigger(GetTriggeringTrigger())
set b=null
call ExecuteFunc("dlgshowmain")
return false
endfunction
function dlgshowcheckerMode takes nothing returns boolean
local trigger t=CreateTrigger()
local integer h=GetHandleId(t)
call DialogClear(dlg)
set modeFFA=DialogAddButton(dlg,"Free for all",'f')
set modeTDM=DialogAddButton(dlg,"Team deathmatch",'t')
call DialogSetMessage(dlg,"Choose mode")
call DialogDisplay(Player(0),dlg,true)
call TriggerRegisterDialogButtonEvent(t,modeFFA)
call TriggerRegisterDialogButtonEvent(t,modeTDM)
call TriggerAddCondition(t,Condition(function dlgChangeMod))
call TriggerRegisterDialogEvent(t,dlg)
set t=null
return false
endfunction
function therest takes nothing returns boolean
local button b
local trigger t
if b==lvl then
set level8=DialogAddButton(dlg,"Level 8",'8')
set level9=DialogAddButton(dlg,"Level 9",'9')
set level10=DialogAddButton(dlg,"Level 10",'8')
set level11=DialogAddButton(dlg,"Level 11",'9')
set level12=DialogAddButton(dlg,"Level 12",'8')
call DialogSetMessage(dlg,"Choose start level")
call DialogDisplay(Player(0),dlg,true)
// call TriggerRegisterDialogEvent(t,dlg)
call TriggerRegisterDialogButtonEvent(t,level8)
call TriggerRegisterDialogButtonEvent(t,level9)
call TriggerRegisterDialogButtonEvent(t,level10)
call TriggerRegisterDialogButtonEvent(t,level11)
call TriggerRegisterDialogButtonEvent(t,level12)
call TriggerAddCondition(t,Condition(function dlgChangeLevel))
elseif b==gold then
set gold800=DialogAddButton(dlg,"800",'8')
set gold1000=DialogAddButton(dlg,"1000",'8')
set gold1100=DialogAddButton(dlg,"1100",'8')
set gold1200=DialogAddButton(dlg,"1200",'8')
set gold1500=DialogAddButton(dlg,"1500",'8')
set gold1600=DialogAddButton(dlg,"1600",'8')
set gold1700=DialogAddButton(dlg,"1700",'8')
set gold2000=DialogAddButton(dlg,"2000",'8')
call DialogSetMessage(dlg,"Choose start gold")
call DialogDisplay(Player(0),dlg,true)
call TriggerRegisterDialogButtonEvent(t,gold800)
call TriggerRegisterDialogButtonEvent(t,gold1000)
call TriggerRegisterDialogButtonEvent(t,gold1100)
call TriggerRegisterDialogButtonEvent(t,gold1200)
call TriggerRegisterDialogButtonEvent(t,gold1500)
call TriggerRegisterDialogButtonEvent(t,gold1600)
call TriggerRegisterDialogButtonEvent(t,gold1700)
call TriggerRegisterDialogButtonEvent(t,gold2000)
// call TriggerRegisterDialogEvent(t,dlg)
call TriggerAddCondition(t,Condition(function dlgChangeGold))
elseif b==bonusexp then
set be0=DialogAddButton(dlg,"0",'8')
set be1=DialogAddButton(dlg,"1",'8')
set be2=DialogAddButton(dlg,"2",'8')
set be3=DialogAddButton(dlg,"3",'8')
set be4=DialogAddButton(dlg,"4",'8')
call DialogSetMessage(dlg,"Choose exp per second rate")
call DialogDisplay(Player(0),dlg,true)
call TriggerRegisterDialogButtonEvent(t,be0)
call TriggerRegisterDialogButtonEvent(t,be1)
call TriggerRegisterDialogButtonEvent(t,be2)
call TriggerRegisterDialogButtonEvent(t,be3)
call TriggerRegisterDialogButtonEvent(t,be4)
// call TriggerRegisterDialogEvent(t,dlg)
call TriggerAddCondition(t,Condition(function dlgChangeBE))
elseif b==expmod then
set em1=DialogAddButton(dlg,"x1",'8')
set em2=DialogAddButton(dlg,"x2",'8')
set em3=DialogAddButton(dlg,"x3",'8')
call DialogSetMessage(dlg,"Choose exp multiplier")
call DialogDisplay(Player(0),dlg,true)
call TriggerRegisterDialogButtonEvent(t,em1)
call TriggerRegisterDialogButtonEvent(t,em2)
call TriggerRegisterDialogButtonEvent(t,em3)
// call TriggerRegisterDialogEvent(t,dlg)
call TriggerAddCondition(t,Condition(function dlgChangeEM))
//elseif b==go then
// call DestroyTrigger(GetTriggeringTrigger())
endif
set t=null
return false
endfunction
function dlgshowmain takes nothing returns boolean
local string s=""
local trigger t=CreateTrigger()
local integer h=GetHandleId(t)
if GameType==1 then
set s="Free for all"
elseif GameType==2 then
set s="Team Deathmatch"
endif
set dlg=DialogCreate()
set mode=DialogAddButton(dlg,"Mode - "+s,'d')
set lvl=DialogAddButton(dlg,"Start level - "+I2S(StartingLevel),'l')
set gold=DialogAddButton(dlg,"Start gold - "+I2S(StartingGold),'g')
set bonusexp=DialogAddButton(dlg,"Exp per seconds - "+I2S(ExpPerSec),'e')
set expmod=DialogAddButton(dlg,"Exp multiplier - "+I2S(ExpMult),'x')
set go=DialogAddButton(dlg,"START BATTLE",'s')
// call SaveDialogHandle(MHT,h,0,dlg)
// call TriggerRegisterDialogEvent(t,dlg)
call TriggerRegisterDialogButtonEvent(t,mode)
call TriggerAddCondition(t,Condition(function dlgshowcheckerMode))
set t=CreateTrigger()
call TriggerRegisterDialogButtonEvent(t,lvl)
call TriggerRegisterDialogButtonEvent(t,gold)
call TriggerRegisterDialogButtonEvent(t,bonusexp)
call TriggerRegisterDialogButtonEvent(t,expmod)
call TriggerRegisterDialogButtonEvent(t,go)
// call TriggerRegisterDialogEvent(t,EVENT_DIALOG_CLICK)
call TriggerAddCondition(t,Condition(function therest))
call DialogSetMessage(dlg,"Choose settings")
call DialogDisplay(Player(0),dlg,true)
set dlg=null
set mode=null
set lvl=null
set gold=null
set bonusexp=null
set expmod=null
set t=null
return false
endfunction
function InitTrig_Untitled_Trigger_002 takes nothing returns nothing
set MHT=InitHashtable()
set dlgshow = CreateTrigger( )
call TriggerRegisterTimerEventSingle( dlgshow, 0.10 )
call TriggerAddAction( dlgshow, function dlgshowmain )
endfunction
i used TriggerRegisterDialogButtonEvent and TriggerRegisterDialogEvent. in first case it always goes to checker as Mode choosing. in second case nothing happen at all.
my goal - is allow to custom setups by dialog boxes. after setting up some stat whole dialog appear again, until "start battle" pressed.
map attached. please, who met dialogs in JASS, not gui, heeelp! i cant get where is my fault.
PS. i moved out therest part cause for now i want at least one first option working, all other i can repeat on example