Brand new shiny actions

Well I’ve come across a problem with new actions which I simply cannot solve dealing with new actions.
The problem I’m having is that I’m trying to implement a swipe command. The program compiles nicely, but when I actually type in the action it either comes up blank or says “a second noun must be supplied”.

Understand "swipe [something] through [something]" as swiping. Swiping is an action applying to two visible things. Check swiping: if the noun is not a hotel card, say "you need a hotel key."; if second noun is not a card slot, say "How do you propose to go about that?". Instead of swiping the hotel card through the card slot one time, say "You swipe the card through the slot. The light turns red.". Instead of swiping the hotel card through the card slot two times, say "Annoyed, you swipe the card again. No avail.". Instead of swiping the hotel card through the card slot three times: say "Bloody card! You snap it in two and throw it into the shadows."; remove hotel card from play.

This method, the syntax will work for “swipe card through wallet” or “swipe wallet through slot” and will give the appropriate reply, but swipe hotel card through slot comes up with a blank.

I should probably say that I tried the ‘loner’ action ‘swipe card’ but it also failed.

Understand "swipe [something]" as swiping. Swiping is an action applying to two visible things. Check swiping: if the noun is not a hotel card, say "you need a hotel key."; if second noun is not a card slot, say "How do you propose to go about that?". Instead of swiping the hotel card one time, say "You swipe the card through the slot. The light turns red.". Instead of swiping the hotel card two times, say "Annoyed, you swipe the card again. No avail.". Instead of swiping the hotel card three times: say "Bloody card! You snap it in two and throw it into the shadows."; remove hotel card from play.

It compiled, but when I entered “swipe hotel card” it replied “you must supply a second noun.”

Inform gets confused because you have given the action the name “swiping” and then write rules using the syntax “swiping <> through <>”. Try this:

Understand "swipe [something] through [something]" as swiping it through.  [The "it" here is a place holder for the noun; the second noun should come after the through]
Swiping it through is an action applying to two things. [Actions should only apply to "visible" things if the actor should be able to perform the action on things that are not in scope!]
Check swiping it through:
   if the noun is not a hotel card, say "you need a hotel key.";
   if second noun is not a card slot, say "How do you propose to go about that?".
Instead of swiping the hotel card through the card slot for one turn, say "You swipe the card through the slot.  The light turns red.".
Instead of swiping the hotel card through the card slot for two turns, say "Annoyed, you swipe the card again.  No avail.".
Instead of swiping the hotel card through the card slot for three turns:
   say "Bloody card!  You snap it in two and throw it into the shadows.";
   remove hotel card from play.
[Using "for <> turns" rather than "<> times" resets the counter as soon as the player does something other than swiping the card; i.e. he/she then has to try swiping the card three times IN A ROW to get in rage; with "<> times" he/she will be furious the third time whatever happens in between those times.]

There’s a couple of hiccups in your code, one that’s preventing it working. That thing is that actions involving ‘two things’ should be named ‘(verbing) it (adverb or whatever).’

Once I renamed your action ‘swiping it through’, all the code works.

When you check stuff using ‘X it X’ constructions, the first noun appears in place of ‘it’, and your second noun or other thing appears after the second X, if that makes sense. Thus yours becomes ‘Swipe (card) through (slot)’.

The second thing to note, that isn’t affecting your demo, is that you’re probably better off with a ‘touchable thing’ rather than a ‘visible’ one in this demo. If, for instance, you were so insane as to construct a glass wall in front of the card reader, in the same room as the card reader, and the player was behind the glass, ‘visible’ will still let the player swipe the card through the glass.

12.17. in the docs (Visible vs touchable vs carried) try to explain the difference, but I don’t think they do a very good job. There’s a good part about it in Aaron Read’s book. But I couldn’t find it right now :slight_smile:

An action applying to visible things can act on things not in scope, however, you ALSO need to define a grammar line such as

Understand "swipe [any thing] through [any thing]" as swiping it through

(with “any thing” as two words, rather than “something” or “anything” as a single word) to actually let the player perform such action on things that are not in scope.