# Data Types
Variables come in different types, playing by different rules.
# Booleans (True or False values)
A boolean value is
is_on_fire = true or
weapon_held = false.
! operator inverts a boolean between true and false.
is_toggled = not is_toggled would switch between true and false.
You can combine booleans, described below.
# Variable Comparison
You can compare any variables for equality, which returns a boolean value.
==means "are equal?"
2 == 3is
!=means "are not equal?"
2 != 3is
!means the same as
!=means 'not equal')
People sometimes compare booleans with
false. That's silly.
is_active == true means the same
is_active == false means the same as
Numbers have more operators,
<=, described below.
if statements use variable comparison extensively.
# Logical Operators
You can combine booleans with logical operators
can_use_fireball = fireball_ready == state_cat != SC_HITSTUN bomb_should_explode = fuse_timer <= 0 or should_die
You can technically use
true respectively. Don't. It makes the intention of the
code much less clear, because the reader must guess whether the value is a boolean or number. If a value is true or false, use
# Reals (Numbers)
Most variables hold numbers, such as speed or percent or x position.
You can also compare numbers by their relative size.
>- 'is greater than?'
>=- 'is greater than or equal to?
<- 'is less than?',
<=- 'is less than or equal to?'
Numbers can use math operators
When increasing or decreasing a variable, you can use
/= as a shortcut.
x += 1 increases x 1,
the same as
x = x+1.
my_var-- are shorthand for
All numbers are reals. Integers are a subset of reals with no decimal value.
4140 are integers,
2.5 is not.
Rivals expects some variables to be integers, such as
y positions. If you ever need to convert a real to an
integer, you can
use rounding functions (opens new window)
# Strings (text)
Strings are text. Rivals doesn't need a lot of text processing, but they're used when using
String value are anything between quotes, either single
'...' or double
You can add strings together with
"a" + "b" == "ab".