HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

jass problem

02-21-2006, 08:59 PM#1
Linera
Why won't this compile without errors?
Collapse JASS:
function Trig_party_Actions takes interger i returns integer
local integer a
    set a = 1
    loop
        exitwhen a > 6
        if ( not ( IsPlayerInForce(Player(i), udg_Party[a]) == true ) ) then
        return a
        else
        set a = 0
        return a
        endif
        set a = a + 1
    endloop
endfunction

//===========================================================================
function InitTrig_party takes nothing returns nothing
    set gg_trg_party = CreateTrigger(  )
    call TriggerAddAction( gg_trg_party, function Trig_party_Actions )
endfunction
02-21-2006, 09:03 PM#2
Blade.dk
Collapse JASS:
function Trig_party_Actions takes interger i returns integer

You can't use a function that takes arguments as a triggeraction, that would crash the game.

The reason for the compile error is because you have spelled integer wrong. Your script reads interger, it is integer that is the right way of spelling it.
02-21-2006, 09:45 PM#3
emjlr3
on another note, im not an expert, but this should be better

Quote:
Originally Posted by Linera
Why won't this compile without errors?
Collapse JASS:
function Trig_party_Actions takes integer i returns integer
local integer a = 1    
    loop
        exitwhen a > 6
        if IsPlayerInForce(Player(i), udg_Party[a]) == true  then
        return a
        else
        set a = 0
        return a
        endif
        set a = a + 1
    endloop
endfunction

//===========================================================================
function InitTrig_party takes nothing returns nothing
    set gg_trg_party = CreateTrigger(  )
    call TriggerAddAction( gg_trg_party, function Trig_party_Actions )
endfunction
02-21-2006, 10:16 PM#4
Linera
so how can i make this function to check what it is checking?
02-21-2006, 10:26 PM#5
Blade.dk
Just make the trigger execute another function and then call this function using arguments.
02-21-2006, 10:30 PM#6
Linera
I tried placing it in custom map script and when i save WE crashes

When i place it at the top of a trigger before the rest of the trigger, i get errors.

Maybe I should give up on making my party system if i can't even get this tiny function to work.
02-21-2006, 10:38 PM#7
Blade.dk
You will have to change the InitTrig function too and such.

Post your edited code if it still does not work.
02-21-2006, 10:55 PM#8
Linera
Solved over MSN messenger.