Page 1 of 1

What is the syntax for multiply and divide?

Posted: February 17th, 2010, 5:09 am
by Venima
New question: I've tried doing

Number1 = (* $Number1 4)

or Number1 = (/ $Number1 2)

it doesn't recognise the syntax. Can I have the symbols for multiply and divide? Also, what language does sandbox use? Maybe that would help if I come across anything else syntax related.



Old question: Say I want to make you play a guessing game with an npc, and you have to guess the right number. How can I make the right number be random? Just looking for the syntax

Re: How do I create a randomly generated number?

Posted: February 17th, 2010, 7:59 am
by Hirato
rnd x will return a pseudo-random number between 0 and x - 1

the functionality is used in a great many places

Re: How do I create a randomly generated number?

Posted: February 17th, 2010, 12:57 pm
by Venima
so for example I could do:

chosen_number = rnd 4 (the range being 0 to 3)
or
chosen_number = (+ $chosen_number rnd 4)

right?

Re: What is the syntax for multiply and divide?

Posted: February 18th, 2010, 5:30 am
by Venima
New question

Re: How do I create a randomly generated number?

Posted: February 18th, 2010, 8:06 am
by Venima
Hirato wrote:rnd x will return a pseudo-random number between 0 and x - 1

the functionality is used in a great many places
Ok for anyone else reading this you have to put rnd x withing brackets e.g. (rnd 10)