Select Menu
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: 65
- Joined: Tue May 23, 2017 1:08 pm
- Projects: VN 789
- Deviantart: bokuman
- Contact:
Select Menu
Hello,
I'm trying to make a select menu, for each arc story, like a megaman level screen, i need to save some data if you complete each arc to show on select menu(changing the color buton and changing the image tooltip) how i do to save this info? im using imageswap on select menu.
I'm trying to make a select menu, for each arc story, like a megaman level screen, i need to save some data if you complete each arc to show on select menu(changing the color buton and changing the image tooltip) how i do to save this info? im using imageswap on select menu.
- Amethysts
- Regular
- Posts: 41
- Joined: Thu Aug 23, 2018 1:17 pm
- Projects: Coalescence
- Skype: amethysts-studio
- itch: amethysts
- Contact:
Re: Select Menu
If you want to save data outside of the game (outside from the "saves" kinda), use this pattern:
It will be accessible from everywhere, and is equal to None by default (do not abuse of persistent variables).
Code: Select all
persistent.custom_variable = value
persistent.arc1 = "completed"
persistent.arc1_completed = True
Re: Select Menu
Seeing this answer actually makes me curious... if I have multiple characters in a game and you can choose which character's path to play... this method would then be a valid way to flag whether or not a particular character's path had been completed at the end of the game, right? So then I could check and see if they've finished all characters and show some sorta bonus "true ending" type thingy?
I've kinda been wondering about the best way to store completion data and this sounds like it... though the warning about abusing it does have me a little cautious. How much is too much use of the persistent variables?
I've kinda been wondering about the best way to store completion data and this sounds like it... though the warning about abusing it does have me a little cautious. How much is too much use of the persistent variables?
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3791
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Select Menu
Yes that's easily possible.Crazy Li wrote: ↑Tue Aug 06, 2019 8:00 pm Seeing this answer actually makes me curious... if I have multiple characters in a game and you can choose which character's path to play... this method would then be a valid way to flag whether or not a particular character's path had been completed at the end of the game, right? So then I could check and see if they've finished all characters and show some sorta bonus "true ending" type thingy?
A recent thread I commented in has an example of how to use persistent variables for unlocking things at the end of a route and checking if things are unlocked mid-game.
viewtopic.php?f=8&t=56406
It does require you have basic knowledge of screens and conditional statements, so if you aren't sure how to use it, just say and I can alter it to something a bit more beginner friendly.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Select Menu
Oh no, I've made my own screens tons of times. Really, just the small example in this thread on how to set persistent variables is kinda enough for me to figure out how to approach it for my own game with regards to tracking completed paths. Your example helps provide more context though, so thanks for that!Imperf3kt wrote: ↑Tue Aug 06, 2019 8:34 pmYes that's easily possible.Crazy Li wrote: ↑Tue Aug 06, 2019 8:00 pm Seeing this answer actually makes me curious... if I have multiple characters in a game and you can choose which character's path to play... this method would then be a valid way to flag whether or not a particular character's path had been completed at the end of the game, right? So then I could check and see if they've finished all characters and show some sorta bonus "true ending" type thingy?
A recent thread I commented in has an example of how to use persistent variables for unlocking things at the end of a route and checking if things are unlocked mid-game.
viewtopic.php?f=8&t=56406
It does require you have basic knowledge of screens and conditional statements, so if you aren't sure how to use it, just say and I can alter it to something a bit more beginner friendly.
-
- Regular
- Posts: 65
- Joined: Tue May 23, 2017 1:08 pm
- Projects: VN 789
- Deviantart: bokuman
- Contact:
Re: Select Menu
Not sure if is the thing that im searching... xD
im using this on my Select Charcter screen
and on my character script im using this on start.
this thing works? or i need other method? actually doesnt works...lol
im using this on my Select Charcter screen
Code: Select all
screen select:
tag menu
imagemap:
ground 'gui/imagemap_select_idle.jpg'
hover 'gui/imagemap_select_hover.jpg'
if $ cheelai_points >= 4:
hotspot (430, 33, 238, 213) action [Hide("image_float"), Jump('cheelai_chapter')] hovered [ Play ("test_one", "sfx/click.wav"), Show("image_float", my_picture="gui/cs_cheelai_clothes_A.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("image_float")]
if $ cheelai_points <= 1:
hotspot (430, 33, 238, 213) action [Hide("image_float"), Jump('cheelai_chapter')] hovered [ Play ("test_one", "sfx/click.wav"), Show("image_float", my_picture="gui/cs_cheelai_B.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("image_float")]
Code: Select all
label cheelai_chapter:
init:
$ cheelai_points = 0
menu:
"Haha, good joke.":
jump cheelaijokes
"I see...":
$ cheelai_points += 1
jump iseecheelaiisee
Re: Select Menu
Some tips:
- $-sign is used only at the very beginning of code line to show that it's a single line of python code.
- indentation do matters. The first line of code block ends with colon, and other lines of that block have an extra indentation (otherwise you'll get an error).
- code is run line by line in order it's writen (with exceptions) - viewtopic.php?f=51&t=39572#p422964
The 'init' block will be executed at init phase of game and not when player has reached the 'cheelai_chapter'.
- if you need to change the variable mid-game and properly store it, then use 'dafault' statement, 'cause everytime you run your game, variables in an init block are reset to their initial values.
instead of
https://www.renpy.org/doc/html/python.h ... -statement
https://www.renpy.org/doc/html/save_load_rollback.html
- append brackets after screen name when you create it - it's neccessary for best performance - https://www.renpy.org/doc/html/screen_optimization.html
- $-sign is used only at the very beginning of code line to show that it's a single line of python code.
Code: Select all
if cheelai_points >= 4:
Code: Select all
label cheelai_chapter:
menu:
"Haha, good joke.":
jump cheelaijokes
"I see...":
$ cheelai_points += 1
jump iseecheelaiisee
The 'init' block will be executed at init phase of game and not when player has reached the 'cheelai_chapter'.
Code: Select all
label cheelai_chapter:
"blah-blah"
init:
$ cheelai_points = 0
Code: Select all
default cheelai_points = 0
Code: Select all
init:
$ cheelai_points = 0
https://www.renpy.org/doc/html/save_load_rollback.html
- append brackets after screen name when you create it - it's neccessary for best performance - https://www.renpy.org/doc/html/screen_optimization.html
Code: Select all
screen select():
-
- Regular
- Posts: 65
- Joined: Tue May 23, 2017 1:08 pm
- Projects: VN 789
- Deviantart: bokuman
- Contact:
Re: Select Menu
oh! thanks! i did all changes and is working, but i noted that when i back to select screen, the button is blocked, or doesnt works now, cheelai_points = 0 on this point, but when is 30 the image shows correctly.
im using this code.
im using this code.
Code: Select all
screen select():
tag menu
imagemap:
ground 'gui/imagemap_select_idle.jpg'
hover 'gui/imagemap_select_hover.jpg'
if cheelai_points <= 0:
hotspot (430, 33, 238, 213) action [Hide("image_float"), Jump('cheelai_chapter')] hovered [ Play ("test_one", "sfx/click.wav"), Show("image_float", my_picture="gui/cs_cheelai_clothes.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("image_float")]
if cheelai_points >= 30:
hotspot (430, 33, 238, 213) action [Hide("image_float"), Jump('cheelai_chapter')] hovered [ Play ("test_one", "sfx/click.wav"), Show("image_float", my_picture="gui/cs_cheelai_clothes_b.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("image_float")]
Re: Select Menu
Try it like
Code: Select all
if cheelai_points < 1:
...
elif cheelai_points >= 30:
....
else:
hotspot (430, 33, 238, 213) action NullAction()
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot]