Page 1 of 1

How to use Random on Variables

Posted: Sat Jan 28, 2017 11:18 pm
by neometalero
I want to know how can I create a random between 1 and 10 for example to use on a variable.

Re: How to use Random on Variables

Posted: Sun Jan 29, 2017 12:14 am
by Onomatopoeia
Hello, new friend! You'd use the 'random' code for that. The exact code to use would be:

Code: Select all

renpy.random.randint(1, 10)
It may do you well to check out the 'Other Functions' documentation (https://www.renpy.org/doc/html/other.html), there are all sorts of fun codes on that page. Random is located at the very bottom.

Re: How to use Random on Variables

Posted: Sat Feb 04, 2017 7:04 pm
by neometalero
Onomatopoeia wrote:Hello, new friend! You'd use the 'random' code for that. The exact code to use would be:

Code: Select all

renpy.random.randint(1, 10)
It may do you well to check out the 'Other Functions' documentation (https://www.renpy.org/doc/html/other.html), there are all sorts of fun codes on that page. Random is located at the very bottom.
Tks a lot, I will read that. If I want to store this random variable for future use would be something like this?

Code: Select all

$ d10roll = renpy.random.randint(1,10) 
being d10roll the variable where the number get stored right?