Instead rule not working

[code]Money is a thing.

Instead of giving money to Sam:
say “Sam eagerly accepts the money.[line break]
[’]Great![’] he says. [’]Now we can pay the rent and get this thing on wax![’]”;
now the dollars of the wallet is 0;
continue the action.[/code]

Result:

give money to Sam
You can’t see any such thing.

Again, if you just say “Money is a thing” it’s created off-stage. The money has to be somewhere in the room with the player (or where the player can see it) for that to work.

Also, is there a reason why you “continue the action” in an Instead rule?

I thought there was. If there isn’t, I’ll take it out.

The money is in a wallet carried by the player, so the money is in the room. Does the player have to take it out of the wallet?

So the first thing you should do is make sure that the money is where you want it to be. A useful debug command here is to type “showme the money” (no really) just before “give money to sam,” which will give you a rundown of the money and all its qualities including its location.

If the money is in the wallet that’s carried by the player then you need to check whether the player can see the money. One possibility is that the wallet is an opaque closed container, in which case the player won’t be able to see what’s inside it. If that’s so you might want to make the wallet an open container. (The visibility rules are quite a bit more complicated than just “the player can see what’s in the same room”–I was cheating a bit there, sorry.)

Thanks. Wallet is not opaque. I’ll try showme.

One thing is that opaque is the default–if you didn’t say the wallet is transparent, it’ll be opaque.

Here is the result of “showme money”:

take money from wallet
You can’t see any such thing.

i
You are carrying:
a screw
a leather case (closed)
a screwdriver
a wallet (with $50 in it)
an ID
a Jacket (being worn)
Shoes (being worn)
Socks (being worn)
Pants (being worn)
a Shirt (being worn)

Great balls of fire! Jerry Lee Lunk just walked out of the Kit Kat Club!

There’s a whole lot of movin’ goin’ on. Be a part of it.

showme money
money - thing
location: carried by Ollie in Kit Kat Club
singular-named, proper-named; unlit, inedible, portable
list grouping key: none
printed name: “money”
printed plural name: none
indefinite article: none
description: none
initial appearance: none

As you can see, I7 tells me that player and Ollie have the money.

“$50” is not the same as “money” unless you tell Inform that it is.

But I did:

Understand "$50" as money. Understand "fifty dollars" as money. Understand "fifty bucks" as money. Understand "50 bucks" as money.

But if you’ve got $50 as a separate item (which it looks like you do) you need it the other way around:

Understand "money" as $50.

That may pose a problem, since I also have $3 as an amount. How much is in the wallet is stored in a variable called “dollars in the wallet.”

Have you looked through the examples in section 9.4 of the manual?

If the player doesn’t actually have an object called “money”, they aren’t going to be able to give it to another character.

9.4 doesn’t answer my problem, but thanks.

Draconis:

The player carries a wallet in which there is $50, and “$50” is defined as money in an Understand rule.

Understand rules only affect what the player can type, not how the code recognizes things. You’ll need to point your rule at the variable attached to the wallet, using it’s actual name.

EDIT: Clarification

Unreluctance:

I don’t understand.

What is the actual name of the object in the player’s wallet? That’s what you need to refer to in your rule.