When play begins, move character if...?

Okay, so… Yet another “problem”.

I’m using Menus by Emily Short to toggle a couple of things before game play. One of the “toggles” is a tutorial mode. Toggling the mode is fine, all that is working well. Sets the truth state variable, which is my new best friend. The problem is determining what happens based on that variable.

I’m looking for ideas on how to handle this. Basically when play begins, I want to check to see if the tutorial mode variable is true. If it is, I want to trigger putting the player into a specific room. This seems easiest to begin a scene, dole out advice and whatever.

But I can’t seem to make anything fire like it’s supposed to.The menu example is, if I recall, taken straight out of the documentation for Menus. My understanding is that after the player “quits” the menu (which I need to change), s/he is dumped straight into the game, being the first room that I have defined.

So the problem I’m running into is that no matter where I put the “If tutorial mode is…” statement, Inform chokes on it.

If I need to post code examples, I can. But it seems like one of those things that should be very simple. Hopefully I’m doing a better job of explaining it than I am coding it.

At what point is the player prompted to request the mode? Some kind of opening-screen menu-choice? In some cases like this, you can slip some “say” tokens into strings to make things happen. I’ve seen this technique described as poor form, so I use it as often as possible.

What about something like this?

[code]Include Menus by Emily Short.

When play begins:
now the current menu is the Table of Options; carry out the displaying activity; clear the screen.

Table of Options
title subtable description toggle
“Tutorial mode is [if tutorial mode is true]on[otherwise]off[end if]” – -- switch mode rule

This is the switch mode rule:
if tutorial mode is true, now tutorial mode is false;
otherwise now tutorial mode is true.

Tutorial mode is a truth state that varies. Tutorial mode is false.

[The table amendments replace the extension’s original ‘quit rule’ with a ‘new quit rule’ that is sensitive to the tutorial mode.]

Table of Menu Commands (amended)
number effect
81 new quit rule
113 new quit rule
27 new quit rule

This is the new quit rule:
decrease the menu depth by 1;
if the tutorial mode is true, move the player to the Exercise Room;
rule succeeds.

The World is a room. “Hello World!”

The Exercise Room is a room. “Back to school …”[/code]

Oh no! I’ve been using it more and more… does this mean I’m becoming a lowbrow hack? :open_mouth:

Of course I’ve always been a lowbrow hack… I just have a lot of highbrow pretensions. :laughing:

Lately I’ve been suspecting these say-phrases of causing trouble with line breaks, though. If a say phrase runs a rulebook, I think it triggers an extra line break. I guess you can’t really blame the side effects for that, though. Even something as simple as this seems to make things messy:

To say flashback style: say italic type.

My understanding of menus is that the menus are actually “part” of the game - that is, the When play begins rules fire, and then the menus get displayed.

You might want to encapsulate your current When play begins rules into a new rule, and have that rule fire upon selection of the menu entry.

For example:[code]The begin play without tutorial mode rule:
Now TutorialMode is false;
Now the player is in Perfectly Normal Room;

The begin play using tutorial mode rule:
Now TutorialMode is true;
Now the player is in Training Room;[/code]And depending on the selection the player makes in the menu, either of those rules fire.

I can help you discard those through the ancient science of mockery.

Well, I’m constantly chasing down line-break issues and hacking them back into politeness with silliness like [run paragraph on][line break] … but it’s been my impression that simply using I7 causes trouble with line breaks :slight_smile:

You guys crack me up.

Thanks for the suggestions. I’ll give these a run through when I’m able.

The menus are part of the game, invoked by “When play begins…” which is why I just kind of thought that “quitting” the menu would result in the next rule firing. As it happens, this isn’t the case. Inform doesn’t know what to do with these seemingly random conditionals.

Joel: Thanks for the suggestion. That would have worked great, had I been doing things a little differently. I’ll definitely keep it for future reference, in simpler situations.

Felix: This did exactly the trick, given the added complication that I didn’t mention in the initial post. Not sure what the menu change did, though? The part I want (and am going) to change is “quitting” the menu. Just a verbiage thing. I’d like it to be like "

to Play" or something instead of " to quit". Doesn’t make much sense for an opening menu, ya know?

Those numbers in the table are ascii-code (81 = O, 113 = q, 27 = Esc).

So you need to change the ‘Q = Quit’ option to a ‘P = Play’ option (and you can’t do that by table amendment).
But the P and p keys (ascii 80 & 112) are already mapped to the ‘P = Previous’ option, so you have to change that as well.

When play begins: [Changes “Quit” to “Play” and “Previous” to “Last”]
now the right in row 3 of the Table of Deep Menu Status is “P = Play”;
now the left in row 4 of the Table of Deep Menu Status is " L = Last";
now the current menu is the Table of Options;
carry out the displaying activity;
clear the screen.

Table of Menu Commands (continued) [Maps L and l keys (for “Last”) to the move up rule]
number effect
76 move up rule
108 move up rule

Table of Menu Commands (amended) [Maps P and p keys (for “Play”) to the play rule]
number effect
80 play rule
112 play rule

This is the play rule:
decrease the menu depth by 1;
if the tutorial mode is true, move the player to the Exercise Room;
rule succeeds.[/code]