First case:
Code: Select all
renpy.random.random()
Code: Select all
renpy.random.randint(1, 100)
With this I'll have all I need about random... at least for now.
In addition, I've some unrelated questions, that I'll post here to save space:
Is there any way in Python to convert data-types? I tried to concatenate a string with a integer, and the engine crashed at my face (if it were more than a sequence of binary instructions running on my CPU, I'd say that it was angry ); so I guess the best way to do what I tried would be to convert the integer into a string, and then concatenate both strings.
Also, has python something like C/C++'s & php's sprintf()? This is, a function that formats a string, like in Python's print statement, but returning the resulting text instead of sending it to the screen. With that, I wouldn't need neither conversion nor concatenation I'd want it to get better presentation for the character sheet when it's shown to the user, like enconding the positively modified stats (attack improved by a special weapon, for example) in one color and negatively modified ones in another, and that kind of freaky features ^^
Thanks for all help in advance
PD: hmm... I bet Py'tom will be the first one to answer... will somebody be hastier?
PPD: Another question, about Python:
I have a list of objects instanced from the class Monster If I run the sort() method on it, which sorting criteria will be applied? I want it be sorted by a data member of the class, which is an integer named speed.