New Action: Transfering

I want an item to be able to be moved from a container to a supporter (and back again, as well as from one supporter to another supporter (but not from one container to another container) without the player having ‘taken’ it as it would be unrealistic for said player to ‘take’ something like this so I thought the best idea would be to create a new action called ‘transferring’.
Essentially it would, when used, move the item from the container from the supporter using the “now” phrase but I can’t seem to write the right code.

Below is what I think are the basics of the code:

[code]Transferring is an action applying to two visible things.
Understand “transfer [thing] to [supporter]” as transferring.

Carry out transferring:
now the thing is on the supporter;

Report transferring:
say “You move the [thing] onto the [supporter].”;[/code]

Could anyone assist with this?

When you want to refer the objects you use in an action, you say “the noun” and “the second noun.” See WRiting with INform 7.10.

So you would write:

[code]Carry out transferring:
now the noun is on the second noun;

Report transferring:
say “You move [the noun] onto [the second noun].”;[/code]

(Also, note that you should put “the” inside brackets, which will automatically handle printing the word “the” for improper-named things and leaving it out for proper-named things–so if you have a hedgehog named Trevor that you can move, you don’t get “You move the Trevor onto the table.”)

A couple things about the way you’re defining the action. One is that you don’t want the action to apply to “visible” things–that’s for actions like examining, where the noun can be something the player can see but not touch. Just say “two things”–that ensures that the player has to be able to touch the things in question. Yes, it’s counterintuitive that there are more requirements on “thing” than “visible thing,” but this has been around in Inform 7 so long that it’s probably hard to change.

(Technically, when you say “visible thing” the noun/second noun can be anything that is in scope, which means anything the parser can understand. When you say “thing” it runs some additional rules to determine whether the player can touch it.)

Also, you want to call the action “transferring it to” rather than just “transferring.” This tells Inform that in the rules you write for special cases of the action it should expect you to refer to the action as “transferring Trevor to the table” rather than just “transferring Trevor the table.” (This use of “it” is mentioned very briefly in Writing with Inform §12.7.) Also, it’s usual to refer to “[something]” rather than “[thing]” in your Understand statements, though I don’t know if that makes a difference. And we have to adjust the other side of the Understand statement to refer to the new action name. So:

Transferring it to is an action applying to two things. Understand "transfer [something] to [supporter]" as transferring it to.

Note that the internal name of the action, the thing you the author use when writing rules, is totally independent from the Understand lines, which determine what the player will have to type to invoke the action. So you can (and should) include lots of Understand lines for other ways of phrasing the command, like this:

Understand "move [something] to [supporter]" as transferring it to.

But that won’t let you write a rule like “After moving Trevor to the hedgehog bed:”. In your own rules you still have to call the action transferring:

After moving Trevor to the hedgehog bed: say "Trevor snuggles happily."

Also also, you can make Understand rules that require that the second noun be a supporter (or a container), but it’s not generally a good idea. If the player tries to move something to something that’s not a container they’ll get an error that says “That noun did not make sense in that context,” which is not very helpful. Players hate those errors. The thing to do is to make the action understood on any thing, and then write check rules to block the cases you don’t want.

Understand "transfer [something] to [something]" as transferring it to. Check transferring when the second noun is not a supporter and the second noun is not a container: say "You can't put things on or in [the second noun]." instead.

(The “instead” there tells Inform that the action fails the check rule, so it should stop processing it. This prevents the Carry Out and Report rules from running.)

And you can write similar rules for your cases. Notice that I used the check for “Is this in a container?” to make a new temporary variable, “the encloser,” which I can refer to inside the rule:

Check transferring when the noun is in a container (called encloser) and the second noun is a container: say "You lack the dexterity to move something from inside [the encloser] to [the second noun]. You'll have to pick [the noun] up first." instead.

Finally, note that you’ll have to hint very well that commands like “move the really heavy urn from the table to the safe” work. Most players won’t expect to be able to transfer things without picking them up, and even if you convey that you don’t want to make them guess the syntax you have in mind.

FWIW, I always default to “put vase on safe”. “Put” is a really useful catch-most-all verb.

True… and since “put vase in safe” is a built-in action, if you want transferring to work you’ll have to work around that. Because “put vase in safe” by default has you try to take the vase and then insert it into the safe, and if you’ve made it so the player can’t take the vase it will lead to sadness. This might work:

[code]Before putting something on something when the holder of the noun is a supporter or the holder of the noun is a container: try transferring the noun to the second noun instead.

Before inserting something into something when the holder of the noun is a supporter or the holder of the noun is a container: try transferring the noun to the second noun instead. [this is the action you get when you try “put vase in box”][/code]