Paste #70976: Test

Date: 2020/06/18 01:56:48 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#Acts as the start of the process
NPost_main_task:
    type: assignment

    interact scripts:
    - Npost_interact

    actions:
        on assignment:
            - trigger name:click state:true
        on click:
                    - chat "Oh, hey <player.name>! Fred here with Nordic Post. How can I help you?"

#initialization and definitions
Npost_init:
    type: task
    script:
        - define npcLocation:<location.town>
        - define playerpartoftown:<player.has_town>
        - define playertown:<player.town>
        - define townstatus:<Town.is_open>


#interact scripts
Npost_interact:
    type: interact
    steps:
        1:
            # This determines what menu to displays
            # Residents of the town gets Menu 2 automatically.
            - if <[npcLocation]> == <[playertown]>:
                - wait 3s
                - zap 2

            #then it checks if the town is open, even?
            # If Town is closed, disables the join option for Non-Residents or Wanderers.
            - else if <[townstatus]> == false:
                - wait 5s
                - zap 5

            # Non-Residents of the town gets Menu 3 (allows to switch towns).
            # Runs a if town is open or not.
            - else if <[townstatus]> && <[npcLocation]> != <[playertown]>:
                - wait 3s
                - zap 3

            # wanderers will fall into this condition
            - else if <[playerpartoftown]> == false && <[townstatus]>:
                - wait 3s
                - zap 4

            # any other options (does not belongs to any town or wonky) gets Menu 4. Sloppy cleanup.
            - else
                - wait 5s
                - zap 5

        2:
            #current residents menu
            events:
            - inventory open d:in@Post_Inventory_Menu_CurrentTown
            on player clicks in Post_Inventory_Menu_CurrentTown priority:100:
            - determine cancelled
            on player drags in Post_Inventory_Menu_CurrentTown priority:100:
            - determine cancelled
            on player clicks PIM_readmail in Post_Inventory_Menu_CurrentTown:
            - ex as_op /mailme read
            on player clicks PIM_sendmail in Post_Inventory_Menu_CurrentTown:
            - ex as_op /mailme send
            on player clicks PIM_leavetown in Post_Inventory_Menu_CurrentTown:
            - inventory open d:in@PIM_ConfirmLeave
            on player clicks PIM_exit in Post_Inventory_Menu_CurrentTown:
            - inventory close

        3:
            #Non-Residents Menu
            events:
            - inventory open d:in@Post_Inventory_Menu_NotMemberTown
            on player clicks in Post_Inventory_Menu priority:100:
            - determine cancelled
            on player drags in Post_Inventory_Menu priority:100:
            - determine cancelled
            on player clicks PIM_readmail in Post_Inventory_Menu:
            - ex as_op /mailme read
            on player clicks PIM_sendmail in Post_Inventory_Menu:
            - ex as_op /mailme send
            on player clicks PIM_switchtown in Post_Inventory_Menu:
            - inventory open d:in@PIM_ConfirmSwitch
            on player clicks PIM_exit in Post_Inventory_Menu:
            - inventory close

        4:
            #Wanderers Menu
            events:
            - inventory open d:in@Post_Inventory_Menu_Wanderer
            on player clicks in Post_Inventory_Menu priority:100:
            - determine cancelled
            on player drags in Post_Inventory_Menu priority:100:
            - determine cancelled
            on player clicks PIM_readmail in Post_Inventory_Menu:
            - ex as_op /mailme read
            on player clicks PIM_sendmail in Post_Inventory_Menu:
            - ex as_op /mailme send
            on player clicks PIM_leavetown in Post_Inventory_Menu:
            - inventory open d:in@PIM_Confirm
            on player clicks PIM_exit in Post_Inventory_Menu:
            - inventory close
        5:
            #Closed Town Menu
            events:
            - inventory open d:in@Post_Inventory_Menu_ClosedTown
            on player clicks in Post_Inventory_Menu priority:100:
            - determine cancelled
            on player drags in Post_Inventory_Menu priority:100:
            - determine cancelled
            on player clicks PIM_readmail in Post_Inventory_Menu:
            - ex as_op /mailme read
            on player clicks PIM_sendmail in Post_Inventory_Menu:
            - ex as_op /mailme send
            on player clicks PIM_exit in Post_Inventory_Menu:
            - inventory close

# Menu Lists/Actions

Post_inventory_Menu_CurrentTown:
    type: inventory
    inventory: chest
    title: Nordic Post Office Menu - Current Resident
    Size: 27
    slots:
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"
    - "[PIM_filler] [PIM_readmail] [PIM_filler] [PIM_sendmail] [PIM_filler] [PIM_leavetown] [PIM_filler] [PIM_exit] [PIM_filler]"
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"

Post_Inventory_Menu_JoinableTown:
    type: inventory
    inventory: chest
    title: Nordic Post Office Menu - Wanderer
    Size: 27
    slots:
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"
    - "[PIM_filler] [PIM_readmail] [PIM_filler] [PIM_sendmail] [PIM_filler] [PIM_jointown] [PIM_filler] [PIM_exit] [PIM_filler]"
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"

Post_Inventory_Menu_NotMemberTown:
    type: inventory
    inventory: chest
    title: Nordic Post Office Menu - Non-Resident
    Size: 27
    slots:
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"
    - "[PIM_filler] [PIM_readmail] [PIM_filler] [PIM_sendmail] [PIM_filler] [PIM_switchtown] [PIM_filler] [PIM_exit] [PIM_filler]"
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"

Post_Inventory_Menu_ClosedTown:
    type: inventory
    inventory: chest
    title: Nordic Post Office Menu - Town Closed to New Residents
    Size: 27
    slots:
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"
    - "[PIM_filler] [PIM_readmail] [PIM_filler] [PIM_sendmail] [PIM_filler] [PIM_denytown] [PIM_filler] [PIM_exit] [PIM_filler]"
    - "[PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler] [PIM_filler]"

PIM_ConfirmScreen:
    type: inventory
    inventory: hopper
    title: Do you Confirm Joining <[npcLocation]>?
    size: 5
    slots:
    - "[PIM_filler][PIM_Confirm][PIM_filler][PIM_Deny][PIM_filler]"

PIM_Confirmleave:
    type: inventory
    inventory: hopper
    title: Do you Confirm your Action?
    size: 5
    slots:
    - "[PIM_filler][PIM_Confirm][PIM_filler][PIM_Deny][PIM_filler]"


PIM_ConfirmSwitch:
    type: inventory
    inventory: hopper
    title: Do you Confirm you want to switch towns from <&l><[playerTown]> to <&l><[npcLocation]]>?
    size: 5
    slots:
    - "[PIM_filler][PIM_switchtown][PIM_filler][PIM_Deny][PIM_filler]"

PIM_filler:
    type: item
    material: black_stained_glass

PIM_readmail:
    type: item
    material: written_book
    display name: Read my Mail

PIM_sendmail:
    type: item
    material: book_and_quill
    display name: Write an Mail Message

PIM_leavetown:
    type: item
    material: red_bed
    display name: Leave this Town?

PIM_jointown:
    type: item
    material: green_bed
    display name: Join this Town?

PIM_switchtown:
    type: item
    material: green_bed
    display name: Change your Town Citizenship to this Town?

PIM_denytown:
    type: item
    material: barrier
    display name: You are not permitted to join this town at this time!

PIM_exit:
    type: item
    material: barrier
    display name: Exit this Menu

PIM_Confirm:
    type: item
    material: green_wool
    display name: Yep, I confirm.

PIM_Deny:
    type: item
    material: red_wool
    display: No, I changed my mind!

PIM_switchtown:
    type: item
    material: red_wool
    display: Switch my town to this town!