Well, I don't know exactly what the problem is, I've got a function that doesn't work. I want to compare two loops, but since I only want to run one each time I test, I put each of them in a function so that I simply turn the call to a function into a comment (since JASS doesn't support multi-line comments).
Anyway, here's my function:
And here's my call to the function (which is inside the main trigger function):
I'm using JASS NewGen, and I'm getting a heap of errors, but I think most of them are based on the parameters in my function. So I want to know, can functions in JASS handle arrays as arguments? Or do I have to just write the function declaration differently?
If this isn't the problem, I'd be glad to give a full list of errors (both from the WE and NewGen) and my full trigger code, if you need it.
Anyway, here's my function:
JASS:
function PlayMidis takes string h string o returns nothing
local integer i = 0
loop
exitwhen i > 1
if GetLocalPlayer() == Player(i) then
if GetPlayerRace(Player(i)) == RACE_HUMAN then
call PlayMusic(h[GetRandomInt(1, 4)])
elseif GetPlayerRace(Player(i)) == RACE_ORC then
call PlayMusic(o[GetRandomInt(1, 4)])
endif
endif
set i = i + 1
endloop
endfunction
And here's my call to the function (which is inside the main trigger function):
JASS:
call PlayMidis(HumanMusic, OrcMusic)
HumanMusic
and OrcMusic
are both valid Arrays, I've used them before.I'm using JASS NewGen, and I'm getting a heap of errors, but I think most of them are based on the parameters in my function. So I want to know, can functions in JASS handle arrays as arguments? Or do I have to just write the function declaration differently?
If this isn't the problem, I'd be glad to give a full list of errors (both from the WE and NewGen) and my full trigger code, if you need it.