Frozenhelfir
set Gwypaas = Guhveepaws
- Reaction score
- 56
I was wondering if there is a variable (my thoughts are the code variable but I'm not certain) that points to a function. My intent with this is to call a different function based on a loop so I don't have a lot of triggers fire off of the same event, rather it'll just loop through an action that will call different functions based on logic comparison truths. Here is what I'm trying to do:
YELLOW is just a random variable with each containing a different spell ID. So if I have 20 spells that do something when they are cast, instead of having 20 triggers, I'm trying to just have one trigger that checks the conditions and then chooses the correct action(s). Just a side question, is this the best way to optimize code or would there be a better way that I am not aware of?
YELLOW is just a random variable with each containing a different spell ID. So if I have 20 spells that do something when they are cast, instead of having 20 triggers, I'm trying to just have one trigger that checks the conditions and then chooses the correct action(s). Just a side question, is this the best way to optimize code or would there be a better way that I am not aware of?
JASS:
private function Action0 takes nothing returns nothing
//does something fun and exciting which is so exciting you can't see it or you would die of excitement (actually not setup yet!)
endfunction
private function Action1 takes nothing returns nothing
//does whatever I want this one to do
endfunction
private function Action2 takes nothing returns nothing
//does whatever this one does
endfunction
private function Conditions takes nothing returns nothing
set i = 0
loop
if GetSpellAbilityId() == YELLOW<i>[1] then
call Action# //I want this line to call those two functions above based on the value of i when the if checks true
endif
exitwhen i >=2
set i = i+1
endloop
endfunction</i>