Questions about variables

bane25

New Member
Reaction score
1
As far as I know, there are four types for variables: integer, real, boolean, and string. So, if I want to save a variable as a unit, or a group, which kind of variable should I use?

Thanks in advance.

And one more question: can you define a variable to be the value of a local variable?
(i.e. local integer d = 10
int value = d
Would this be a valid way to define the variable "value"?)
 

Rushhour

New Member
Reaction score
46
Yea you are right, these are the four "basic" variable types. But there are some more you can use, called handles. They are basically Integers (GetHandleId()) that point to a data structure. A unit exists of quite a lot strings, reals, integers and booleans..
To look them up take a look in the list of the variable editor. (though for example "locations" are called "points" there)
You only miss a "set", the rest is correct.
JASS:

or also valid:
JASS:
local unit u
set u=GetTriggerUnit()

Ok, you need to declare your variable "int" first somewhere. If it is a global variable made in the Variable-Editor it will be called udg_int . To get free global declaration get JassHelper ;)
 

bane25

New Member
Reaction score
1
And yet another question:
I have created the variables in the variable editor (select is a group, reciever is a unit).
Now: how do I declare them/use them?

(There has to be a guide for this somewhere, but the ones I've read so far were not helpful.)
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
In GUI, I don't know. In JASS, prefix it with udg_GlobalName.
 

LightChaosma

New Member
Reaction score
60
make a new action, press S, so you get to the "set variable" action

select the variable you wish to modify, and on the right side you enter the value the variable assumes
 

Sneakster

Active Member
Reaction score
24
Here's an example:

Trigger:
  • Variables
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set MyGroup = (Units in (Playable map area))


When the game reaches the 5 second mark, it will pick every unit in the map and put it in the "MyGroup" variable.

It only takes one action to set a unit or an integer or a string or whatever you want to a variable.

-Sneakster
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top