Block giving except for one thing

Hey ya’ll. So I have a scene where I want the player to pawn an item (rare coin). I want the player to try giving a number of items to Pawn Broker, trying to figure out which item he’s interested in. I’ve got the code working great for giving the rare coin to the Pawn Broker and getting the cash in return. The problem is how I can block giving for other items. I’ve been trying things like:

Instead of giving [noun] to Pawn Broker when [noun] is not rare coin: say "'No thanks.'".

That doesn’t seem to work. Any ideas?

Thanks in advance.

Doesn’t the following work?

Instead of giving something other than the coin to the pawn broker, say "No thanks."

Robert Rothman

For the record, when you use square brackets outside of quoted text, it means that the text they contain is a comment. Inform just skips right over them, so it sees Instead of giving [noun] to Pawn Broker when [noun] is not rare coin: say "'No thanks.'" as Instead of giving to Pawn Broker when is not rare coin: say "'No thanks.'"

I’m getting this error message with the new, suggested code:

[code]Problem. You wrote ‘Instead of giving something other than coin to Pawn Broker’ , which seems to introduce a rule taking effect only if the action is ‘giving something other than coin to Pawn Broker’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

[/code]

Hmmmmmm.

Yeah, it’s a bit confusing that Inform uses brackets to mean two fairly different things. If you’re using syntax highlighting in the IDE and not using a screen reader – in other words, if different parts of your code are different colors based on what purpose they serve – you’ll see that comments are colored differently from text Inform reads. For me, comments are green and slightly smaller, and I think that’s the OSX default.

That is confusing. You wouldn’t have any idea how to solve the block giving issue would you? The code he suggested didn’t work.

Hm, is it that it needs to say “rare coin” instead of “coin”? If that doesn’t work, you can try a syntax closer to your original attempt:Instead of giving something (called the offering) to the Pawn Broker: if the offering is not the rare coin: say "'No Thanks.'"; otherwise: [whatever code you want here].

Most of the standard front-ends for I7 include some limited syntax colouring, which makes obvious the distinction between square-brackets in text and square-brackets to comment out code. But of course this doesn’t help everyone.

In I7 a more-specific rule always takes precedence over a less-specific one, so you can just do this:

Instead of giving something to the Pawn Broker, say "'No.'" Instead of giving the rare coin to the Pawn Broker: (whatever you want that to do)"

You could try this.

[code]“Test”

The block giving rule is not listed in the check giving it to rulebook.

Instead of giving something to the pawn broker when the noun is not the rare coin: say “‘No thanks.’”.

The Testing Room is A Room. The pawn broker is a person in the testing room. The player holds a rare coin and and a straw dog.

Test me with “give dog to broker / give coin to broker”.[/code]

This only allows the player to give the coin to the pawn broker. If you want to add other items, you can say “when the noun is not the rare coin and the noun is not the treasure and …” and so on for the other items.

Hope this helps.

Thanks climbingstars - that worked!

One thing to be careful of with that is now you can give anything to anyone as long as the person is not the pawn broker. I’d be more inclined to use maga’s code myself, but if everything’s working now and you cover the other circumstances, there’s not much reason to switch.