Skip a turn

Is there a way to force skip a turn in the code? Akin to a player typing the “wait” command?

Does “silently try waiting” do what you need?

Doesn’t seem to. I’m changing a value and then hoping to skip ahead a turn so that an “every turn when…” fires as a result of that value change-- without the player prompt in between.

This is feeling like I need to finally learn what scenes are.

Oh, that makes sense – how are you changing the value? Scenes are probably the way to go, though checking out the order that your rules are being evaluated in the Index might help you figure out if there’s a way to change the value before the relevant every turn rule fires.

(I should note that I am not a programmer and a big newbie so this advice is likely bad).

Running manually everything that’s related to the turn sequence or even the every turn rules is a very easy way to shoot yourself in the foot if you don’t know exactly what you’re doing.

If there’s only one specific every turn rule that needs to be run, you can call it by name:

Every turn (this is the greeting rule):
	say "Hello there!"
	
Instead of jumping:
	follow the greeting rule.
2 Likes

Oh, that’s neat! As written that would print out “Hello there” twice, though, since after resolving the jumping action the greeting rule would fire as part of the ordinary every turn logic, right? So there’d need to be some clean-up code to prevent that.

Sure, but I understood that the goal is for the rule to run twice, once manually and once as part of the every turn rulebook.

True, it’s not really clear from the OP – sorry, was just thinking aloud while figuring out how this new-to-me thing works!

For some better context, I have a NPC who leaves the room a certain amount of time after the player takes an action-- in the example below I’ve made it after being examined.

Between when the NPC “getsimpatient” and has their value changed to “leaving”, and when the “Every turn” picks it up, there’s a player prompt. Was hoping to skip that player prompt and go straight to the “Every turn” starting the NPC movement.

The Library is north of the Kitchen. The Kitchen is north of the Living Room. The Living Room is north of the Foyer. The Foyer is north of the Lawn.

Kevin is a person in the Library. Kevin can be leaving, intransit, or static. Kevin is static.

Table of Kevin Destinations
destination
Library
Kitchen
Living Room
Foyer
Lawn
		
Instead of examining Kevin:
	say "Good [']ole Kevin.";
	Kevin getsimpatient in two turns from now.

At the time when Kevin getsimpatient: 
	if the player is in the location:
		say "'BORING,' Kevin declares as he makes to leave the room.";
		now Kevin is leaving.
							
Every turn when Kevin is leaving:
	if Kevin is leaving:
		choose a random row in the Table of Kevin Destinations;
		let the heading be the best route from the location of Kevin to the destination entry;
		if the heading is a direction: 
			try Kevin going the heading;
	otherwise if the location of Kevin is the destination entry:
		now Kevin is static.

Oh, I see – yeah, the turn sequence rulebook shows every turn rules as happening before timed event rules, so that appears to be what’s driving the behavior (you can check all these things in the Rules Index, FYI, which I hadn’t realized the utility of until recently!) So Juhana’s fix above would work by firing the relevant rule right when Kevin’s status changes, with the every turn rule taking over on subsequent turns.

2 Likes

Another possibility would be to put the rules for NPC movement into their own rulebook–you could then insert a rule to run those actions after the timed events rule in the turn sequence rulebook.

That’d look like this:

The Library is north of the Kitchen. The Kitchen is north of the Living Room. The Living Room is north of the Foyer. The Foyer is north of the Lawn.

Kevin is a person in the Library. Kevin can be leaving, intransit, or static. Kevin is static.

Table of Kevin Destinations
destination
Library
Kitchen
Living Room
Foyer
Lawn
		
Instead of examining Kevin:
	say "Good [']ole Kevin.";
	Kevin getsimpatient in two turns from now.

At the time when Kevin getsimpatient: 
	if the player is in the location:
		say "'BORING,' Kevin declares as he makes to leave the room.";
		now Kevin is leaving.
						

NPC movement rules is a rulebook.

An NPC movement rule when Kevin is leaving:
	choose a random row in the Table of Kevin Destinations;
	let the heading be the best route from the location of Kevin to the destination entry;
	if the heading is a direction: 
		try Kevin going the heading;
	otherwise if the location of Kevin is the destination entry:
		now Kevin is static.
		
This is the NPC movement stage rule: follow the NPC movement rules. [note that this is not itself an NPC movement rule. The declaration below will insert it into the turn sequence rulebook.]

The NPC movement stage rule is listed after the timed events rule in the turn sequence rulebook.

Mostly I mention this because from your description in other threads it sounded like you have some pretty complicated stuff that might happen, with multiple NPCs, and it might be nice for you to be able to put it all in one place instead of having the rules mixed in with the Every Turn rules. And if you were doing that, you could then make sure it happens after the timed event.

1 Like

That’s super, duper helpful, thank you!

If you want to advance the turn count by more than one but not run the every turn rules more than once, you can:

follow the advance time rule;

Conversely, if you want the turn count to not advance (extra) but run the every turn rules more than once, you can:

follow the every turn rulebook;

These could be combined. However having said that, running the whole every turn rulebook more than once per actual player command is likely the wrong thing to do and it will bite you at some point. You should probably try to be more specific about which things you want to run more than once and put those into a separate rulebook, as matt suggested.

1 Like