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.
-
enzof2003
- Newbie
- Posts: 7
- Joined: Fri Nov 09, 2018 6:04 pm
-
Contact:
#1
Post
by enzof2003 » Mon Dec 03, 2018 6:45 am
Hello, i tried to get a tablet system working. Like you click on a power button to show the menu of the table inventory then you click back to show the menu same menu.
I'm having trouble to make a button that is from the inventory to go back to the tablet menu. Since both of them are menu, the Return action put me back in the game. I tried to use ShowMenu("tablet") but it didn't worked...
Any ideas ?
Here the codes for the tablet menu and the code for the inventory button return :
Code: Select all
screen tablet:
style_prefix "tablet"
add "tablet.png"
hbox:
vbox:
label "{font=halo.otf}{color=#00ff33}{size=+20}Data and body management device" xpos 330 ypos 50
imagebutton:
#Button to the inventory
idle "inve.png"
hover "inveB.png"
xpos 300
ypos 240
action Show("inventory_screen")
imagebutton:
#Button to the abilities
idle "stat.png"
hover "stat.png"
xpos 800
action Show("stats_screen")
label "{font=halo.otf}{color=#00ff33}Inventory management" xpos 255 ypos 40
label "{font=halo.otf}{color=#00ff33}Abilities management" xpos 770 ypos 9
label "{font=halo.otf}{color=#00ff33}{size=-5}Version 1.0" xpos 1100 ypos 120
textbutton "Turn off":
#Button to return to the game
action Return()
xpos 580
ypos 50
And for the button :
Code: Select all
textbutton "Return":
action Return()
xalign 0.5
yalign 0.95
Last edited by
enzof2003 on Tue Dec 04, 2018 3:14 am, edited 1 time in total.
-
rames44
- Veteran
- Posts: 232
- Joined: Sun May 29, 2016 4:38 pm
-
Contact:
#2
Post
by rames44 » Mon Dec 03, 2018 1:08 pm
What you might want to consider is adding a tag to your screen. When screens are tagged, only one of them will display at once. Thus, if your inventory screen, stats screen and tablet screen all share the same tag, then if you do Show(“tablet”) from the inventory or stats screen, it will remove the inventory or stats screen and replace it with the tablet screen.
Another alternative, since the inventory and stats screen should be shown on top of the tablet screen is just to have the “return to tablet” button use the Hide(“inventory_screen”) to remove the topmost screen and expose the table screen. I tend to like the former solution, as you don’t have to worry about UI elements lurking behind images still catching clicks, but it can depend on your game logic exactly how you’re writing things as to which is best.
-
enzof2003
- Newbie
- Posts: 7
- Joined: Fri Nov 09, 2018 6:04 pm
-
Contact:
#3
Post
by enzof2003 » Tue Dec 04, 2018 3:15 am
Thank you ! I used the Hide("inventory_screen") and it worked. The tag system seem harder to do than the Hide action. So for now it work

-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#4
Post
by Imperf3kt » Tue Dec 04, 2018 3:39 am
I used to use Hide(), but then I discovered the ToggleScreen() function. Perhaps it is more suited for you?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Users browsing this forum: Google [Bot], span4ev