Expressions

This list is created based upon game maker 5.2. It could be that new commands are added or commands changed in the future. Here is a list of some of the math functions within Game maker.

 

Boolean functions

 

&&, and

Means that both this statement and the next statement must be true in order to continue. For example:

 

if statement_a && statement_b then

{

//do this code

}

 

The code will only be executed if both statement a and statement b are true. In a table it looks like:

 

Statement A

Statement B

End result

True

False

False

False

True

False

False

False

False

True

True

True

 

 

||, or

Means that if at least one statement is true the code will be executed.

 

if statement_a || statement_b then

{

//do this code

}

 

So the code will be executed unless both statements are false. In a table:

 

Statement A

Statement B

End result

True

False

True

False

True

True

False

False

False

True

True

True

 

 

^^, xor        

Means that if at least one statement is true the code will be executed unless both statements are true.

 

if statement_a ^^ statement_b then

{

//do this code

}

 

So the code will be executed unless both statements are false or both are true. In a table:

 

Statement A

Statement B

End result

True

False

True

False

True

True

False

False

False

True

True

False

 

--oOo--

 

Comparisons

 

=, ==

Result in true (1) or false (0). This means that both this statement and the next statement must be equal in order to continue. For example:

 

if number_a == number_b then

{

//do this code

}

 

The code will only be executed if both numbers are equal. So if number_a is 5 and number_b is 5 it will result in true and the code will be executed. But if number_b is not equal to number_a it will not be true and not be executed.

 

!=

Result in true (1) or false (0). This means that this statement must not be equal to the next statement For example:

 

if number_a != number_b then

{

//do this code

}

 

The code will only be executed if number_a is not equal to number_b. So if number_a is 5 and number_b is 5 it will result in false while with any value of number_b besides 5 it will be true.

 

<

Result in true (1) or false (0). This means that the first number must be smaller than the second number in order for this function to return true. In all other cases it will return false

 

if number_a < number_b then

{

//do this code

}

 

For instance we assume that number_a = 5 then you will have:

 

number_a

number_b

result

5

4

False

5

5

False

5

6

True

 

<=

Result in true (1) or false (0). This means that the first number must be smaller or equal to the second number in order for this function to return true. Else it will return false

 

if number_a <= number_b then

{

//do this code

}

 

For instance we assume that number_a = 5 then you will have:

 

number_a

number_b

result

5

4

False

5

5

True

5

6

True

 

>

Result in true (1) or false (0). This means that the first number must be larger than the second number in order for this function to return true. Else it will return false

 

if number_a > number_b then

{

//do this code

}

 

For instance we assume that number_a = 5 then you will have:

 

number_a

number_b

result

5

4

True

5

5

False

5

6

False

 

>=

Result in true (1) or false (0). This means that the first number must be larger or equal to the second number in order for this function to return true. Else it will return false

 

if number_a >= number_b then

{

//do this code

}

 

For instance we assume that number_a = 5 then you will have:

 

number_a

number_b

result

5

4

True

5

5

True

5

6

False

 

--oOo--

 

Other

 

+

Addition

+ will return the number of the value before the sign plus the value behind the sign.

 

-

Subtraction

- will return the number of the value before the sign minus the value behind the sign.

 

*

Multiplication

* will return the number of the value before the sign multiplied by the value behind the sign.

 

/

Division

/ will return the number of the value before the sign divided by the value behind the sign.

 

div

Integer division

(a)div(b) will return the value a/b rounded down to the nearest integer. So 9/2=4.5 rounded down will give 4.

 

mod

Modulo

(a)mod(b) will return the number that stays over when dividing a number. For instance when dividing 9 by 2 you'll notice that 2 goes into nine 4 times, with 1 left over. Mod will return 1 since you still have 1 left which you can't divide. So (580)mod(360) result in 220.

 

Simon Donkers - Revision #2