Hi. Got a question on a UI element I'd like to try out. I'm sure I can probably get an idea of how to do it if I scour through the documentation, but I thought it might go smoother if I just ask the knowledgeable LSF people first.
I'd like to create a menu window where the player can select an item (in this case, an outfit for their character). The idea being that there will be a preview window showing the image of the item in the middle, and buttons on either side that will allow the player to navigate forward or backward through the available options.
Here's a quick mock-up of what I'm thinking of.
Can anyone give me some ideas on how to go about creating this?
Thanks for your help!
Custom UI question: Item preview navigation
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: 34
- Joined: Wed Dec 26, 2018 10:45 am
- Contact:
Re: Custom UI question: Item preview navigation
The best way that come to my mind is to use a deque.
This is a broad prototype, not tested.
Code: Select all
init python:
from collections import deque
default dress =deque(["jacket","shirt","hat"])
screen select_dress():
hbox:
imagebutton auto "left_arrow_%s.png" action Function("dress_move",1)
$ datext = dress[0]
text "[datext]" # that should be changed with an imagebutton that do something...
imagebutton auto "right_arrow_%s.png" action Function("dress_move", -1)
init python:
def dress_move(x):
dress.rotate(x)
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
-
- Regular
- Posts: 34
- Joined: Wed Dec 26, 2018 10:45 am
- Contact:
Re: Custom UI question: Item preview navigation
Thanks! I'm totally unfamiliar with deque, but it looks fairly simple. I'll read up on it and give it a shot.
Update:
I'm running into a problem with the function. I get the error:
When I click on the arrow buttons I created. I tried a new project with exactly the code you provided (save for file name changes for the images), so I'm not sure where I went wrong.
Update 2:
Ah. I think I've got it. It worked when I removed the quotes in the Function() actions:
Update:
I'm running into a problem with the function. I get the error:
Code: Select all
TypeError: 'unicode' object is not callable
Update 2:
Ah. I think I've got it. It worked when I removed the quotes in the Function() actions:
Code: Select all
screen select_dress():
hbox:
imagebutton auto "left_arrow_%s.png" action Function(dress_move,1)
$ datext = dress[0]
text "[datext]" # that should be changed with an imagebutton that do something...
imagebutton auto "right_arrow_%s.png" action Function(dress_move, -1)
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]