I would like to have a button that remains on the screen that says "Return to previous room" which is in the form of a ui.imagebutton. Basically, no matter where you are, even if there is text/dialogue on the screen, whenever you press the button, it will "Jump" to a different section/line of code depending on where the player currently is. So for example:
Player is in the bedroom. The previous room they entered was the bathroom.
I wanted the 'return to previous room' to be able to return the player to the bathroom when they click the button.
Is this possible to do in Ren'py? Can I just make one single python block that has the ui.imagebutton information for this skip button? or would I need to re-create a ui.imagebutton python block for every scene in the house in order for it to know which room the player entered last?
I hope this makes sense.
About ui.imagebutton
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.
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.
-
- Regular
- Posts: 121
- Joined: Thu Aug 12, 2010 11:47 am
- Contact:
- Aleema
- Lemma-Class Veteran
- Posts: 2677
- Joined: Fri May 23, 2008 2:11 pm
- Organization: happyB
- Tumblr: happybackwards
- Contact:
Re: About ui.imagebutton
If you want it to stay, you can make it an overlay, which is completely separate from the blocks you're writing in. Similar to showing a date on the screen, but just an imagebutton. You'd have to keep track of what the previous room was manually, though. I think. Unless it's very linear and predictable. But if there's two ways to get into a room, you'll probably need to set a variable like "previous_room" to equal the name of the label you want to jump to everytime your story progresses. And then set the ui.jumps(previous_room) to hold that variable. Make sure you put "global previous_room" under your overlay definition so it knows to look for that variable outside of itself.
Make sense, or no?
edit: here's what I mean:
Make sense, or no?
edit: here's what I mean:
Code: Select all
init:
$ previous_room = "labelname"
$ can_jump = True
python hide:
def room_jumper():
global previous_room
if can_jump:
ui.textbutton("Previous Room", clicked=ui.jumps(previous_room))
config.overlay_functions.append(room_jumper)
Last edited by Aleema on Thu Dec 09, 2010 5:23 pm, edited 1 time in total.
-
- Regular
- Posts: 121
- Joined: Thu Aug 12, 2010 11:47 am
- Contact:
Re: About ui.imagebutton
I think so. Thank you!
Who is online
Users browsing this forum: Milkymalk