writing a letter in IF

I’ve been toying around with trying to make a command which lets the player write a letter to somebody in a game. Most of my attempts would not compile. The one referenced below works somewhat, but is far from ideal.

I’d like to have a way the player could write a letter to another person in the game (such as “write to Mom”), or a object/noun (such as “write to home/school, ect”). The problem is, and I’m not sure how to get around it, is I can’t make a new action which refers to something that is not visible or within reach of the player? So they can’t write a letter to someone or something which exists in another part of the game, unless I put within their sight something like a letter which has another part that is attached to it, like a home-address, as in the example below.

I’m sure my example is probably one of the least efficient ways to do this. But if anyone has an example of how I could implement it better, please share or give me some suggestions. Thanks again for any help.

[code]The studio is a room.

A pen and a letter is in the studio.

Home-address is a part of the letter. Understand “home” as home-address.

Letter-writing is an action applying to one thing. Understand “write to [something]” or “write [something]” as letter-writing.

Instead of letter-writing when the player is not in the studio:
say “You need to be in the studio to write a letter.”

Instead of letter-writing home-address in the studio:
if the player is not holding the pen:
say “You don’t have a pen.” instead;
otherwise:
say “You write home.” instead.

Yard is a room

The studio is north of the yard.
[/code]

Matt W gives a good explanation for how to do this in this thread – specifically the second message down. In this case the OP is trying to make a “being” action, but the basic situation is the same. Here’s the relevant quote:

If you have trouble adapting this to your case, let us know.

Thank you, that works great!