Home   Help Search Login Register  

Author Topic: (=) Plz explain this someone?  (Read 597 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
(=) Plz explain this someone?
« on: 17 Sep 2005, 15:08:39 »
Hey everyone, I'm confused of what the equals sign does. (=).
Can some one inform me on it's meaning and what it does and how I could possibly use it in mission editing? Thanks.
Who's hyped for Arma4, long live Arma!

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:(=) Plz explain this someone?
« Reply #1 on: 17 Sep 2005, 15:17:36 »
The '=' sign is used to declare a value for a variable or to initialise a variable.

For Example:

_bulletsleft = 20

This would give the local variable '_bulletsleft' the value of 20.


The double '==' is used to check if one value or variable is equal to another value or variable.

For Example:

_bulletsleft == 20

This checks to see if the variable _bulletsleft is equal to 20.
This would be used in combination with an IF statement or in a condition line in the editor


Try not to mix them up.  8)


Planck
« Last Edit: 17 Sep 2005, 15:18:35 by Planck »
I know a little about a lot, and a lot about a little.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re:(=) Plz explain this someone?
« Reply #2 on: 17 Sep 2005, 15:20:16 »
Okay then, since I know what that means, it gives a value to a variable, but another question, what is a variable?
Who's hyped for Arma4, long live Arma!

bored_onion

  • Guest
Re:(=) Plz explain this someone?
« Reply #3 on: 17 Sep 2005, 15:21:50 »
Equals

just like in maths the equals sign refers simply to the fact that the things either side of it are of the same value. in editing, it has a number of different purposes depending on what you want to do. you may want to make a certain value equal to 1 when something happens. in this case you would put:

Code: [Select]
value=1
and then you could check that this was the case (and that therefore the trigger depending on certain things was activated) using:

Code: [Select]
?value==1
you can also use equals to do various bits of maths in scripts. the use of maths in scripts is variable depending on what you want to do (such as trig, randomisation etc) and you will im sure encounter these things. basically, this sign is used just as in maths except that flashpoint only uses it within certain conventions which you need to learn.

Variables

OK so ignore the above and read Planck's thing. he knows more than i do.

as for a variable, it is simply a number whose value can change. if you were checking damage then you might put:

Code: [Select]
_damage = getdammage _unit

_damage = _damage +1

in this example, _damage is the variable. the underscore relates to the variable being "private" (i.e. only used in the script). without it, it is "global" (i.e true for the whole mission)
« Last Edit: 17 Sep 2005, 15:28:48 by bored_onion »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:(=) Plz explain this someone?
« Reply #4 on: 17 Sep 2005, 18:50:34 »
not quite correct onion, a varible doesn't need to be a number
it can be a number, or a string,or a boolean, or a unit...pretty much anything you use in scripting