Paste #107437: code

Date: 2023/03/16 09:16:52 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


dice_pot2:
    type: item
    material: flower_pot
    display name: Pot with Dices2
    lore:
    - This is pot with some dices inside
    - Simple Dice Game
    allow in material recipes: false

dice_pot_games_list:
    type: data
    games:
    - Simple Dice Game
    - Pig Dice Game
    - One more
    - And one more

dice_pot_world2:
    debug: true
    type: world
    events:
        on player right clicks entity with:dice_pot2:
        - ratelimit <player> 1s
        - narrate "click on player"
        - determine cancelled
        on player right clicks air with:dice_pot2:
        - ratelimit <player> 1s
        - define tmp:<player.item_in_hand.lore.get[1].after[- ]>
        - define num:<script[dice_pot_games_list].data_key[games].find_match[<[tmp]>]>
        - define num:++
        - if <[num]> > <script[dice_pot_games_list].data_key[games].size>:
            - define lore:<script[dice_pot_games_list].data_key[games].get[1]>
            - inventory adjust slot:hand "lore:- <[lore]>"
            - narrate "You select <player.item_in_hand.lore.get[1].after[- ]> to play"
        - else:
            - define lore:<script[dice_pot_games_list].data_key[games].get[<[num]>]>
            - inventory adjust slot:hand "lore:- <[lore]>"
            - narrate "You select <player.item_in_hand.lore.get[1].after[- ]> to play"
        - if <player.item_in_hand.lore.get[1].after[- ].contains_match[*Pig*]>:
            - narrate test
        on player right clicks !*air with:dice_pot2:
        - determine cancelled