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.
Greetings everyone. I've run into a problem where I tried to position an image with its xpos/ypos as an absolute value. Shown below is the code of the image.
Running said code results in an "AttributeError: 'module' object has no attribute 'absolute'" error whenever the script reaches the show bg2-desert line. I have tried replacing absolute(x.x) with renpy.absolute(x.x) or even simply put in 658.35 as the ypos but to no avail. Either it displays the error or the image does not display at all. I'd very much appreciate it if someone could help me out.
Last edited by theyeeguy on Sat Sep 25, 2021 3:36 pm, edited 1 time in total.
Adding to what Imperf3kt said, integers as values in properties mean you're positioning it by pixels while floats as values mean you're positioning it relative to the parent. https://www.renpy.org/doc/html/style_pr ... rty-values
Also, you're probably talking about the built-in function abs().
What about when I'm positioning it as an absolute type? Is there any way to specify that I'm trying to position my image 658.3458 subpixel in the y axis? I might be understanding it wrong but that's what I got from reading this in the position section.
absolute (like absolute(100.25))
An absolute number is interpreted as the number of pixels from the left or top side of the screen, when using subpixel-precise rendering.
I have also tried removing the xanchor and yanchor while changing absolute(x.xx) to abs(x.xx) so as to avoid any conflict errors. Error disappeared but the image is not rendering at all.
image test:
"bg_001_01"
anchor (0,0)
xpos absolute(100.5)
ypos absolute(0.0)
label start:
show test
"test"
return
Check if you have absolute replaced somewhere in script maybe. Another option, delete lines with absolute and type them again, maybe some weird character got there somehow, once spent hour or so trying to debug error while it was just different language symbol camping inside english word
image test:
"bg_001_01"
anchor (0,0)
xpos absolute(100.5)
ypos absolute(0.0)
label start:
show test
"test"
return
Check if you have absolute replaced somewhere in script maybe. Another option, delete lines with absolute and type them again, maybe some weird character got there somehow, once spent hour or so trying to debug error while it was just different language symbol camping inside english word
Thank you very much! This also worked for me. I was actually beginning to contemplate on trying to design my drafts around int x and y positions (which would lead to some problems down the road) so I just want you to know you're a godsend. Cheers!
I'm guessing it was the anchor (0,0) that did it, which is odd because my initial code had each anchors in int, and subsequent debugging had me remove it altogether. Both should technically have the default int 0 as its anchor values.