cotton candy machine (#933)(an instance of Generic Dispenser made by melusina)     A bit rickety, but recognizable. The chamber of the loudly rattling machine is filled with webs of spun sugar. The operator is nowhere to be seen. Do you dare help yourself to a sugar rush? Go to location of this object, Dying Moon Carnival. HELP MANUAL:
     Here are step by step instructions for setting up a child of this parent to dispense
some item:
     
     - First @create #1488 named MyChildDispenser
     
     - Decide on what generic your dispenser will dispense to people. Then type:
      @set MyChildDispenser.dispenses to MyGeneric
     
     - Next, you will need to decide on the syntax for the command the player will type
to get the dispenser to dispense. For instance, on a candy machine, they may need
to press a button. This part is perhaps what gives this generic the most flexibility.
You can give it almost any syntax. But note that you'll need the `this' argument
in there somewhere. Programmers should understand this.
     
     For the example, lets try for this syntax: "press push any on this"
     So someone could type: push button on MyChildDispenser or press tab on MyChildDispenser.
     
     Now, to set up this syntax you'll need to type:
      @set MyChildDispenser.verb_name to "press push"
     
      @set MyChildDispenser.verb_args to {"any", "on", "this"}
     
     Note that the name must be a string and the arguments a list of strings.
     
     - Now simply type: @setup MyChildDispenser
     
     The barest essentials are now complete. You can even test it now and press button
on MyChildDispenser. You should get a child of MyGeneric which is identical in all
respects to the parent in name, alias, and description.
     
     You can customize your dispenser to create children which are unique, however. But
first, you can set a couple of messages:
     
     @dispense MyChildDispenser is "You get a brand new cotton candy from the cotton candy
machine."
     @odispense MyChildDispenser is "Visitor pushes a button and gets a new cotton candy
from the cotton candy machine."
     
     Note that cotton candy refers to the new child and cotton candy machine to the MyChildDispenser.
     
     Now, for further customization, you'll need to program some verbs.
     After a player invokes the dispenser with your defined command, :dispense_item is
called. This verb does the following in order:
     
     1) calls :check_dispenses (which you can override and customize) to see if the dispenser
has a valid and fertile .dispenses.
     2) calls :pre_dispense and passes all arguments. This verb is useful for setting
up the new objects name, aliases and description via the provided :set_new_name :set_new_aliases
:set_new_desc verb. You can override this verb and do your own behavior, including
parsing the arguments any way you like.
     3) creates the new object and calls :prepare_obj. Do NOT override :prepare_obj. This
verb simply loads in the new name, alias, and description set via :pre_dispense and
moves the object to the player.
     4) calls :post_dispense which you can override. This verb simply displays messages.
     
     Do not override :dispense_item with your own verb. It won't work.
     
     Further documentation can be found in each verb. Also, you can ask Dredful.
VERB SOURCE CODE: grab steal: set_task_perms(player); this:dispense_item(argstr); . PROPERTY DATA: |