How should I increase money in Inform 7?

Hey there, lads and lassies. I’m new to inform 7, and I recently discovered how to implement a system with buyable items via the recipe book (more specifically, the Frozen Assets system which can be found in 9.4: Money).

I found out how to ‘buy’ things with this system and decrease the amount of money the player has in his wallet, but how would I approach increasing money via say, an item named ‘cash’ being picked up? Any help is appreciated!

1 Like

I don’t have a complete rule for you, but the relevant lines would look like

    increase the price of the money by the price of the noun; [the noun here is your cash object]
    now the noun is nowhere; 

You’d need additional code to cover the case where the player is broke (the money object is offstage and has to be moved back to the wallet).

2 Likes

Hey there @zarf! Many thanks for the swift response. Thanks to you I likely found a proper solution, I’ll post it here for future reference and for others :slight_smile:

  • 1.The first thing I did was remove the line:
Instead of taking something for sale:
    say "You'll have to pay for that."

from the original script.

  • 2.The second thing I did was give the cash object a price.

-3. The third thing to do is add:

After taking Wallet of cash:
increase the price of the money by the price of the noun.
	now the noun is nowhere; 

This should be the ‘correct’ way to do it. (Although there’s obviously multiple ways to do it), thanks again for the swift response! If anyone wants to add to my comment or has questions, feel free to post them here! Xoxo

Oops, I seemed to have messed up the ‘layout’ of my reply a bit. I hope it’s still understandable!

I fixed the formatting for you–the trick is that the ``` that you put before and after code blocks has to be on a separate line.

1 Like

Thank you very much!