Paste #78804: Appraiser Script

Date: 2020/12/14 22:34:27 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#  This is a test file for the appraiser for our server economy. It allows players  #
    #  to execute the /worth and /sell functions through assigning a GUI to an NPC.     #

appraiser_npc:
  type: assignment
  actions:
    on assignment:
    #Enable/disable triggers for following actions.
    - trigger name:click state:true
    - trigger name:chat state:true
    on click:
    - narrate "Hey <player.name>, Lets take a look at what you've got to sell."
    - wait 2s
    - inventory open d:appraiser_inventory

    #  This section defines the GUI arguments such as size and what goes in each slot,  #
    #  items must be added to the inventory slots below as well so that they are id'd.  #

appraiser_inventory:
    type: inventory
    inventory: chest
    title: Mysterious Merchant
    size: 27
    slots:
    - *[] [] [] [] [] [] [] [] []*
    - *[] [] [] [] [] [] [] [] [appraiser_inventory_menu_worth_button]*
    - *[] [] [] [] [] [] [] [] [appraiser_inventory_menu_sell_all_button]*

    # This section defines the items that go in each slot of the above ^^ GUI           #
    # NOTE: Any added items must be added above as well.                                #

appraiser_inventory_menu_worth_button:
    type: item
    material: green_wool
    display name: Appraise All

appraiser_inventory_menu_sell_all_button:
    type: item
    material: red_wool
    display name: Sell All

    # This section defines the commands that are associated to each button in the GUI.  #

appraiser_inventory_handler:
    type: world
    events:
      on player clicks appraiser_inventory_worth_button:
      - determine cancelled
      - run as_op essentials:worth d:appraiser_inventory
      on player clicks appraiser_inventory_menu_sell_all_button:
      - determine cancelled
      - run as_op essentials:sell d:appraiser_inventory
      on player clicks appraiser_inventory_menu_slot_27 in appraiser_inventory:
      - run as_op essentials:worth d:appraiser_inventory