I’m designing a currency extension and I’m getting an error telling me I can’t have two actions that are related to two things. This is my code:
[code]
Currency is a kind of value. $1 specifies a currency. Everything has a currency.
Selling it to is an action applying to two visible things.
Understand “Sell [something] to [something]” as selling it to.
Check selling:
If the player is not carrying the noun:
Say “You can’t sell something you don’t have.”;
Stop the action.
Carry out selling a thing (called the sellitem) to a person (called the notplayerbuyer):
Now the notplayerbuyer holds the sellitem;
Now the currency of the player is the currency of the sellitem + the currency of the player;
Say “You hand over the [sellitem] to [notplayerbuyer]. He gives you [currency of the sellitem] in return.”
Buying it from is an action applying to two visible things.
Understand “Buy [something] from [something]” as buying it from.[/code]
Sorry, I was running an old version of Inform, so it works now. Though I’m having one other error, with the buying:
Buying it from is an action applying to two visible things.
Understand "Buy [something] from [person]" as buying it from.
Check buying it from:
If the currency of the player is less than the currency of the noun:
Say "You can't afford it.";
Stop the action.
Check buying it from:
If the person (called the seller) does not hold the noun:
Say "[seller] doesn't even own [the noun].";
Stop the action.
Carry out buying it from:
Now the player holds the noun;
Now the currency of the player is the currency of the player - the currency of the noun;
Say "You hand over [currency of the noun]. He gives you [noun] in return."
“The person” doesn’t do what you think it does: it’s interpreted as “any person,” not the person referred to by the player. You should use “the second noun” (if the second noun does not hold the noun…)