I have an ATM machine on a street corner. Player has a debit card in a wallet. I have code that says if the player puts the debit card in the ATM machine, the ATM machine dispenses five $20 bills which are automatically put into the wallet.
So far, so good, code works.
But as a courtesy to the player, after the money is added to the wallet, I want code that automatically removes the debit card from the ATM and returns it to the wallet. (Yes, I know, it could add complexity if the player is required to remove the card before being allowed to move on. And I may decide that’s a better way to go. But I’d like that decision to be based on game play, not by a coding difficulty.)
The following code segment does work with one exception…
debitCard: Thing 'debit card*cards' 'debit card'
"A bank-issued debit card"
dobjFor(PutIn)
{
action()
{
atmAccount.loadWallet();
atm.removeFromContents(debitCard);
debitCard.moveInto(wallet);
}
}
;
The atmAccount.loadWallet() method results in the $20 dollar bills being added to the wallet, and debitCard.moveInto(wallet) results in the debit card being placed back in the wallet.
The problem is atm.removeFromContents(debitCard) line. That does not work.
I end up with a debit card in the wallet and a debit card still in the machine…
Street Corner
Corner of the street. There is an ATM in the building’s wall.
Harry sees an atm here. In the wallet, Harry sees a credit card and a debit card.
put debit card in atm
(first taking the debit card)
Done.
look
Street Corner
Corner of the street.
Harry sees an atm (which contains a debit card) here. In the wallet, Harry sees a credit card, five 20 dollar bills, and a debit card.
I am able to remove the debit card in the game window, with “Take debit card from atm.” How can I do that automatically from code so the player doesn’t have to remember to take it out?
Thanks.
Jerry