Hybrid Choices: Menus inside a menu?

Hi again. I had another problem with this library. I want to make a menu that shows me another sub-menu. Example:

Menu is a page.
“This is the main menu”

OptionA is a page.
The cdesc is “Option A”. It is for Menu.
A page-toggle rule for OptionA:
say “Choose between option 1 or 2”;

Option1 is a page.
The cdesc is “Option 1” It is for OptionA.
A page-toggle rule for Option1:
say “You have chosen Option 1”;

Option2 is a page.
The cdesc is “Option 2”. It is for OptionA.
A page-toggle rule for Oprion2:
say “You have chosen Option 2”;

It can be a little confusing, but I hope you understand. The problem is that when I choose “Option A” in the main menu, I want it to show me a sub-menu that contains the “Option 1” and “Option 2” pages. However, it doesn’t do that. Instead of showing me the text and the sub-menu, it shows me the output lines of both “Option 1” and “Option 2” pages.

I’m not sure I understand why you’re using page-toggle rules to show text when you can just do it on the page. Does this work for you?

[code]Include Hybrid Choices by Aw Freyr.

Lab is a room.

The catalog is in lab.

Instead of doing anything to catalog:
switch to CYOA at TOC.

TOC is a page. “This is the table of contents. Choose Submenu A or B.”

SubMenuA is a page. “Choose between A1 or A2.”. The cdesc is “Turn to submenu A.” It is for TOC.

SubMenuB is a page. “Choose between B1 or B2.”. The cdesc is “Turn to submenu B.” It is for TOC.

Choice A1 is a page. “You have chosen A1.”. The cdesc is “A1”. It is for SubmenuA. It is an end-page.

Choice A2 is a page. “You have chosen A2.”. The cdesc is “A2”. It is for SubmenuA. It is an end-page.

Choice B1 is a page. “You have chosen B1.”. The cdesc is “B1”. It is for SubmenuB. It is an end-page.

Choice B2 is a page. “You have chosen B2.”. The cdesc is “B2”. It is for SubmenuB. It is an end-page.

Return is a page. It flips to TOC. The cdesc is “Return to the table of contents.”. It is for SubMenuA. It is for SubMenuB. [/code]

Yes, it works. I found that the problem is because I use page-toggle rules on the sub-menus. But the reason I use the page-toggle rule is because it lets me change variables, locations and other things. Like:

Option2 is a page.
The cdesc is “Option 2”. It is for OptionA.
A page-toggle rule for Oprion2:
say “You have chosen Option 2”;
now the player is in Xroom;
now variablex is 34;

I don’t know how to make a sub-menu WITH all the controls that the page-toggle rule allows me.

I think page-toggle rules are intended to move stuff around silently - sort of the same role as the Carry Out rulebooks. Remember that choice-mode is another paradigm entirely which bypasses a lot of the normal rules, and page-toggle lets you get at them temporarily. But the whole point of HC is to let you create a menu-tree. You can have multiple rules that apply to the same page - even multiple page-toggle rules if that is how you want to structure it. But a page will print out it’s “room description” whenever the player hits it. Here’s how I’d do what you listed there:

[code]
Option2 is a page. “You have chosen Option 2.”. The cdesc is “Option 2”. It is for OptionA.

A page-toggle rule for Oprion2:
cyoa teleport to Xroom;
now variablex is 34;[/code]
I’m not sure if your “now the player is in” statement was causing a problems, but you should use cyoa teleport in choice mode.

That’s why I saw the room’s description twice. Jeje… I just typed “clear the screen” at the end of the page-toggle rule.
So, if I wanted a page inside a menu, that shows me a text, change a variable value and then show me another menu. How would I typed it. Because I can’t find a way to do it. Let me use your example, I modify it so you can see what I’m trying to do.

[code]
Include Hybrid Choices by Aw Freyr.

Lab is a room.

The catalog is in lab.

Instead of doing anything to catalog:
switch to CYOA at TOC.

TOC is a page. “This is the table of contents. Choose Submenu A or B.”

SubMenuA is a page. “Here would be long text. It’s like a big scene with a ‘wait for any key’ and a ‘clear screen’.”. The cdesc is “Turn to submenu A.” It is for TOC.

A page-toggle rule for SubMenuA (this is the where you toggle the variable for SubMenuA rule):
now Magic_Variable is 5. [or whatever it is]

A page-output rule for SubMenuA (this is the where you do fancy things with the output rule):
clear the screen; [however you’re doing it]
Say “Isn’t this an interesting text? You’ll have to answer yes or no.”;
if the player consents:
say “I’m glad you like it!”;
otherwise:
say “That’s too bad…”;

SubMenuB is a page. “Choose between B1 or B2.”. The cdesc is “Turn to submenu B.” It is for TOC.

Choice A1 is a page. “You have chosen A1.”. The cdesc is “A1”. It is for SubmenuA. It is an end-page.

Choice A2 is a page. “You have chosen A2.”. The cdesc is “A2”. It is for SubmenuA. It is an end-page.

Choice B1 is a page. “You have chosen B1.”. The cdesc is “B1”. It is for SubmenuB. It is an end-page.

Choice B2 is a page. “You have chosen B2.”. The cdesc is “B2”. It is for SubmenuB. It is an end-page.

Return is a page. It flips to TOC. The cdesc is “Return to the table of contents.”. It is for SubMenuA. It is for SubMenuB.[/code]
I’ve never used the page-output rules, but I’ve never wanted to do something fancier than choices in CYOA mode. I can only suspect this is why this rulebook exists. The doc explains that page-output rules fire before the page description, so I imagine it should respect a “press any key” or "if the player consents before proceeding as normal via other methods. I’ll have to test it more extensively if it doesn’t work for you.

Yes, I tried your example and it work perfectly. Thanks.