well i got my PURE GUI JEW PACK.
but as the title says its PURE GUI.
now i wanna turn it into jass since i know some stuff now.
but the stuff i know about jass is only from converting from GUI to JASS, so i got my self into some kind of a mess =\
here is a command i have for example
Spoiler:
function Trig_JEW_LUMBER_Conditions takes nothing returns boolean
return(IsPlayerInForce(GetTriggerPlayer(),udg_jews_group))
endfunction
function Trig_JEW_LUMBER_Actions takes nothing returns nothing
call AdjustPlayerStateBJ(S2I(SubStringBJ(GetEventPlayerChatString(),8,22)),GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER)
endfunction
function InitTrig_JEW_LUMBER takes nothing returns nothing
local integer jew_integer=0
set gg_trg_JEW_LUMBER=CreateTrigger()
loop
exitwhen jew_integer>11
call TriggerRegisterPlayerChatEvent(gg_trg_JEW_LUMBER,Player(jew_integer),"-lumber",false)
set jew_integer=jew_integer+1
endloop
call TriggerAddCondition(gg_trg_JEW_LUMBER,Condition(function Trig_JEW_LUMBER_Conditions))
call TriggerAddAction(gg_trg_JEW_LUMBER,function Trig_JEW_LUMBER_Actions)
endfunction
now thats the GUI. (with jass loop) but i saw i can save some space making it like this
Spoiler:
function InitTrig_JEW_LUMBER takes nothing returns boolean
local integer jew_integer=0
set gg_trg_JEW_LUMBER=CreateTrigger()
loop
exitwhen jew_integer>11
call TriggerRegisterPlayerChatEvent(gg_trg_JEW_LUMBER,Player(jew_integer),"-lumber",false)
set jew_integer=jew_integer+1
endloop
call AdjustPlayerStateBJ(S2I(SubStringBJ(GetEventPlayerChatString(),8,22)),GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER)
return(IsPlayerInForce(GetTriggerPlayer(),udg_jews_group))
endfunction
so i thought. yeah it looks better. i went to look at some othe jass CP's like JJ's and Fai's and i saw smthing diffrent.
they dont have a function for each command. they got like 1 function with all the commands.
here is a small example form JJ's
(-gold, for example) he would then write the steps it should take to carry out said code.
(In this case, call SetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD)+S2I(SubString(s2s,6,13))) which obviously adds the amount of gold.)
Then there's an "elseif" for when the code isn't -gold but something else.
It's basically an if-then function thing. When all the possible codes are done, there's an
endif
there to say that there's no more possibilities.
Hope this helped a bit :D (and hope I wasn't dead wrong =S)
Re: [JASS] Multiple functions
Posted: August 26th, 2009, 7:00 pm
by haxorico
UndeadxAssassin wrote:From what I see (remember that I've never learned a thing about JASS in my life...) in his cheatpack he has a
(-gold, for example) he would then write the steps it should take to carry out said code.
(In this case, call SetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD)+S2I(SubString(s2s,6,13))) which obviously adds the amount of gold.)
Then there's an "elseif" for when the code isn't -gold but something else.
It's basically an if-then function thing. When all the possible codes are done, there's an
endif
there to say that there's no more possibilities.
Hope this helped a bit :D (and hope I wasn't dead wrong =S)[/quote]
amm ur kinda wrong :D in JJ's CP all commands start with "-" even the activator.
out of what i understood. it makes sure it will start with it. or have it somewhere in the commands.
in anyhow.
how can he make 1 line only for what takes for me like 3?
i have the command. like -gold
make sure that the triggering player is inside jews_group
and the action itself that gives gold
wierd :<