wc3edit.net

United Warcraft 3 map hacking!
It is currently April 18th, 2024, 9:32 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: set local or no to set
PostPosted: March 1st, 2007, 12:54 pm 
Offline
Newcomer

Joined: February 18th, 2007, 10:26 pm
Posts: 8
Location: Germany
Hi there ... so

i just wanna know if it matters:


function Trig_asfd_Actions takes nothing returns nothing
local unit toteEinheit = GetDyingUnit()
call TriggerSleepAction( 20.00 )
call ReviveHeroLoc( toteEinheit, GetRectCenter(GetPlayableMapRect()), false )
endfunction


in the local line the

local unit toteEinheit = GetDyingUnit()


so does it matters if i write it so or so:

set local unit toteEinheit = GetDyingUnit()

or is it ok to write it without the set cuz i define it at begining?

pls some help

_________________
10 X =


Top
 Profile  
 
 Post subject:
PostPosted: March 1st, 2007, 1:17 pm 
Offline
S.M.B. Creator
User avatar

Joined: January 20th, 2007, 11:32 am
Posts: 84
Location: Germany
Its:

local unit toteEinheit = GetDyingUnit()


Top
 Profile  
 
 Post subject:
PostPosted: March 1st, 2007, 3:03 pm 
Offline
Newcomer

Joined: February 18th, 2007, 10:26 pm
Posts: 8
Location: Germany
so when i use the "set" ?

a example would be nice.
thx for HELP :)

_________________
10 X =


Top
 Profile  
 
 Post subject:
PostPosted: March 1st, 2007, 7:51 pm 
Offline
Forum Staff
User avatar

Joined: January 28th, 2007, 8:10 pm
Posts: 830
Location: Canada
Title: JASS Programmer
Never use "set" in your local variable declarations

The only time you use "set" is if the variable can potentially be altered beause of a condition OR you're nullifying it:

ex:
function example takes nothing returns nothing
local integer i = 1
if (Condition) then
set i = i*1.2
else
set i = i*1.5
endif
endfunction


Top
 Profile  
 
 Post subject:
PostPosted: March 1st, 2007, 8:05 pm 
Offline
Newcomer

Joined: February 18th, 2007, 10:26 pm
Posts: 8
Location: Germany
wow thx thats what i just wanna know ^^ great , ...

ehm jeah i have another question (not rili one)

why does i need endfunction if i have return and it will never reach the end ?
or does it jump from return instantly to endfunction so i need it anyway?

_________________
10 X =


Top
 Profile  
 
 Post subject:
PostPosted: March 1st, 2007, 9:51 pm 
Offline
Forum Staff
User avatar

Joined: January 28th, 2007, 8:10 pm
Posts: 830
Location: Canada
Title: JASS Programmer
Are you talking about

function x takes nothing returns boolean
return(_______)
endfunction

?


Top
 Profile  
 
 Post subject:
PostPosted: March 4th, 2007, 10:28 am 
Offline
Newcomer

Joined: February 18th, 2007, 10:26 pm
Posts: 8
Location: Germany
no i was talking about if i write :

function x takes nothing returns boolean
return(_______)

------------------------------------------------------

is the same as i write
function x takes nothing returns boolean
return(_______)
endfunction

......
but after time ^^ and learning i just get it that the endfunktion is a needed
part of it so just forget it ^^ and THX

_________________
10 X =


Top
 Profile  
 
 Post subject:
PostPosted: March 16th, 2007, 2:15 am 
Offline
Forum Staff
User avatar

Joined: January 28th, 2007, 8:10 pm
Posts: 830
Location: Canada
Title: JASS Programmer
You need to have an endfunction because when the script compiles it will looks like this

function xxx takes nothing returns boolean
return(________)
function yyy takes nothing return nothing

And then the game doesn't know what to do with the function because it doesn't "end"

It's like trying to loop without putting an 'endloop' ...it just doesn't work O.o


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 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)