I have a number of buttons that are stored in a dialog item array. If a player uses one of them, is there an easy way to return the index of the used button or do I have to use Switch/if-then-else to determinate which one has been used?
Also, is it possible to make a condition that looks something like this:
global var
buttons[x] <dialog items>
numberOfButtons <interger> = x
create a function
nameisValidButtonlocalvari<integer>=0returnbooleanparameterdi<dialogitem>actionwhilei<numberOfButtonsanddi!=button[i] do
i=i+1
if i = numberOfButtons then
return false
else
return true
then add it to your condition
isValidButton(triggering dialog item) == true
easy index
function again
namegetButtonNumberlocalvari<integer>=0returnintegerparameterdi<dialogitem>actionwhilei<numberOfButtonsanddi!=button[i] do
i=i+1
return i
this function is useable like every other blizz provided function
I have a number of buttons that are stored in a dialog item array. If a player uses one of them, is there an easy way to return the index of the used button or do I have to use Switch/if-then-else to determinate which one has been used?
Also, is it possible to make a condition that looks something like this:
Used Dialog Item == Button[Any Index]
instead of:
OR -Used Dialog Item == Button[0] -Used Dialog Item == Button[1] -.....
Second: I doubt it, but i havent checked custom condition definitions yet
First:
Yes. Make a local variable called index (or whatever)
Then use "Index" as your index. I hope this works for you :)
easy condition
global var
buttons[x] <dialog items>
numberOfButtons <interger> = x
create a function
then add it to your condition
isValidButton(triggering dialog item) == true
easy index
function again
this function is useable like every other blizz provided function