- Messages
- 5,093
- Reaction score
- 2,881
- Points
- 1,103
Hello
This is another basic tutorial I wanted to make. This one is about numbers and math functions.
In cod you can use 2 kinds of numbers, "int"s and "float"s. "Int"s are entire numbers ( 2, 3, 50, 1000, 45 ... ) and "float"s are decimal numbers ( 1.1, 4.324, 6.67, 3.141592 ... ). If you have for example the number 5.31 you can do some operations with it, like:
The game also has some interesting functions relationed with "Int"s and "Float"s which give you random numbers, they are this 4:
Lets put some real examples with them:
Also the game allows you to use some basic operations such as: divisions, multiplications..... They work like this with real examples ( I recommend doing operations with pathenthesys: "( )" ):
Well, thats it, if you dont know what is mathematic operation -> Google it
Thanks for reading, @CabCon. Credits goes to Yamato.
This is another basic tutorial I wanted to make. This one is about numbers and math functions.
In cod you can use 2 kinds of numbers, "int"s and "float"s. "Int"s are entire numbers ( 2, 3, 50, 1000, 45 ... ) and "float"s are decimal numbers ( 1.1, 4.324, 6.67, 3.141592 ... ). If you have for example the number 5.31 you can do some operations with it, like:
Code:
Int( 5.31 ) //will return 5
Floor( 5.31 ) //will return 5 ( aproximation to down )
Ceil( 5.31 ) //will return 6 ( aproximation to up )
The game also has some interesting functions relationed with "Int"s and "Float"s which give you random numbers, they are this 4:
Code:
randomInt( number )
randomIntRange( number 1, number 2 )
randomFloat( number )
randomFloatRange( number 1, number 2 )
Lets put some real examples with them:
Code:
luckynumber = randomInt( 6 ); //will give a random number beetween 0 and 6
wait ( randomFloatRange( 3, 6 ) ); //will wait a random ammount of time beetween 3 and 6 seconds, the times will probably be decimal numbers
tutorialnumber = randomIntRange( 1, 50 ); //random number beetween 1 and 50
wait ( randomFloat( 2 ) ); //will give you a random number beetween 0 and 2
Also the game allows you to use some basic operations such as: divisions, multiplications..... They work like this with real examples ( I recommend doing operations with pathenthesys: "( )" ):
Code:
plus = ( 3 + 15 ); // 18
minus = ( 100 - 30 ); // 70
multiplied = ( 2 * 2 ); // 4
divided = ( 100 / 20 ); // 5
moduled = ( 10 % 3 ); // 1, is the leftover of doing a division: 10 / 3 = 3, but there is one 1 missing, thats the module.
nepperlog = log( 1 ); // 0, is the natural logarithm ( Nepper one )
cosine = cos( 0 ); // 1, cosine, trigonometrical function
sine = sin( 90 ); // 1, sine, trigonometrical function
tangent = tan( 45 ); // 1, tangent, trigonometrical function
arcosine = asin( 1 ); // 90, arco sine, trigonometrical function
arcocosine = acos( 1 ); // 0, arco cosine, trigonometrical function
arcotangent = atan( 1 ); // 45, arco tangent, trigonometrical function
absolutevalue = abs( -3 ); // 3, if the number is lower than 0, it returns that number multiplied by -1
squareroot = sqrt( 4 ); // 2, square root
whatonebigger = max( 3, 9 ); //9, 9 is bigger than 3
whatonesmaller = min( 2, 6 ); //2, 2 is smaller than 6
Well, thats it, if you dont know what is mathematic operation -> Google it
Thanks for reading, @CabCon. Credits goes to Yamato.