I have a group of items that are all Armor. Leather armor is armor. Robe is armor (albeit not much), etc. The player wears one piece of armor. How can I identify a specific piece without knowing what it is? I would like to say something like:
say "The player is wearing [armor worn by player]."
but the parser says it is not specific enough.
Armor is a kind of equipment. Armor is wearable. Armor has a number called AC.
Robe is armor. AC of robe is always 1.
Description of robe is "A padded garment with many pockets. It has no defensive properties. (AC=[AC of robe])".
leather armor is armor. AC of leather armor is always 13.
Description of leather armor is "A light-weight and flexible vest made of boiled leather. It will protect against most attacks. It's scarred surface records the history of your battles. (AC=[AC of leather armor])".
Understand "vest/leather" as leather armor.
Does subbing in â[random armor worn by the player]â work? Inform doesnât know that the player can only wear one armor at a time (at least I assume you have that restriction somewhere), so just saying âarmor worn by the playerâ is too vague - but if there can only ever be one picking at random is fine.
(The reason the parser allows you to just type X ARMOR is that itâs able to guess what the player might mean, and ask for clarification if the command is ambiguous - that obviously doesnât work in code!)
Say "The player is wearing [list of armour worn by the player]."
⊠which will give a suitable message even if that list only contains one thing (and I believe will say ânothingâ if the player isnât wearing any armour).
They feel intimidating, but Iâm warming up to relations for their readability.
some code
equipment is a kind of thing.
armor is a kind of equipment.
armor is wearable.
the plate mail is armor in lab.
the robe is armor in lab.
protection relates one armor to one person.
the verb to be equipped by implies the protection relation.
check wearing armor:
if something (called the current armor) is equipped by the player:
say "(first removing [the current armor])[command clarification break]";
try silently taking off the current armor.
after wearing armor (called the new armor):
now the new armor is equipped by the player;
continue the action.
after taking off armor (called the old armor):
now the old armor is not equipped by the player;
continue the action.
instead of jumping:
if something (called the current armor) is equipped by the player:
say "You are currently wearing [the current armor].";
otherwise:
say "You are currently unprotected!".
Yes, thatâs how I proceed on my end for objects in general, because I find that it works well for all scenarios, as you explain it very well.
Just a little feedback : for needs related to RPG game mechanics (which seems to be the case here), one can also decide that each protected body area uses only one type of armor (just a helmet; just a pair of boots; just a pair of gauntlets; etc.) and reserve the term âarmorâ for what protects the torso or the body in general. This simplifies the code a lot, provided that the technical complexity of combat is not essential to the narrative design. In which case:
Check wearing an armor when the player is wearing an armor (called the current armor):
say 'You are already wearing [the current armor]. You need to take it off first. [run paragraph on]' instead;
And so the (unique) armor worn by the player can then be designated both by the list of worn armors (tout post) and by what is proposed by @DeusIrae.
I like Brian Cookâs relationship example, but I donât think Iâm there yet. Iâll use that later.
I found that I could use the âcalledâ option for specificity:
if player is wearing armor (called MyArmor):
now AC of player is AC of MyArmor + ACMod of player;
say "AC = [AC of player] ([printed name of MyArmor] ([AC of MyArmor]) + [ACMod of player] (ACMod))";
Iâm not sure if this is any better than the alternatives above, but it works. Any advice?
Well, thatâs also what Iâm using in the little example I posted here, and for now, I havenât found anything more effective (but Iâm still a beginner).
I owe you thanks; what you posted prompted me to use a relation for managing the connections between a given room and the objects that usually illuminate it. Something like:
a room has a thing called usual-lighting-tool
shows some limitations when you want to take full advantage of Informâs native functions. Not only has the use of this relation significantly simplified my code (the statements are lighter and more readable), but it also allows writing, for example:
Extinguishing a lighting-tool which lightrooms a tavern is reprehensible behaviour