Page 1 of 1

Default menuset not working as intended

Posted: Sun Aug 25, 2019 11:28 am
by chesarty
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.

Re: Default menuset not working as intended

Posted: Sun Aug 25, 2019 11:33 am
by isobellesophia
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.. :)

Re: Default menuset not working as intended

Posted: Sun Aug 25, 2019 11:38 am
by chesarty
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.

Re: Default menuset not working as intended

Posted: Sun Aug 25, 2019 11:49 am
by isobellesophia
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

Re: Default menuset not working as intended

Posted: Sun Aug 25, 2019 1:40 pm
by namastaii
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.

Re: Default menuset not working as intended

Posted: Mon Aug 26, 2019 4:14 am
by chesarty
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 :(

Re: Default menuset not working as intended

Posted: Mon Aug 26, 2019 7:34 am
by mikolajspy
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 

Re: Default menuset not working as intended

Posted: Mon Aug 26, 2019 8:11 am
by Remix
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

Re: Default menuset not working as intended

Posted: Wed Aug 28, 2019 5:26 am
by chesarty
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 ^^