• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Jass basic question

Status
Not open for further replies.
well i have some question regarding to this turtorial im reading ... i posted questions withing that thread/turtorial but no1 answered it lol so i decided to ask it here :3
im reading http://www.hiveworkshop.com/forums/...als-280/beginning-jass-tutorial-series-30765/
lesson 2

What is the difference between Local and Global variables?
-Local variables are variables only usable by the function they’re declared in. These are used for cleaning Memory Leaks (which will be explained later), neatening code, and making script Multi-instanceable.
-Globals are variables which can be accessed by any function, but can also be changed by any function. This can be bad for multi-instanceability (which will now be referred to as MUI), depending. MUI will be discussed later on.

i dont know wat *multi-instanceability* is ... does it mean exectue several actions at once? ... and what's the difference between actions and function? i mean they both perform ... an action. I'm kindda stuck on lesson 2 been reading it for couple hours and my brain hurts so i decided to ask :D

and im gonna list a few more questions i got
1)
How do I create a local variable?
-There are two ways to creating/setting a variable.
function variable_test takes nothing returns nothing
local unit u = CreateUnit()
endfunction
This method creates and sets it in one line, at the beginning of the function.
which of these is the variable? is it the *unit*? or is it the *u*? and what does it mean when u set *local unit u = createunit()*? does it mean there will be a unit created and this created unit's name is *u*? sorry i just never had a single programing class all my life

2)
function variable_test takes nothing returns nothing
local unit u
set u = CreateUnit(…..) //Creates a unit and sets the variable to it
endfunction
And this method creates a blank variable, to be set later on in the function.
uhm... whats this *…..*? is it the name of a unit (after u press ctr+d? cuz i didn't see any number or non-letter-symbols when i pressed ctr+d. like pally is Hpal)?

i have a lot more questions but plz answer these 1st so i can continue
ty
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
i dont know wat *multi-instanceability* is
When a trigger can be executed multiple times at once without it being bugged, it's multi-instanceable.
The most common use are MUI-spells, which can be cast by multiple units at the same time without it being bugged.

what's the difference between actions and function?
A function is a set of actions, when you write "function X takes nothing returns nothing" (for example), you initialise the function.
Inside that function, you add actions like "call BJDebugMsg("Test")".
As far as I know, though :p

which of these is the variable? is it the *unit*? or is it the *u*? and what does it mean when u set *local unit u = createunit()*? does it mean there will be a unit created and this created unit's name is *u*? sorry i just never had a single programing class all my life
It's the "u", I'll break it down for you:
local = the prefix of setting up a local variable, you need this to set up every local.
unit = variable type
u = variable name
Then you can use " = CreateUnit()" to create a unit immeadiately and set the variable u to it - this more efficient than using:
JASS:
local unit u
set u = CreateUnit()

Basically: it creates a local unit variable with the name "u" and sets it to a unit you create.

uhm... whats this *…..*? is it the name of a unit (after u press ctr+d? cuz i didn't see any number or non-letter-symbols when i pressed ctr+d. like pally is Hpal)?
No, the (....) is the data you need to use to create a unit.
You will need a location, a unit type, an angle (facing), a player and 2 reals.
In this order: (from Jass NewGen) player id, integer unitid, real x, real y, real face

I hope you get this :s
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
woo thx :3
but im sure i'll ask plenty more questions regarding this turtorial ... since i wanna make a campaign, and blizz got rid of the cache save trigger (which pissed me off) i decided 2 learn jass :D
Lol ^^
Sure, there are a lot of good jassers around here (not me, I just know a few basics :sad:), they'll help you :D (or try at least...).
It will take a while before you fully understand it, though.
 
It's the "u", I'll break it down for you:
local = the prefix of setting up a local variable, you need this to set up every local.
unit = variable type
u = variable name
Then you can use " = CreateUnit()" to create a unit immeadiately and set the variable u to it - this more efficient than using:
about the variable ... can i name it watever i want? like:
function X takes nothing returns nothing
local unit y <--- instead of u ?
etc ...
end function

because i can't tell what are *made up, as in u can call it watever u want* and what are fixed names (besides those with different color like local, set, etc)
 
Status
Not open for further replies.
Top