- Jun 11, 2017
- 93
- 175
So, I'm making a simple game to try and nail down the basics of coding for myself and I've run across a weird question that is beyond my current knowledge.
I've got a whole bunch of screens set up that let me jump from one to the next in ren'py via image buttons. All the images are codified for easy processing/linking, and it works without issue so far. (For reference, the code I'm using is (for example because you don't need the filenames -)
screen ImageAAA1AA:
imagebutton auto "images/Image/ButtonImage/Image_Image_%s.png" xpos 810 ypos 425 action [Show("ImageAAA1AB"), ToggleScreen("ImageAAA1AA")]
It's working great. What I'm wondering though, is, as you might have noticed - the 4th digit in the file names is indeed a number.
I'm wondering if it's possible to create an imagebutton that can stay on screen, and will just change that 1 to a 2, regardless of which screen is currently called, so that it will change the destination of the image button you currently see.
For example, I'm hoping it would be:
"Press this imagebutton"
action[Show("imageAAA1AA")} - becomes action[(show("imageAAA2AA")]
And then with the same unaltered "Press this imagebutton" hypothetical code, it could also cause:
action {Show("ABC1AA")] to become action[Show("ABC2AA")]
without having to program individual buttons for every screen. (Which is fine, just time consuming so I'm hoping for this kind of a shortcut.)
I haven't tried it yet, but I'm assuming I might be able to define 1 = 1 and then have the "Press this imagebutton" be $ 1 = 2 ?
Any help or insight would be great, I'm still hella new to coding.
I've got a whole bunch of screens set up that let me jump from one to the next in ren'py via image buttons. All the images are codified for easy processing/linking, and it works without issue so far. (For reference, the code I'm using is (for example because you don't need the filenames -)
screen ImageAAA1AA:
imagebutton auto "images/Image/ButtonImage/Image_Image_%s.png" xpos 810 ypos 425 action [Show("ImageAAA1AB"), ToggleScreen("ImageAAA1AA")]
It's working great. What I'm wondering though, is, as you might have noticed - the 4th digit in the file names is indeed a number.
I'm wondering if it's possible to create an imagebutton that can stay on screen, and will just change that 1 to a 2, regardless of which screen is currently called, so that it will change the destination of the image button you currently see.
For example, I'm hoping it would be:
"Press this imagebutton"
action[Show("imageAAA1AA")} - becomes action[(show("imageAAA2AA")]
And then with the same unaltered "Press this imagebutton" hypothetical code, it could also cause:
action {Show("ABC1AA")] to become action[Show("ABC2AA")]
without having to program individual buttons for every screen. (Which is fine, just time consuming so I'm hoping for this kind of a shortcut.)
I haven't tried it yet, but I'm assuming I might be able to define 1 = 1 and then have the "Press this imagebutton" be $ 1 = 2 ?
Any help or insight would be great, I'm still hella new to coding.