[Error] Instead of going north or going south

The title says it all, the following snippet of code…

Instead of going north or going south when the player is in the GenericLocation and the player is not GenericAdjective for the first time: say "LOL."
…generates the error message…

Thanks in advance for any help you can provide!

That’s peculiar. It seems the “going north or going south” clause don’t mix too well. I have no idea why; this looks like a bug.

Easy enough to sidestep though. Simply do this:

Definition: a direction is north-or-south if it is north or it is south.

Instead of going north-or-south when the player is in GenericLocation and (the player is not GenericAdjective for the first time):
	say "LOL."

(I put it in parentheses because the “for the first time” becomes ambiguous otherwise. YMMV.)

1 Like

Woah! Thank you very much! The suggested definition is just perfect… and the parentheses trick is awesome!

[code]Definition: a direction is north-or-south if it is north or it is south.

Instead of going north-or-south when (the player is in GenericLocation and the player is not GenericAdjective) for the first time:
say “LOL.”
Instead of going north-or-south when (the player is in GenericLocation and the player is not GenericAdjective) for the second time:
say “LOL2.”
[/code]
I just relocated your parentheses suggestion in order to emphasize that the player should try [(either going north or going south) and (while in the GenericLocation and not being GenericAdjective)] for the first time.

>n
LOL.

>s
LOL2.

FWIW, it looks like the “when” clause is confusing the error-message generator. If I just write “Instead of going north or going south…” you get this more helpful error message:

Problem. You wrote 'Instead of going north or going south'  , which seems to introduce a rule, but the circumstances ('going north or going south') seem to be too general for me to understand in a single rule. I can understand a choice of of actions, in a list such as 'taking or dropping the ball', but there can only be one set of noun(s) supplied. So 'taking the ball or taking the bat' is disallowed. You can get around this by using named actions ('Taking the ball is being mischievous. Taking the bat is being mischievous. Instead of being mischievous...'), or it may be less bother just to write more than one rule.

So it looks like you can’t put alternate nouns directly in the rule heading. If you didn’t want to define a new adjective, you could write:

Instead of going when (the noun is north or the noun is south) and the player is not in the Studio: say "LOL."

but there’s no reason not to define the adjective.

1 Like

Will directions work as a kind of action?

[code]Going north is aimless wandering. Going south is aimless wandering.

Instead of aimless wandering when (the player is in GenericLocation and the player is not GenericAdjective) for the first time:
say “LOL.”[/code]

Remember your “for the first time” will disqualify this rule if they are not in GenericLocation or GenericAdjective the first time they try it.

1 Like

Thank you so much for your detailed and speedy replies. I greatly appreciate your help and input.

Now, after your clarification I am not so sure if I am programming the behavior correctly…

My idea for triggering the “LOL” is: the first time the player tries to (go north or go south) when (being in GenericLocation and being GenericAdjective).

That the player previously has tried to (go north or go south) when (either being in GenericLocation or being GenericAdjective did not hold) should not preclude triggering the “LOL” the first time that all the conditions are met. (I hope I have explained myself correctly.)

If “for the first time,” “for the second time,” etc. aren’t working correctly, it’s probably better just to ditch them and go with a counter. They’re meant to be convenient, and if they’re less convenient than making a counter, there’s no reason not to use the counter.

So:

[code]Definition: a direction is north-or-south if it is north or it is south.
LOLcounter is a number that varies. [by default starts at 0]

Instead of going north-or-south when (the player is in GenericLocation and the player is not GenericAdjective) and LOLCount is 0:
say “LOL.”;
increment LOLcount. [or “increase LOLcount by 1” or “now LOLcount is LOLcount + 1”; see §8.12 of Writing with Inform.]
Instead of going north-or-south when (the player is in GenericLocation and the player is not GenericAdjective) and LOLCount is 1:
say “LOL2.”;
increment LOLcount.[/code]

(Also, last time around you said “first time the player tries to (go north or go south) when (being in GenericLocation and being GenericAdjective)” but all your code has tested whether the player is not GenericAdjective–just want to make sure you’ve got that right, because that would definitely lead to bugs.)

1 Like

Now I am giving counters a chance; so far my tests work as intended. :slight_smile:

Do not worry: the sudden mutation in “not being GenericAdjective” was a typo in my post. Thanks anyway for noticing it!

Apparently, you can hook parameters to a “for the first time” phrase, but it can be dicey. It depends what rule phase the action makes it to.

[code]Test Room is a Room.

Some magic spectacles are a wearable thing in Test Room.

An opaque unbroken geode is in Test Room. The description is “It’s a round, dull rock.”

After examining opaque unbroken geode while magic spectacles are worn for the first time:
say “Ooh, it’s sparkly inside.”[/code]

Works…

What you have to watch out for:

[code]Test Room is a Room.

Some magic spectacles are a wearable thing in Test Room.

An opaque unbroken geode is in Test Room. The description is “It’s a round, dull rock.”

After examining opaque unbroken geode for the first time:
if magic spectacles are worn:
say “Ooh, it’s sparkly inside.”[/code]

1 Like