Is there a means to do this in TADS3:
Events occur in this order:
(How it normally works:)
- The player is carrying an item in a container, let’s say a shoe in a box.
- The player tries a command with the shoe like “put shoe in toaster” for example.
- In order to make the shoe usable in an action, the game engine inserts the implicit action to move the shoe from the box to the actor’s main inventory first before trying to put it in the toaster.
- The toaster says the attempt to put a shoe into itself is invalid, and it gives an error message and exits the action.
- The implicit command to put the shoe in the inventory worked even though the explicit command that triggered it was a failure. The shoe stays in the inventory and is now outside of the box.
What I want to happen instead:
5. Because the explicit command that triggered the implicit command failed, make it so that it’s like the implicit command never happened either. In other words leave the shoe in the box where it was. Treat the combination of the explicit command and its triggered implicit command as if they were one atomic operation. Either they both happened, or neither of them did.
Is there a way to do this? A solution that only works for one specific container, and not generically on all containers is acceptable for what I’m trying to do. I don’t need this behavior everywhere, just on one specific container that I’m trying to implement - if an implicit action removes an item from that container and puts it into the actor’s inventory to perform an explicit act, put it back in the container if the act didn’t work.
For example, if there was some way to define the box such that objects inside it are usable directly FROM the box without needing the intermediate step of the actor having to get it into their inventory first, that would be the perfect solution, actually.
Where I am needing this is more of this poker card thing I’m making. The actor has a container called “hand” that works a lot like a keyring except that it holds things of type PlayingCard instead of holding things of type Key. So for the actor to see his cards he can type “look at my poker hand”, for example. But right now, every time the actor plays a card to the table, the card has to go from Hand to Actor to Table and so when the game complains that they are making an illegal play and aborts the action, the card is no longer in their hand anymore, it’s now in their main inventory.