I have trouble with this specific piece of text:
Carry out equipping:
now the printed name of the noun is “[noun] (equipped)”.
The same applies with a action I created called unequipping. Here is the result:
The Arena is littered with dropped weapons, bodies, and pools of blood. The crowd roars and jeers from the stands, while the Emperor watches with rapt attention.
The Gladiator eyes cautiously waiting for you to make a mistake.
You can also see a broad sword and a short sword here.
You are carrying:
a bronze sword
equip bronze sword
You take out your sword and hold it firmly in your right hand.
You are carrying:
a nothing (equipped)
If anyone could explan why it is called a nothing.
This is happening because “[noun]” gets checked every time, and the >INVENTORY command doesn’t have a noun.
What you want to do instead is to use an activity. Take a look at 17.10. Printing the name of something; the way to do this is something like the following.
[code]A thing can be equipped. A thing is usually not equipped.
After equipping: now the noun is equipped.
After unequipping: now the noun is not equipped.
After printing the name of a thing (called gear) while taking inventory:
if the gear is equipped, say " (equipped)".
If you want the (equipped) to show up whenever the object is mentioned, just take “while taking inventory” out. (Though that would be likely to lead to ugly-looking sentences, like “You strike a mighty blow with the sword (equipped)!” if you don’t watch out.)
(In practice, you’re going to want to create a special kind of equip-worthy things, called ‘weapon’ or ‘equipment’ or something of the kind, and use that instead of ‘thing’ throughout that code.)
My guess would be the odd behavior flows from the fact that the use of “noun” to represent the direct object of an action is specific to the current action. Thus, it works for the “equipping” action. However, that action is over by the time you take inventory, so there is no “noun” that relates to the current action.
I think that instead of changing the printed name of an equipped object, a better approach may to be to use a “printing the name of” activity rule so that the printed name property remains unchanged but the activity rule prints the equipped/unequipped status after the printed name.
I’m sure that somebody who knows what they’re talking about will tell you that I’m all wrong – and they’ll undoubtedly be right.
Robert and maga are right. Just as a note, what you’re probably looking for where you “[noun]” in your code is “[item described]”; “the item described” works sort of like “the noun” in various contexts that aren’t involved in action rules (so there’s no noun, or the noun isn’t what you expect). So if you want to write a rule for printing the name or the initial appearance or the description of something, and you needed to refer to the thing in the rule, you’d use “[the item described]”. For instance:
The description of a thing is usually "It's a very nice [item described]!"
Add this to your game and you will find that various “You see nothing special about the whatsit” messages are replaced with something kinder.
But you wouldn’t want to do this:
Carry out equipping: now the printed name of the noun is "[item described] (equipped)".
It’ll compile, and you can equip something, but if you try to take inventory your game will hang. That’s because when the game tries to print the name of the sword, it consults the printed name of the sword, which has the token [item described], which means it has to print the name of the sword, so it consults the printed name of the sword, which… In some contexts it’s possible to stop this by using [printed name of the whateveritis] instead of [whateveritis], but not in this one.
So “item described” isn’t any use to you here anyway. (But I thought it might be useful to know about, and it’s not super prominent in the documentation.) maga and Robert are right; you should use an “after printing the name of” rule.
Thanks alot Maga it really helped I would also like to say that I have already done things like making a weapons kind. I just only posted the part of source that didn’t make sense. So again thanks alot.
I’m having another problem if I drop a sword, then pick it up, then equip it it won’t show the equipped?
You’re not specifying what’s going on here very clearly. My guess is that you haven’t made it so that dropping an item unequips it, so when you try to equip it it doesn’t change anything; in that case you’d want something like
After dropping a weapon (called the discard): now the discard is unequipped.
If you specify your problems precisely and clearly, with examples, it will be much easier for people to help you.
Sorry. The problem is after unequipping the object and equipping it again it doesn’t show the (equipped) part. I’m not sure if it’s in my source code somewhere I would show it but it’s to large. What do I do?
If you really have no idea what’s causing this, the last resort is to start a new testing project, copy your code into that, and then trim it down to the smallest possible game that will still behave this way. If that doesn’t identify the problem – and often it will – then you’ll have something compact enough to show to other people.
Thanx I found the problem