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 need to set an image for the imagebutton using an image variable. I can't figure it out though. The renpy documentation doesn't show any example either. I think maybe it's not possible?
# I tried so many things, i know the following is commented out
# $ testAutoDeclaredThisWay = im.FactorScale("test_%s.png", 3)
image testIdle = im.FactorScale("test_idle.png", 2)
image testHover = "test_hover.png"
image testAuto = "test_%s.png"
screen pissed():
imagebutton:
# can someone explain the science behind using an image variable here?
# idle testIdle
# hover testHover
# auto testAuto
# testAutoDeclaredThisWay
# auto "[testAuto]"
focus_mask True
action Jump ("off a cliff ...")
screen gui_game_menu():
vbox xalign 1.0 yalign 1.0:
# is it not possible to use an image variable here?
imagebutton auto "save_%s.png" action ShowMenu('save')
imagebutton auto "prefs_%s.png" action ShowMenu('preferences')
imagebutton auto "skip_%s.png" action Skip()
imagebutton auto "afm_%s.png" action Preference("auto-forward mode", "toggle")
Last edited by henvu50 on Sat Jun 12, 2021 10:52 pm, edited 1 time in total.
image is just that. A concrete image, a single displayable which can be shown. image testAuto = "test_%s.png" makes no sense unless your OS supports having % in filenames.
auto property of imagebuttons does not take images or displayables unlike other properties. It takes a string with percentile substititution marker, interpolates different words instead of that marker and tries to resolve resulting strings as image names.
Ocelot wrote: ↑Sat Jun 12, 2021 2:44 amimage is just that. A concrete image, a single displayable which can be shown. image testAuto = "test_%s.png" makes no sense unless your OS supports having % in filenames.
auto property of imagebuttons does not take images or displayables unlike other properties. It takes a string with percentile substititution marker, interpolates different words instead of that marker and tries to resolve resulting strings as image names.