Here are a few things to try:
1. This isn’t directly related to your problem, but you probably want the planting action to apply to “one touchable thing” rather than “one visible thing”. Otherwise, you might be creating a scenario where the player can plant a seed that’s visible but inaccessible. Inform understands “one thing” as a shorthand for “one touchable thing” (thus creating the oddity that “one visible thing” is actually a broader class of things than “one thing”), but it’s usually best to be explicit.
2. You’ll want a check rule to ensure that what the player is trying to plant is actually a seed.
3. You don’t need to define a “storage” room to hold off-stage objects; things can be left generically off-stage until needed, like so:
There are 20 tomato saplings. There are 20 tomato seeds.
Note that you need to define tomato seed and tomato saplings as kinds of things prior to creating these off-stage collections.
4. As it stands, your carry out rule would cause the sapling to appear in the nursery even if the player is nowhere near the nursery when he performs the planting action. Instead try this:
carry out planting:
remove the noun from play;
move a random off-stage tomato sapling to the location of the player;
This revised code will ensure that the sapling ends up wherever the player is (if you want to ensure that this is the nursery, see below). You should specify “off-stage” to make sure that Inform doesn’t grab a random sapling that’s already in play.
5. The test you have in your carry out rule is bad form; carry out rules should assume that the action is valid. If you need to make sure that it’s valid for the player to perform an action, you should use check rules instead:
[code]check planting (this is the can’t plant non-seeds rule):
if the noun is not a tomato seed:
say “You can’t plant that.”;
stop the action;
check planting (this is the can’t plant outside the nursery rule):
if the location of the player is not the nursery:
say “There’s no suitable soil in which to plant anything here.”;
stop the action;[/code]
These could be one rule, but it’s good form to have a separate check rule for each condition. The bits in brackets are optional - they’re there in case you ever need to refer to these check rules by name elsewhere in your code.
Incidentally, if you want there to be more than one room that’s suitable for planting (i.e., instead of just the nursery), you can use room properties to establish this. Like so:
[code]a room can be suitable for planting. a room is usually not suitable for planting.
check planting (this is the can’t plant outside the nursery rule):
if the location of the player is not suitable for planting:
say “There’s no suitable soil in which to plant anything here.”;
stop the action;
[…]
the nursery is suitable for planting.[/code]