I have a cascade of actions that depend on a state variable and its changes. Originally, I started the actions with When play begins: which worked fine. Now I need to do something before the cascade starts, and need to trigger a next turn. How is that done? Here is my existing code
After looking in SE_Road the first time:
say "A burly guard blocks the road. 'Only registered adventurers can enter,' he says.[paragraph break]";
say " 'Do you want to register as an adventurer?' ";
if the player consents:
now stage is stName;
otherwise:
say "[line break] 'The guard brings himself to his full six foot height and puts his hand on his formidable sword. 'Then turn around and be on your way,' he commands.";
end the story.
When the next turn is run and stage is stName, it should trigger the cascade, starting with
Every turn when stage is stName:
if TestFlag is "TEST":
say "Stage = stName[line break]";
follow the name catching rule;
Instead of getting the stName action, I get the default command prompt. Because of the TestFlag conditional, I know that the stName rule is NOT followed. What is happening here? I think this would work fine if I could enter something like Get player's command or end turn after the line now stage is stName;
One thing to check: I had problems in a game with multiple “every turn” rules. I got the impression that it works best to have one “every turn” stack - I don’t know if multiple every turn rules overwrite each other, but when they’re complicated and involve stopping or continuing the action or the rule succeeding or failing, they stop the every turn rule and might skip other processes.
You might want to make internal actions or other named rules to populate your every turn stack, like
Every turn:
check for death;
if stage is stName:
follow the name-catching rulebook;
update statistics;
sweep for stray objects;
To check for death:
if the player's HP is zero or less:
end the story saying "You Are Dead";
To update statistics[...]
To sweep for stray objects[...]
Essentially, run all of your processes and rule-machinations outside the single every turn rule so the entire thing doesn’t get interrupted if code inside it fails or succeeds - I believe that will allow external rules to fail and succeed on their own without completely stopping the every turn rule.
I assume that also implies “rule succeeds” which makes the rulebook go “good show, we’re done here”
I may be misremembering; I thought someone told me once that multiple every turn rules didn’t work, but I likely was having them succeed and fail, which seemed to cancel the entire every turn rulebook instead of just that individual rule?
Ooh, That looks like what I want.
Thanks to the others. I understand.
My every turn rule depends on the value of the state variable, and it was working fine until I added this pre-turn rule. I’ll give it a try.
You can also use “follow the turn sequence rules” in place of those two lines, which does basically the same thing but also accounts for anything else you might have added to the turn sequence (and is one line shorter).
Bonus thanks from me for pointing out “follow the turn sequence rules”. That just fixed something for me. The 2-line version hadn’t worked. Cheers!