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.
screen conclusion:
vbox align (0.1, 0.5):
spacing 100
for e in list:
textbutton "[e.n]" action SetVariable('selecting', False), Jump(e.label) at conclusion_float(0, 300, renpy.random.randint(-15, 0))
And this shows up fine! The issue is when the player clicks, progresses, any interaction, and the 'random int' number will reset and move everything on screen to a new point. What I'd like it to do is only choose the position when the screen is shown, not reset every time the player does something. Is there a way to do this? Or a way to set each textbutton point at a different position so they're not all in a straight box?
Thank you for the reply! Unfortunately, this still comes up with the issue of the random int changing when the player clicks/progresses. And storing it in a variable like t in a label or in a screen makes it singular, and all the buttons have the same movements style rather than each of them acting independently.
transform conclusion_float(x, y, t):
subpixel True
xpos(renpy.random.randint(x, y))
pause t
parallel:
ease 3 yoffset 15
ease 3 yoffset -15
repeat
parallel:
ease 5 xoffset 30
ease 5 xoffset -30
repeat
screen conclusion:
default rints = [renpy.random.randint(-15, 0) for _ in lst]
vbox align (0.1, 0.5):
spacing 100
for i, e in enumerate(lst):
textbutton "[e.n]" action SetVariable('selecting', False), Jump(e.label) at conclusion_float(0, 300, rints[i])
I removed the ATL eventidle from your transform object. And then, in the screen, I pre-generated the random ints and assigned it to a screen variable rints.
Notice also that I'm using lst instead of list here. list is one of the reserved keywords in renpy.
enaielei wrote: ↑Sat Dec 02, 2023 4:19 am
I removed the ATL eventidle from your transform object. And then, in the screen, I pre-generated the random ints and assigned it to a screen variable rints.
Notice also that I'm using lst instead of list here. list is one of the reserved keywords in renpy.
Apologies for the late reply! But thank you for the new code. I tried using it, and it still is giving me the same results. However, I think I'm just misunderstanding the lst vs list variable you're using, and I assume that's the issue and I'm not doing it correctly? I went through the links with them and my brain just isn't connecting with what I need to do with it ._.
I tried using it, and it still is giving me the same results
I tested it against textbutton clicks, so aside from the floating texts I have somewhere in the screen a textbutton that just prints something to the console. Clicking the button didn't reposition the floating texts.
Also, I tested it against the save screen. Right clicking to access the save screen then coming back to the floating texts didn't reset the positions as well.
I think I'm just misunderstanding the lst vs list variable you're using
lst is just an example name. Use whatever name you want for your variables except those that are included in the reserved keywords list.
In short, just rename your variables to something that doesn't violate the reserved keywords.
enaielei wrote: ↑Wed Dec 06, 2023 7:05 pmlst is just an example name. Use whatever name you want for your variables except those that are included in the reserved keywords list.
In short, just rename your variables to something that doesn't violate the reserved keywords.
Ahh I definitely read that wrong then my bad! I'm not sure why I'm getting different results then
Mkay after a little more fiddling, I removed the other random ints and that fixed it and it looks pretty much the same as I was going for with your code too. tysm for your help!!