wc3edit.net

United Warcraft 3 map hacking!
It is currently April 19th, 2024, 1:51 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Declaring a Varible
PostPosted: June 16th, 2007, 2:10 pm 
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?


Top
  
 
 Post subject:
PostPosted: June 16th, 2007, 2:15 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
force udg_Chetz=null in globals should work [thats called delcaring a variable... lol]
(note correct spelling and capitalization)


Top
 Profile  
 
 Post subject:
PostPosted: June 16th, 2007, 2:16 pm 
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?


Top
  
 
 Post subject:
PostPosted: June 16th, 2007, 2:19 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
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.

Top
 Profile  
 
 Post subject:
PostPosted: June 16th, 2007, 2:26 pm 
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?


Top
  
 
 Post subject:
PostPosted: June 16th, 2007, 2:35 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
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


Top
 Profile  
 
 Post subject:
PostPosted: June 16th, 2007, 2:38 pm 
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?


Top
  
 
 Post subject:
PostPosted: June 16th, 2007, 2:47 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
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 )


Top
 Profile  
 
 Post subject:
PostPosted: June 16th, 2007, 2:51 pm 
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


Top
  
 
 Post subject:
PostPosted: June 16th, 2007, 2:54 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)