I have as code:
"R343 is a room.
A bandage is a kind of thing.
Three bandages are in R343."
I can take the bandages and if needed they can be used to heal. No
problem there. But apparently the generic bandages are not considered
as three specific objects that can be removed one at a time. I can
solve this problems by saying (instead of "Three bandages in R343"):
"The blue bandage is a bandage.
The red bandage is a bandage.
The yellow bandage is a bandage.
A blue bandage and a yellow bandage and red bandage are in R343."
Is there a way to use the generic "bandages" and have them leave the
game when used individually? Having to make them all specific separate
objects is inelegant.
Merry Christmas all and thanks for your help.
Chuck
> I can take the bandages and if needed they can be used to heal. No
> problem there. But apparently the generic bandages are not considered
> as three specific objects that can be removed one at a time. I can
> solve this problems by saying (instead of "Three bandages in R343"):
Try this:
Room1 is a room.
A bandage is a kind of thing.
Three bandages are in room1.
The dog is an animal in room1.
Healing is an action applying to one thing.
Understand "heal [someone]" as healing.
Before healing the dog:
if the player is carrying a bandage
begin;
let item be a random bandage carried by the player;
say "You heal the dog.";
remove item from play;
otherwise;
say "You don't have any bandage left.";
end if.
Test me with "take bandage/heal the dog/heal the dog/take bandages/heal
the dog".
Otto circumvents this by first declaring what a single bandage is:
A bandage is a kind of thing.
Three bandages are in room1.
This is just off the top of my head, check the Index in your I7 IDE or
try SHOWME BANDAGES in-game to verify if I'm right.
> Otto circumvents this by first declaring what a single bandage is:
> A bandage is a kind of thing.
Chuck did this too. But when manipulating kind of things, you have to
explicitly select one of them otherwise Inform can understand which one
to choose (hence the "let item be a random bandage...")
That one line of code makes the difference. Works great now. Now I
will also see if this addition can make a generic description.
Thanks!
Chuck
Greetings all.
Another question. My story is in the third person. I want Phoebe to be
able to heal "herself."
Here's the simple revised code;
[code begins]
Understand "bandage" and "compress" and "dressing" and "gauze" and
"medicine" as a bandage.
The forest is a room.
Baby bear is in the forest.
A bandage is a kind of thing.
Three bandages are in the forest.
Healing is an action applying to one thing.
Understand "heal [someone]" as healing.
Understand "bandage [someone]" as healing.
Understand "herself" as Phoebe.
Before healing the baby bear:
if the player is carrying a bandage
begin;
let item be a random bandage carried by the player;
say "Phoebe heals the baby bear.";
remove item from play;
otherwise;
say "Phoebe doesn't have any bandages in her possession.";
end if.
Before healing the player:
if the player is carrying a bandage
begin;
let item be a random bandage carried by the player;
say "Phoebe heals herself.";
remove item from play;
otherwise;
say "Phoebe doesn't have any bandages in her possession.";
end if.
[code ends]
Once a bandage is taken, Phoebe can "heal self" and "heal Phoebe" but
not "heal herself." even with the addition of "Understand 'herself' as
Phoebe." I have tried more combinations of the "understand" statement,
but they don't work. I think a player is likely to say "heal herself"
which currently gives an error message with the above code. Any
thoughts? Thanks.
The code you posted must not be complete, since there's no "phoebe" in
the game, so "heal phoebe" must not even work. You need to have a person
named phoebe in the game and make her the player, then the addition of
"Understand 'herself' as Phoebe" will be understood:
[code]
Phoebe is a woman in the forest. The player is Phoebe.
Understand "herself" as Phoebe.
[code]
... or if you plan on having the player change identities in the game:
[code]
Phoebe is a woman in the forest. The player is Phoebe.
Understand "herself" as Phoebe when the player is phoebe.
[/code]
Skinny Mike
Thanks Skinny Mike. But when I add the above code I get:
"The sentence 'Phoebe is a woman in the forest' appears to say two
things are the same - I am reading 'Phoebe' and 'woman in the forest'
as two different things, and therefore it makes no sense to say that
one is the other: it would be like saying that 'Clark Kent is Lex
Luthor'. It would be all right if the second thing were the name of a
kind, perhaps with properties: for instance...."
When I take out "a woman" in the code, the program loads. But then
crashes as soon as Phoebe moves with the message that she has died. I
think there may be a conflict with my use of David Fisher's Custom
Library Messages to do the following:
When play begins:
change the before library messages rule to the id printing rule;
change the library message person to third person;
change the library message gender to gender feminine;
set the library message third person text to "Phoebe";
.......
I am not sure how to track down the cause of the problem. Being able
to "heal herself" is not a major issue and may not be worth doing
significant changes in the current code I have. I'll poke around and
see if I can fix it.
Chuck
Shame on you, Chuck, for giving me incomplete information. ;)
The code you originally posted code does not compile, because of the line:
Understand "herself" as Phoebe.
... since there is no "Phoebe" in the game. When I comment out that line
and add:
[code]
Include Custom Library Messages by David Fisher.
This is the id printing rule:
say "{ [library-message-id] }[line break]"
When play begins:
change the before library messages rule to the id printing rule;
change the library message person to third person;
change the library message gender to gender feminine;
set the library message third person text to "Phoebe".
Phoebe is a woman in the forest. The player is Phoebe.
Understand "herself" as Phoebe.
[/code]
... I get this working output:
[output]
forest
Phoebe can see Baby bear and three bandages here.
>get bandages
bandage: { LibMsg <report player taking> }
Taken.
bandage: { LibMsg <report player taking> }
Taken.
bandage: { LibMsg <report player taking> }
Taken.
>heal herself
Phoebe heals herself.
[/output]
This leads me to believe that in your code (not the code you posted, but
the one you're actually using) you have inadvertently created a separate
"Phoebe" object in addition to the "yourself" object which represents
the player. With "Custom Library Messages," setting the library message
third person text only changes the way that extension prints out the
word "you" in the messages. It does not change the internal name of the
player object (a male person called "yourself").
AFAIK, the "two things are the same" error only comes up when we attempt
to define something which has already been defined, and since you get it
by adding the line "Phoebe is a woman in the forest," this tells me that
you have a (redundant) "Phoebe" object somewhere.
Whether or not your "heal herself" issue is critical, this might cause
other problems, so should be tracked down. The easiest way to do this is
to check the World tab under the Index tab and look for an object with
the name Phoebe. Click on the yellow arrow next to it to go to the point
in the source where it was created. This might be a line as simple as
"Phoebe is in the forest." If that's the case, you might have
accidentally created a *thing* called Phoebe in the forest without
noticing it. You could also try "showme phoebe" and "showme yourself"
from within the game and see what comes up.
Now, you might want to stick with a separate Phoebe object and have the
yourself object out of play the whole game (in which case it will appear
as "your former self" in debugging commands). However, since CLM takes
care of the output already, this is probably not necessary. I would
probably just remove any references to Phoebe in your game code and
replace them with either "the player" or "yourself" -- depending on the
syntax required for that situation.
You could send me the (full) code, however, if this is a JIG comp entry,
I'd prefer that you didn't. I'm still considering entering myself and
while I don't mind helping other entrants, I'd be uncomfortable looking
at the entire code of another entry before submitting mine. Either way,
let me know if this helps.
Skinny Mike
Skinny Mike glares at Chuck with a stern face:
"Shame on you, Chuck, for giving me incomplete information."
(Bows deeply to Mike) And for that I am truly repentant and deeply
humbled by your wisdom. 8^)**
No, I'm not at the level of submitting for a comp. Thanks for the
offer of taking a look at the code. I will wrestle with your
suggestions to see if I can figure out the mistake. I don't want a
buried error to cause later problems, so I have to track down what is
causing the glitch. If I run into block, I'll get back to you. Thanks!
You can see the future home for the Adventures of Phoebe McGee at
http://www.k-state.edu/wwparent/story/Phoebe/.
Chuck