Default menuset not working as intended

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.
Post Reply
Message
Author
chesarty
Regular
Posts: 63
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Projects: Working on a dating sim, Lovesick!
Contact:

Default menuset not working as intended

#1 Post by chesarty » Sun Aug 25, 2019 11:28 am

I'm using the simple default menuset = set() code to make choices disappear from the menu once you've gone through them. I think it's creating some issues now, however.
When I get through the last option of the menu, it starts to loop that specific option. There is probably an easy solution to this, and I've done menus like this before with other types of code, but am struggling with the menuset one.

While we're on the subject, I also can't seem to be able to call labels from other script files? I think it's because of the menu issue but thought I'd mention it anyway.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 697
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Default menuset not working as intended

#2 Post by isobellesophia » Sun Aug 25, 2019 11:33 am

chesarty wrote:
Sun Aug 25, 2019 11:28 am
I'm using the simple default menuset = set() code to make choices disappear from the menu once you've gone through them. I think it's creating some issues now, however.
When I get through the last option of the menu, it starts to loop that specific option. There is probably an easy solution to this, and I've done menus like this before with other types of code, but am struggling with the menuset one.

While we're on the subject, I also can't seem to be able to call labels from other script files? I think it's because of the menu issue but thought I'd mention it anyway.
It will be great if you shows us the code, so we can exactly know what is the problem..

I am lazy to read so.. :)
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

chesarty
Regular
Posts: 63
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Projects: Working on a dating sim, Lovesick!
Contact:

Re: Default menuset not working as intended

#3 Post by chesarty » Sun Aug 25, 2019 11:38 am

isobellesophia wrote:
Sun Aug 25, 2019 11:33 am
chesarty wrote:
Sun Aug 25, 2019 11:28 am
I'm using the simple default menuset = set() code to make choices disappear from the menu once you've gone through them. I think it's creating some issues now, however.
When I get through the last option of the menu, it starts to loop that specific option. There is probably an easy solution to this, and I've done menus like this before with other types of code, but am struggling with the menuset one.

While we're on the subject, I also can't seem to be able to call labels from other script files? I think it's because of the menu issue but thought I'd mention it anyway.
It will be great if you shows us the code, so we can exactly know what is the problem..

I am lazy to read so.. :)
I didn't really know which code to show, ahah. There's nothing inherently wrong with the code, I was mainly just wondering if there was a line of code that would stop the default menuset from looping?

Anyway, here is the very basic menu code:

Code: Select all

menu choice1:
    set menuset
    you "Where should I go...?"
    
    "School building":
        jump explore_school_building
        
    "Dormitories":
        jump explore_dormitories
        
    "Coffee shop":
        jump explore_coffeeshop
        
    "School grounds":
        jump explore_yard
        
And every option ends with jump choice1, bringing the player back into the menu. I assumed that it would just continue the script no issue once it's gone through the list but nope, it loops.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 697
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Default menuset not working as intended

#4 Post by isobellesophia » Sun Aug 25, 2019 11:49 am

chesarty wrote:
Sun Aug 25, 2019 11:38 am
isobellesophia wrote:
Sun Aug 25, 2019 11:33 am
chesarty wrote:
Sun Aug 25, 2019 11:28 am
I'm using the simple default menuset = set() code to make choices disappear from the menu once you've gone through them. I think it's creating some issues now, however.
When I get through the last option of the menu, it starts to loop that specific option. There is probably an easy solution to this, and I've done menus like this before with other types of code, but am struggling with the menuset one.

While we're on the subject, I also can't seem to be able to call labels from other script files? I think it's because of the menu issue but thought I'd mention it anyway.
It will be great if you shows us the code, so we can exactly know what is the problem..

I am lazy to read so.. :)
I didn't really know which code to show, ahah. There's nothing inherently wrong with the code, I was mainly just wondering if there was a line of code that would stop the default menuset from looping?

Anyway, here is the very basic menu code:

Code: Select all

menu choice1:
    set menuset
    you "Where should I go...?"
    
    "School building":
        jump explore_school_building
        
    "Dormitories":
        jump explore_dormitories
        
    "Coffee shop":
        jump explore_coffeeshop
        
    "School grounds":
        jump explore_yard
        
And every option ends with jump choice1, bringing the player back into the menu. I assumed that it would just continue the script no issue once it's gone through the list but nope, it loops.
Well.. as i read it here.

https://www.renpy.org/doc/html/menus.html

Menuset is basically use ALL choices that has been listed each menu and thats gonna use it.
But of course, you need a label of those.

But maybe the reason why it was sent back to menu in loop because you didnt put
the

Code: Select all

label choice1_after
' extra label as it shown in the documentation.

Well, i dont really know about menusets so did my best to help you. >_O
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1299
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life, Coffea Beans
Github: namastaii
Skype: Discord: lunalucid#7684
Soundcloud: deadseed
itch: lunalucid
Location: USA
Contact:

Re: Default menuset not working as intended

#5 Post by namastaii » Sun Aug 25, 2019 1:40 pm

label choice_1_after I think is just a user defined example and isn't required for the menu and is simply a label. (I mean, I'm not really finding much documentation on menusets at all... it's very vague but I'm going to assume this isn't related to the current problem.

and your labels are defined just as the menu choices lead to?

label explore_school_building: (etc)
where are these .rpy files located? The ones with these labels.

chesarty
Regular
Posts: 63
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Projects: Working on a dating sim, Lovesick!
Contact:

Re: Default menuset not working as intended

#6 Post by chesarty » Mon Aug 26, 2019 4:14 am

namastaii wrote:
Sun Aug 25, 2019 1:40 pm
label choice_1_after I think is just a user defined example and isn't required for the menu and is simply a label. (I mean, I'm not really finding much documentation on menusets at all... it's very vague but I'm going to assume this isn't related to the current problem.

and your labels are defined just as the menu choices lead to?

label explore_school_building: (etc)
where are these .rpy files located? The ones with these labels.
yeah, everything is labelled correctly and the labels are all in the same script.rpy document so there should be no issue calling them :(

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Jake's Love Story, NEKOKORO
Projects: Courage for a Kiss
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Default menuset not working as intended

#7 Post by mikolajspy » Mon Aug 26, 2019 7:34 am

You can try in some part of the code (maybe at the end of each event or before the menu with small changes to labels, to make it cleaner):

Code: Select all

if len(menuset) == 4: #number of possibilities
    $menuset = set() #I guess you'd need to reset to 0 or use different variable set to use this trick somewhere else
    jump after_all_events #name of your label after events
else:
    jump choice1 #if menuset doesn't have enough length, go back to menu 
ImageImageImage

User avatar
Remix
Eileen-Class Veteran
Posts: 1312
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Default menuset not working as intended

#8 Post by Remix » Mon Aug 26, 2019 8:11 am

What are you doing After the menu? Does the script just run into the following label?

I'd suggest putting the menu actually inside a label (you can still jump back to it by name)...

Code: Select all

default chosen_choices = []

label start:

    menu choice1:

        set chosen_choices

        "Where should I go...?"
        
        "School building":
            jump explore_school_building
            
        "Dormitories":
            jump explore_dormitories
            
        "Coffee shop":
            jump explore_coffeeshop
            
        "School grounds":
            jump explore_yard

    "We are now past that looped menu... all choices chosen once... the script can continue"

    return

# Just a hack to avoid writing 4 labels...
define config.missing_label_callback = lambda x: "missing_label"

label missing_label:

    "You are doing something..."

    jump choice1
Mad Scientist Todo List:
  • Finish Improved Event Handler
  • Implement DragonBones animation as a Creator Defined Container
  • Develop Cartoon Speech Bubble dialogue
  • Finish Bitmask collision and rebound vector system
  • Develop time based building mechanic
  • Others
  • *Find a superb artist and actually write a game*

chesarty
Regular
Posts: 63
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Projects: Working on a dating sim, Lovesick!
Contact:

Re: Default menuset not working as intended

#9 Post by chesarty » Wed Aug 28, 2019 5:26 am

mikolajspy wrote:
Mon Aug 26, 2019 7:34 am
You can try in some part of the code (maybe at the end of each event or before the menu with small changes to labels, to make it cleaner):

Code: Select all

if len(menuset) == 4: #number of possibilities
    $menuset = set() #I guess you'd need to reset to 0 or use different variable set to use this trick somewhere else
    jump after_all_events #name of your label after events
else:
    jump choice1 #if menuset doesn't have enough length, go back to menu 
Yay, this worked! Thank you a bunch ^^

Post Reply

Who is online

Users browsing this forum: deltadidirac, Google [Bot]