Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
I want to make a blinking animated sprite, but instead of using a set amount of time between the times that it blinks, I was wondering if it was possible to have a random number generator determine how often they blink.
but it seems to always choose 3 seconds before replaying the animation.
Is there a better way to accomplish what I'm trying to do or am I just inputting the renpy.random wrong?
Last edited by lacrimoosa on Thu Dec 13, 2018 11:28 pm, edited 1 time in total.
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."
I cant comment at the moment about how to code this, but I felt it is worth mentioning that you may want to randomise between at least 1 and 3, instead of 0 and 3. Otherwise you could end up with something very out of place,, such as super slow blinking, where it seems the character will never blink (if randint gets 0 all the time, the blink will constantly try to play from the beginning, but never actually show because randint gets another 0 and tries to restart the animation) .
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Thank you, I had no idea that was a thing that could happen! That would've been a lil catastrophic.
unfortunately, with "renpy.random.randint(0, 3)", it still doesn't seem to change the time between animations
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."
Thank you! That was exactly what I was looking for!
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."
In your original code, I very strongly suspect that Ren’py only evaluated the call to random once - at the point where it processed the ATL logic and transformed it into the internal Python classes that it uses under the hood. In other words, when Ren’py tunes your rpy file into an rpyc file, it evaluated the random call at that point, got 3, and then proceeded as if you’d coded a 3 there. I’m betting this is exactly why ATL has the “choice” construct.
Yeah, that sounds about right. When I was testing out the original code, it would always choose 3 and I mean always. And while "choice" does get the job done in letting me have a set of variables for the code to pick from at random, I was originally hoping that I would be able to make the game choice it's own random number between a set of integers down the selecting random decimal points. For now, "choice" works, but if there's a way to do what I was trying to do with "renpy.random", then I would rather use that.
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."
Well, one way to do it would be a custom Displayable. https://www.renpy.org/doc/html/udd.html
You have pretty much complete control as to what’s displayed. This one would be a pretty simple one to code.
rames44 wrote: ↑Mon Dec 24, 2018 1:00 pm
Well, one way to do it would be a custom Displayable. https://www.renpy.org/doc/html/udd.html
You have pretty much complete control as to what’s displayed. This one would be a pretty simple one to code.
This looks a bit complicated for my python skills at the moment, but I'll have to try it when I learn a little more about object-oriented coding!
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."