Paste #56908: So here’s my inventory

Date: 2019/08/16 01:54:04 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


my_inventory_menu:
    type: inventory
    title: Currency Changer
    size: 27 
    slots:
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [i@my_inventory_menu_slot12] [] [i@my_inventory_menu_slot14] [] [] []"
    - "[] [] [] [] [] [] [] [] []"

my_inventory_menu_slot12:
    type: item
    material: diamond
    display name: Diamonds --> Money

my_inventory_menu_slot14:
    type: item
    material: diamond
    display name: Money --> Diamonds

my_inventory_menu_handler:
    type: world
    events:
        on player clicks in my_inventory_menu:
            - determine cancelled
        on player drags in my_inventory_menu:
            - determine cancelled
        on player clicks my_inventory_menu_slot12 in my_inventory_menu:
            - if <player.inventory.contains.material[diamond]>:
                - take diamond
                - give money quantity:100
                - playsound <player> sound:ENTITY_EXPERIENCE_ORB_PICKUP
            - else:
                - inventory open d:in@no_diamond_gui
        on player clicks my_inventory_menu_slot14 in my_inventory_menu:
            - if <player.money> >= 100:
                - give diamond
                - take money quantity:100
                - playsound <player> sound:ENTITY_EXPERIENCE_ORB_PICKUP
            - else:
                - narrate "Insuffent funds."

no_diamond_gui:
    type: inventory
    title: Currency Changer
    size: 27 
    slots:
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [i@no_diamond_gui_slot12] [] [i@no_diamond_gui_slot14] [] [] []"
    - "[] [] [] [] [] [] [] [] []"

no_diamond_gui_slot12:
    type: item
    material: red_stained_glass_pane
    display name: Currently no diamonds to trade.

no_diamond_gui_slot14:   
    type: item
    - if <player.money> <= 100:
        material: red_stained_glass_pane
        display name: Insuffent funds