The Money Changer is designed to provide a method of supplying an
infinite number of objects and 'selling' them to the player in exchange
for some other objects. Using it, you can create a 'Store', a
'Money Changer', or other device that you may dream up. You might
exchange five silver coins for two gold coins.
It works kinda like this:
- A Cell in the dungeon that the player cannot reach contains a
list of Objects that constitute the 'price'. We will call this
the 'Price' Cell.
- Another Cell in the dungeon that the player cannot reach contains
a list of Objects that constitute the 'merchandice'. We will call
this the 'Merchandice' Cell.
- Another Cell, which the player CAN reach, contains the DSA and is
the cell that will receive the 'price' and return the
'merchandice'. We will call this the 'Exchange' Cell.
- A Pushbutton or Pressure Pad triggers the Money Changer DSA.
- The DSA compares the objects in the 'Price' cell with the objects
on the 'Exchange' Cell. If the Exchange Cell contains one of
every such object then the exchange can continue because the 'price'
has been met.
- The exchange is concluded by removing from the Exchange cell all
the objects that constitute the price and replacing them with COPIES of
each object in the Merchandice Cell.
The DSA is constructed from seven states:
- State 0 - The Money Changer
- State 4 - A Subroutine to drop N
items from the stack
- State 5 - A Subroutine to make a
list of objects in a Cell
- State 6 - A Subroutine to list
the objects that constitute the 'price'
- State 7 - A Subroutine to remove
an object of a particular type from a list
- State 8 - A Subroutine to remove
a list of objects from a Cell
- State 9 - A Subroutine to add a
list of items to a Cell