How do I define getting/reaching something when these are already words?

I have an apple in a tree and the only way to reach it is if the player is standing on top of a barrel and using a rake.

The problem is that all the words I want to use to achieve and check this are already defined. More than likely the problem is a lack of understanding on my behalf, but here we are.

I want to say something along the lines of-

instead of using the rake to get the apple when the barrel is climbed*:
   say "Reaching up you manage to knock the apple loose and catch it before it hits the ground";
   now the player encloses the apple.

instead of using the rake to get the apple when the barrel is unclimbed*:
   say "Reaching up you're still too low to reach the apple.".

instead of getting the apple when the barrel is climbed*:
   say "Reaching up you're still too low to reach the apple.".

instead of getting the apple:
   say "it's way too high up to reach."

*I should have made the barrel enterable rather than creating the climbed state. I’ll change this afterwards.

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!

1 Like

One thing I didn’t take account of–if the barrel is an enterable supporter, I don’t know if you included any ‘reaching outside’ rules–if you did not, then this should be fine, what you can reach from the barrel is limited only by our rules above; you’ll be able to reach anything but the apple, which might not make sense if you have something on the ground. If you do have a ‘reaching outside’ rule, ironically, it should allow reaching the apple, so then the rules above will work. But if you want nothing to be reachable from the barrel, because you’re standing on it, under the apple, then it should look like–

Rule for reaching outside of the barrel:
   if the noun is the apple:
        allow access;
    otherwise:
        say "You're standing on a barrel!  You can't reach [the noun]!";
        deny access.

The ‘allow access’ will prevent the ‘You’re standing on a barrel! You can’t reach the apple!’, which would be confusing because presumably the barrel would make reaching the apple easier. ‘allow access’ would allow our rules above to take action.

I realize that I have not completely treated ‘taking it with’; you’ll want to cover as many possibilities as you can (and use as many synonyms as you can think of in your Understand statement). What if the player wants to take other objects, with other objects? This action is probably not going to be used very much, especially as a solution to a problem. Let’s say that the rake is THE ideal object that can be used to ‘take [something] with’–

Instead of taking something with something when the second noun is not the rake:
    say "[The second noun] is hardly a good choice for grasping [the noun]."

And when the object you’re attempting to take is not reasonably ‘takeable’ using the rake, particularly if you want other objects to be takeable using the rake–

A thing can be rakeable or unrakeable.  A thing is usually unrakeable.  The apple is rakeable.  [and as you create more objects, you would be careful to label each object that is takeable with the rake as 'rakeable', while the phrase 'a thing is usually unrakeable' would make every other object unrakeable]
Instead of taking an unrakeable thing with the rake:
   say "Imagine, trying to take a [noun] with that rake!  Impossible!"

Now for those objects that can be taken with the rake (except for the special circumstance of taking the apple with it, described by the rules above)–

Carry out taking something with the rake:
    now the noun is carried by the player.
Report taking something with the rake:
    say "You pick [the noun] up with the rake, and take it into your hands.  What a miracle of modern technology!"

For new created actions, such as ‘taking it with’, you will need to write rules, for the new action, that cover ordinary circumstances–Check, Carry out and Report would be used for this. Check rules would decide if the action can be done; if so, Carry out rules, which are usually code only, would give instructions about the results–add the object to the player’s inventory, in this case; Report rules usually do only just that–report the results to the player. But if it’s a special circumstance, where the action is a solution to a puzzle or has some other special affect beyond the ordinary, an After rule can bring about additional stuff, such as a congratulatory quote, a score increase, or a story-ending fail message(wringing hands). An After rule, in the case of the apple, would replace the Report rule, so there’s no worry of something being printed twice.

Of course, and I always forget this, you don’t want to allow taking an object with itself–

Instead of taking something with something when the noun is the second noun:
    say "You were never much with abstract art."
1 Like

And, you can also write an Understand statement to fit “use” in with ‘taking it with’–

Understand "use [something] on [something]" as taking it with (with nouns reversed) when the second noun is the rake.

Thanks for taking the time to write all this. I’ll go through it as soon as I get home.

1 Like

This is funny. I like it.

1 Like

HZD,

While I know that there’s nothing like human intervention as an aid to ‘how to’ (which is what Intfiction is for), I would strongly suggest (other than possibly a read-through of the manual) making heavy use of the Index on the right in the Inform7 window. At first, when I started with Inform7, I barely used the Index–now I find it very essential. It tells you everything about your game, and has all the information you need to properly implement everything in your game (actions, objects, etc). You may find that you don’t really have to create many actions, as it’s very likely that there is an action (or two) already built into Inform7 that covers what you want to do; you may only have to write the appropriate rules to define the results. My process, when I create an object, after I have named it and placed it in a room, listed its properties, described it, and listed its synonyms, is to go to the ‘Actions’ part of the Index, and go over the list of built-in actions (under the ‘grouped’ tab–the actions listed here are all of the actions that are used by the interpreter; every command that the player can type maps to one of these actions), and see which of those actions might produce a reasonably unique response (other than the built-in responses, such as ‘Taken.’ when the player takes it, or ‘Dropped.’ when he drops it–though for some objects, you may want a more unique response). I go over the whole list–some actions may produce the same response as others, such as ‘rubbing’ and ‘touching’, or ‘searching’ and ‘looking under’, or ‘pushing’, ‘pulling’ and ‘turning’(especially if you want to emphasize an object’s immovability). You may find that you’ll write more rules for scenery objects than other objects, and you’ll write more Instead rules than any other rule, because most of what a player will try will be rebuffed by a sentence which will hopefully give information about that object.

A comfy chair is here.  It is scenery and an enterable supporter.  The description is "It looks so comfortable, how can you resist sitting in it?"  Understand "comfortable chair" as the comfy chair.
After entering the comfy chair:
    if the player had not been on the comfy chair:
        say "Ooh that's comfortable.  It lulls you almost to sleep.[paragraph break]Suddenly a group of men in scarlet cassocks bust in through the door, yelling 'NO ONE expects the Spanish Inquisition!'[paragraph break]Then, looking at you, one of them says, 'Wait, it's the wrong house.'  They disappear as you are startled awake.';
    otherwise:
        say "You sit cautiously back down into the chair, looking nervously towards the door.  Nope, no Spanish Inquisition."
Instead of pulling, pushing or turning the comfy chair:
    say "You can't even budge it--it must be rooted into the floor.  But you can't help notice how soft it is."
Instead of rubbing, searching, squeezing or touching the comfy chair:
    say "You run your hand all over the cushions, feeling the luxuriousness.";
    if the Spanish doubloon is not handled:
        say "[line break]While exploring the seat cushion, you feel something hard.  Pulling it out from under, you discover it's a Spanish doubloon!";
        now the Spanish doubloon is carried by the player.
etc, etc.

If you go over the list of actions enough, it will become so second nature that it’ll take only a couple of minutes.
Again, I hope this isn’t too much! Don’t hesitate to consult this forum if you have more questions!

Thank you. I’m starting to be able to make good use of the inbuilt resources.

I find my learning trajectory with inform, and in other endeavours, is similar to yours. Starting out, all the documentation is there but without context and experience it’s much more difficult to get full value out of it, but then, with time, it becomes invaluable.

For reference, I originally started trying to work with Python to make text adventures. I watched a lot of videos and read a lot of documentation, altogether 20 hours, which is my standard amount of time to get it or move on (for now, or forever) , and didn’t get to where I could do much of anything. The reason was primarily because almost all of my initial questions, when my enthusiasm was high, were met with “read this” or “watch that” speed bumps.

That’s why this community is so great. As you say, being able to talk through problems and get explanations from different perspectives is invaluable. People here will answer the simplest question even though it is fully addressed in the documentation. This makes a huge difference for beginners’ engagement. It’s often not that people don’t want to put in the work but that when they read it, for whatever reason, it didn’t click for them and they need it rephrased.

To put it another way, Intfiction, and this forum in particular, is not full of “gatekeepers” and that’s awesome.

3 Likes

Completely understood. I don’t know where I would be with Inform7 and the IFComps without Intfiction.com. There’s nothing like seeing technique being put into practice. While the manual is useful, there is actually a lot of points and things that it only glosses over or even does not cover. Some of it quite important.

I have to admit that I am no expert, and I was where you are about four years ago. There may be some things in my examples above that could be done differently, or done even better, by some of the other more experienced authors here, who I would invite to add input. There may be tricks I still don’t know. But I hope that I have helped, take your time, pace yourself.