Understanding SS13 code: Difference between revisions

Jump to navigation Jump to search
imported>Errorage
(1 revision)
imported>Cheridan
(6 intermediate revisions by 2 users not shown)
Line 62: Line 62:
   var/a = list()
   var/a = list()


==== Other types ====
==== Other Types ====


If you wish to store a coin in somewhere in the variables of an object and use the coin's defined procs or variables, you'll have to define the variable in which you store the coin as a coin. The second example also creates a variable called D and fills it with a new coin.
If you wish to store a coin in somewhere in the variables of an object and use the coin's defined procs or variables, you'll have to define the variable in which you store the coin as a coin. The second example also creates a variable called D and sets it to a new coin.
   var/obj/item/weapon/coin/C
   var/obj/item/weapon/coin/C
   var/obj/item/weapon/coin/D = new/var/obj/item/weapon/coin(src)
   var/obj/item/weapon/coin/D = new/var/obj/item/weapon/coin(src)
Line 88: Line 88:
'''Southwest:''' 10 (2 + 8)<br>
'''Southwest:''' 10 (2 + 8)<br>


They are numbered like this because dir uses the 'bitflag' methodology. It is defined in binary, so...
They are numbered like this because dir uses the 'bitflag' methodology. You can read more about bitflags [[Binary_flags|here.]]  It is defined in binary, so...


'''0001''' is north<br>
'''0001''' is north<br>
Line 141: Line 141:
The double == is used to compare two values. It's most commonly used in the if statement. In the example above you can see we compared the variable a to 14 (a == 14). This determines how the if will react.
The double == is used to compare two values. It's most commonly used in the if statement. In the example above you can see we compared the variable a to 14 (a == 14). This determines how the if will react.


==== If statement ====
Comparison Operators
[http://www.byond.com/members/?command=reference&path=proc%2Fif reference]
[http://www.byond.com/members/?command=reference&path=proc%2Fif reference]


Line 147: Line 147:


Comparison operators include:
Comparison operators include:
<br>'''==''' Equals
<br>'''==''' Is Equal To
<br>'''!=''' Not Equals
<br>'''!=''' Is Not Equal To
<br>'''<''' Less than
<br>'''<''' Less than
<br>'''>''' More than
<br>'''>''' More than
Anonymous user

Navigation menu