code array. is it possible ?

Amn

Member
Reaction score
18
hi, i want to have an array of codes to combine items, it uses the item's custom value to determine what function to run

having this two functions declared:

Code:
function [COLOR="#FF8C00"]CombineItemA [/COLOR]takes nothing returns nothing
endfunction

function [COLOR="#FF8C00"]CombineItemB [/COLOR]takes nothing returns nothing
endfunction

can i use an array like this ?
Code:
code array [COLOR="#0000FF"]CombineFunctions[/COLOR]
set [COLOR="#0000FF"]CombineFunctions[/COLOR][0] = function [COLOR="#FF8C00"]CombineItemsA[/COLOR]
set [COLOR="#0000FF"]CombineFunctions[/COLOR][1] = function [COLOR="#FF8C00"]CombineItemsB[/COLOR]

so later i can refer to them using:
call CombineFunctions[ 1 ]

thank u
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
a lotta times you wind up either doing a function interface or saving them as a Boolexpr and adding them to a trigger via TriggerAddCondition and running the trigger
 

Dirac

22710180
Reaction score
147
Do not use function interfaces.
Use Advent, which allows smart data retrieval and event arrays.
If you don't know how to use advent then do as GFreak45 said.
JASS:
set CombineFunctions[0] = CreateTrigger()
call TriggerAddCondition(CombineFunctions[0],Filter(code))

To fire the code do
[ljass]TriggerEvaluate(CombineFunctions[0])[/ljass]
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top