When you are writing in code (as opposed to text), you want to stay with the names of the actions; here, itâs âtakingâ (as opposed to âgettingâ which is a synonym that the player can use). Also, it looks like you have created an action, perhaps called âtaking it withâ?
Taking it with is an action applying to one visible thing and one carried thing. Understand "take [something] with [something]" or "get [something] with [something]" as taking it with.
Instead of taking the apple when the apple is not handled:
if the player is not on the barrel:
say "Looking up, you realize that the apple is way too high to reach.";
otherwise:
say "You reach up, realizing that you are still not quite high enough to reach the apple."
This covers creating the âtaking it withâ action, and the player trying to get the apple without the aid of the rake. With the rake, Iâd use a check ruleâ
Check taking the apple with something when the apple is not handled:
if the player is not on the barrel:
instead say "You reach up with [the second noun], but realize that you can barely touch the apple with it. Maybe you should be standing on something?";
otherwise:
if the second noun is not the rake:
instead say "From your superior position on the barrel, you reach up with [the second noun], but realize that it's not quite long enough to reach the apple. Shucks."
Instead rules completely reconstruct an actionâthis is often not what you want, if you want the action to succeed at some point. I used âwhen the apple is not handledâ above, because that is a condition that exists before the apple is first taken, and your âtaking it withâ action will ideally change this condition. The Check rule above ensures that the apple will not be taken unless two conditions are metâthe player is on the barrel, and the player âtakes the apple with the rakeâ and only the rake; any other object would fail, unless you create other objects that can do the same thing. Now we can move on to an After ruleâbecause now you are on the barrel, and you intend to take the apple with the rakeâ
After taking the apple with the rake:
if the apple was not handled:
say "Good gosh, the rake is just long enough to clip the apple, which falls to the ground with a thunk! You are so excited that you jump off the barrel, land on your tuckus, and snatch the apple out of the grass! Zounds![paragraph break]You get back on your feet, dusting yourself off.";
move the player to the location without printing a room description;
now the apple is carried by the player;
otherwise:
say "You manage to scoop the apple up with the rake, taking it in your hands. A miracle of modern technology.";
now the apple is carried by the player.
I use âwasâ rather than âisâ (if the apple was not handled), because here, weâre assuming that the attempt passed all checks and has succeeded; now we are creating the results. We need to cover both the first successful attempt and every other attempt to take the apple with the rake, when it is no longer on the tree. âMove the player to the location without printing a room descriptionâ will put the player back on the ground, and you will not see a pesky room description re-printed. And finally, ânow the apple is carried by the playerâ gives the apple to the player. You donât want to use âenclosed by the playerâ, because that is only used in an âifâ clauseââenclosedâ can mean âcarriedâ, âwornâ, âis a part ofâ, âonâ, âinâ, âinside of something carried by the playerâ, etc etc. When you are giving instructions to the computer in code, you want to be specificâânow the apple is carried by the playerâ puts the thing directly in the playerâs hands.
I hope that this was more helpful than confusing!