Declaring a Varible

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Bartimaeus²

Declaring a Varible

Post by Bartimaeus² »

How do I declare a varible, eg,

function Trig_Gold_Conditions takes nothing returns boolean
if ( not ( IsPlayerInForce(GetTriggerPlayer(), udg_Chetz) == true ) ) then
return false
endif
return true
endfunction

function Trig_Gold_Actions takes nothing returns nothing
call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD, S2I(SubStringBJ(GetEventPlayerChatString(), 7, 20)) )
endfunction

I get the error : Undeclared Varible : udg_Chetz

How do I fix this?
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2513
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

force udg_Chetz=null in globals should work [thats called delcaring a variable... lol]
(note correct spelling and capitalization)
Bartimaeus²

Post by Bartimaeus² »

Xantan wrote:force udg_Chetz=null in globals should work [thats called delcaring a variable... lol]
(note correct spelling and capitalization)



Alright, thanks ;p

Hey, in World Editor, does

//===========================================

Means that anything after this wall is under Function Main?
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2513
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

actually you'd need to define it then (in something like InitGlobals), use this instead:
force udg_Chetz=CreateForce()


Edit:
Baertaemias wrote:
Alright, thanks ;p

Hey, in World Editor, does

//===========================================

Means that anything after this wall is under Function Main?


uhm, nope not really (could be anything)... if you ever make a map in world editor then extract it with mpqmaster + use jasscraft, you'll see all the //========= (comments) that the world editor automatically puts all over...

also thats a great way to learn how to define variables etc! =]
Last edited by Xantan on June 16th, 2007, 2:36 pm, edited 2 times in total.
Bartimaeus²

Post by Bartimaeus² »

Xantan wrote:actually you'd need to define it then, use this:
force udg_Chetz=CreateForce()


Edit:
Baertaemias wrote:
Alright, thanks ;p

Hey, in World Editor, does

//===========================================

Means that anything after this wall is under Function Main?


uhm, nope not really (could be anything)... if you ever make a map in world editor then extract it with mpqmaster + use jasscraft, you'll see all the //========= (comments) that the world editor automatically puts all over...

also thats a great way to learn how to define variables etc! =]


Than what do I do with the stuff below the Wall of Lines?

Also, I did declare "udg_trg_gold" and "udg_trg_wood" I was suppose to do that, right?
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2513
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

I'm not sure as I don't see your map in front of me, and don't really want to either.

IF you needed to declare a variable it would say so, so, yeah, probably.

I'd honestly just use jasscraft... lol
Bartimaeus²

Post by Bartimaeus² »

Xantan wrote:I'm not sure as I don't see your map in front of me, and don't really want to either.

IF you needed to declare a variable it would say so, so, yeah, probably.

I'd honestly just use jasscraft... lol


I am, lol, I did the trigger in GUI in Warcraft III, than I changed it into JASS, than I put it into Green TD .j file.

So... what do I do with the stuff below those lines? Because I don't know what it is or what it does ;\

And, gg_trg_gold
gg_trg_wood are the right variables right?
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2513
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

if you get no syntax errors then sure! they are good.

The lines mean NOTHING.

delete them and put them all under function main.

you'll still need something to call your trigger though in function main... ie
call InitTrig_gg_gold( )
call InitTrig_gg_wood( )
(or their correct names -- I didn't look)
( may need to leave off trg_ not sure, just test it )
Bartimaeus²

Post by Bartimaeus² »

Xantan wrote:if you get no syntax errors then sure! they are good.

The lines mean NOTHING.

delete them and put them all under function main.

you'll still need something to call your trigger though in function main... ie
call InitTrig_gg_gold( )
call InitTrig_gg_wood( )
(or their correct names -- I didn't look)
( may need to leave off trg_ not sure, just test it )



..uhm, re-say that, because you said "Delete the lines and put them under function main" ...btw, I get Syntax errors when I put the lines under function main 0_0
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2513
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

DON'T put anything you converted to function main.

Converting a trigger does not bring up ANY globals or function main, only the below globals and above function main... (I call it functions, lol)

You take the stuff it converted and remove ALL comments (//=========) then put it below endglobals after delcaring it in globals, then use as I said above call InitTrig etc in function main...

I'm somewhat tired of answering questions... lol
Post Reply