Paste #20949: selection tool

Date: 2015/10/15 16:52:06 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


nsatool:
    type: command
    name: nsatool
    description: "give yourself the area selection tool for npcs. drop item to clear locations"
    usage: /nsatool
    permission: nsatool.use
    script:
    - if !<player.has_permission[nsatool.use]> {
        - narrate "<red>you do not have permission for this command"
        } else {
            - give selectiontool qty:1 player:<player>
            }
nsatoolsave:
    type: command
    name: nsasave
    description: "save current locations under name"
    usage: /nsasave <&lt>savename<&gt>
    script: 
    - if <global.flag[sellocation1]> !== global.flag[sellocation1] {
        - if <global.flag[sellocation2]> == global.flag[sellocation2] {
            - narrate "second selection is <global.flag[sellocation2]>"
            - narrate "first selection is <global.flag[sellocation1]>"
            - narrate "single selection mode detected"
            - flag global nsa_<context.raw_args>:<global.flag[sellocation1]>
            } else {
                - narrate "second selection is <global.flag[sellocation2]>"
                - narrate "first selection is <global.flag[sellocation1]>"
                - narrate "cuboid area detected switching modes"
                - note cu@<global.flag[sellocation1]>|<global.flag[sellocation2]> as:<context.raw_args> 
                }
        } else {
            - narrate "you have no selection defined"
            }

selectiontool:
    type: item
    material: i@wood_axe
    display name: selectiontool
selectiontoolhandler:
    type: world
    events:
        on player right clicks block with selectiontool:
        - flag global sellocation1:<context.location>
        - wait .5
        - narrate "location one saved as <global.flag[sellocation1]>"
        on player left clicks block with selectiontool:
        - flag global sellocation2:<context.location>
        - wait .5
        - narrate "location two saved as <global.flag[sellocation2]>"
        on player drops selectiontool:
        - narrate "locations cleared"
        - flag global sellocation1:null duration:1s
        - flag global sellocation2:null duration:1s
        - determine cancelled