ParserError vs. Class Objects

Dear all,

I have a class object here, coin(s). The player has five of it in inventory, listed as “five coins”. “examine coins” results in “You can’t use multiple objects with that verb.”. So far I’ve been fiddling with ParserError, which would work if I knew how to address the object in question (I have several classes). Like,

[ ParserError error;
if(error==MULTI_PE){
if(??? ofclass Moneyclass) “Shiny gold coins.”;
rfalse;
}
rfalse;
];

So, question 1: What would “???” be? “noun” doh work. Question 2: Am I thinking in the wrong direction? Is there an easier solution? Anticipated outcome is “examine coins” => “Shiny gold coins.”

Thanks!!

Firstly, consider carefully whether you really need to have these instantiated as 5 separate objects, or whether you can have one object with a counter property attached to it and a routine to print its name according to how many coins are left… Assuming that these coins might not always be spent at once- otherwise a simple plural-named object would do the trick.

That’s actually a very good question. Have you read section 29 of the Inform Designer’s Manual, 4th edn? That covers most of the issues related to plural names for this sort of situation.

The Balances source code did the trick. Thanks for pointing me to that one! (It was mentioned in §29.)

1 Like