- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register








The script repo is an archive of historical scripts. For modern scripts, or to post your own, please use the Scripts forum section.





Staff Pick: Item Bind API


By DNx
Created: 2016/09/29 06:20:25 UTC-07:00 (5 years and 69 days ago)
Edited: 2016/09/29 06:56:10 UTC-07:00 (5 years and 69 days ago)
Likes: 0

Staff pick as of: 2016/12/07 23:35:33 UTC-08:00 (5 years and 0 days ago)
Denizen Version: 1.0.0
Script Version: 0.01
Description:

Prevent player from abusing the given items.
Usage:
Prefix your item script name with "Bind_".
Example: "Bind_OpenMenuItem"


Download script | View raw script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
4000

BindItem_Listener:
  type: world
  debug: false
  events:
    on player changes gamemode to creative:
    - foreach <player.inventory.list_contents>:
      - if <def[value].scriptname.starts_with[Bind_]||false> take <def[value]> qty:<player.inventory.quantity[<def[value]>]>
    on player drops item:
    - if <c.item.scriptname.starts_with[Bind_]||false> determine CANCELLED
    on player drags item:
    - if <c.item.scriptname.starts_with[Bind_]||false> && <c.raw_slots.filter[is[less].than[<c.inventory.size>]].size.is[more].than[0]> determine CANCELLED
    on player clicks in inventory:
    - if <c.action.is[==].to[NOTHING]> queue clear
    - if <c.action.starts_with[DROP].and[<c.cursor_item.scriptname.starts_with[Bind_].or[<c.item.scriptname.starts_with[Bind_]||false>]||false>]||false> determine CANCELLED
    - if <c.item.scriptname.starts_with[Bind_]||false> {
      - if <c.action.starts_with[DROP]> determine CANCELLED
      - if <c.action.is[==].to[MOVE_TO_OTHER_INVENTORY]> && <c.inventory.inventory_type.is[!=].to[CRAFTING]> {
        - determine CANCELLED
        }
      }
    - if <c.cursor_item.scriptname.starts_with[Bind_]||false> {
      - if <c.action.starts_with[DROP]> || <c.raw_slot.is[or_less].than[<c.inventory.size>]> {
        - determine passively CANCELLED
        - inventory update d:<player.inventory>
        - queue clear
        }
      }
    - if <c.action.is[==].to[HOTBAR_SWAP]> {
      - if <player.inventory.slot[<c.hotbar_button>].scriptname.starts_with[Bind_]||false> && <c.raw_slot.is[or_less].than[<c.inventory.size>]> determine CANCELLED
      }
    on item recipe formed:
    - if <c.recipe.parse[scriptname].filter[starts_with[Bind_]].size.is[more].than[0]> determine CANCELLED
    on player death:
    - determine <c.drops.exclude[<c.drops.filter[scriptname.starts_with[Bind_]]>]>
    on system time hourly:
    - webget "http://stats.denizenscript.com/tracker?script=114&version=0.01"








View History