"M to N turns/times" construction

I had never noticed the for four to six turns construction as seen in WWI 7.17 Actions on consecutive turns. It seems to work with times, too.

Unfortunately, the construction doesn’t seem to work reliably in the general case. The following compiles but only works at the lower bound in both 6M62 and 10.1:

Every turn when in darkness four to six turns:
	say "It's dark again. Are you taking up echolocation as a hobby?"

The generated I6 (6M62 version) is:

! Every turn when in darkness four to six turns:
[ R_799 ;
	if (((((TestSinglePastState(0, 0, false, 2) == 4 ))))) { ! Runs only while condition holds
	...

Is there any other documentation on this construction and its intended uses anywhere?

2 Likes

I notice you didn’t include “for” in your code; does that change anything?

I just tried it with the “for” in Borogrove and it only fires on the 4ᵀᴴ turn:


Laboratory is a room.

The pit is down from the laboratory. The pit is dark.

Every turn when in darkness for four to six turns:
	say "It's dark again. Are you taking up echolocation as a hobby?"
1 Like

As far as I can tell, the presence or absence of for makes no difference.

1 Like

The docs say (emphasis added):

We can also reckon the number of consecutive turns on which an action has been repeated

I think it’s not meant to be used outside that case and so should probably be an error.

1 Like

Ah! @Zed is (of course) right.

Which means @otistdog, you can do this, and it should work (you may have to add other actions if you have other ways the player might move):

After doing anything except going for three to five turns:
	if location is dark:
		say "It's dark again. Are you taking up echolocation as a hobby? You decide to leave back to the light.";

Well, it’s half-working as it stands right now. The compiler just seems to ignore the to six part of the phrase. It seems like this functionality could be part of the compiler’s general times/turns parsing machinery – it would just need to follow the same pattern that it does when it is working correctly.

Right now, a rule like

Place is a room.

After waving hands in Place for two to three times, say "Hello back!"

translates to

[ R_799 ;
	if ((PAPR_0() && ((2 <= (TimesActionHasHappened-->0)) && (3 >= (TimesActionHasHappened-->0)) && (ActionCurrentlyHappeningFlag->0)))) { ! Runs only when pattern matches
	...

[ PAPR_0 ;
	if ((((action ==##WaveHands) &&  (actor==player) && ((real_location == I125_place) && (true))))) rtrue;
	rfalse;
];

so a generic state check (replacing the snippet from my earlier post above) would look something like

[ R_799 ;
	if ((2 <= TestSinglePastState(0, 0, false, 1) && 3 >= TestSinglePastState(0, 0, false, 1)) { ! Runs only while condition holds
	...
1 Like