- Jun 21, 2020
- 67
- 86
Edit. Solution (or at least one approach to it):
Ok, so first of all let me clarify: I am new to renpy, but not to python. So I mostly have trouble with the renpy side of the code.
Having said that: what I want is to create a minimap of a house that allows the user to click on a room of that house and display the image of that room (meaning the user traveled there). Now the good news is that I managed to pull that off with a little help of renpy documentation (and mostly python code).
Here's the main code, where I call the minimap, and whatever it returns (when I click on a minimap room it returns the name of a location and) its room image appears.
The problem arises now that I want to create yet another way of moving: a room selector (basically two arrows pointing left and right that change the current room)
I don't really need help with the logic of how to achieve the selector, but instead I need help with how to have both the minimap AND the selector working at the same time (being able to click one or the other and changing rooms), since now, I can't have the two $ location = renpy.call_screen() at the same time, the code stops to get the first location and then shows the selector.
Thanks in advance, any kind of help is appreciated... even a nudge in the right direction.
PS. I'm guessing there should be a better way to read a minimap (or any kind of UI) input that doesn't require for the code to "stop" to get that info. If you know of any better way to do this, please let me know. Thanks!
=========[...]
Ok, so first of all let me clarify: I am new to renpy, but not to python. So I mostly have trouble with the renpy side of the code.
Having said that: what I want is to create a minimap of a house that allows the user to click on a room of that house and display the image of that room (meaning the user traveled there). Now the good news is that I managed to pull that off with a little help of renpy documentation (and mostly python code).
Here's the main code, where I call the minimap, and whatever it returns (when I click on a minimap room it returns the name of a location and) its room image appears.
Python:
$ game_running = True
while game_running:
python: # this is just validation that gets the room name used in the image url
location_img_string = location.lower()
location_img_string = location_img_string.replace("'s", "")
location_img_string = location_img_string.replace(" ", "_")
if renpy.has_image(location_url_string, exact=True):
show expression location_url_string # shows the room image using that validate string
$ location = renpy.call_screen("minimap") # and here I call the screen with the minimap (an image with imagebuttons that each return a string containing the room name)
Python:
$ location = renpy.call_screen("room_selector") # this obviously doesn't work
Thanks in advance, any kind of help is appreciated... even a nudge in the right direction.
PS. I'm guessing there should be a better way to read a minimap (or any kind of UI) input that doesn't require for the code to "stop" to get that info. If you know of any better way to do this, please let me know. Thanks!
Last edited: