1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Format Slot - NBT Edition (SkStuff)

Discussion in 'Snippets' started by Duetro, May 26, 2017.

  1. Duetro

    Duetro Active Member

    Joined:
    Jan 26, 2017
    Messages:
    138
    Likes Received:
    51
    Medals:
    Example:
    [​IMG]

    Code (Skript):
    1. command /xxxx:
    2.     trigger:
    3.         open chest with 3 rows named "test" to player
    4.         formatSlot(player's current inventory, 10, 1, (diamond named "&b&lDIAMOND"), "broadcast ""Skript is awesome!""")

    Requires:
    - SkStuff
    - SkQuery


    Code:
    Code (Skript):
    1. function formatSlot(inv: inventory, slot: integer, amount: integer, item: item, action: text = ""):
    2.     if {cfs.p} isn't set:
    3.         set {cfs.p} to random 4 char string from `a-zA-Z0-9`
    4.  
    5.     set slot {_slot} of {_inv} to {_amount} of {_item}
    6.     if {_action} isn't "":
    7.         replace all """" in {_action} with "|q?%{-cfs.p}%|"
    8.         replace all "," in {_action} with "|c?%{-cfs.p}%|"
    9.         replace all "%%" in {_action} with "|p?%{-cfs.p}%|"
    10.        
    11.         add "{SkriptClickEvent:%{_action}%}" to nbt of slot {_slot} of {_inv}
    12.  
    13. on drop:
    14.     "%nbt of event-item%" contains "SkriptClickEvent"
    15.     cancel event
    16. on inventory click:
    17.     set {_} to tag "SkriptClickEvent" of (nbt of slot clicked slot of player's current inventory)
    18.     {_} is set
    19.     cancel event
    20.     replace all "|q?%{-cfs.p}%|" in {_} with """"
    21.     replace all "|c?%{-cfs.p}%|" in {_} with ","
    22.     replace all "|p?%{-cfs.p}%|" in {_} with "%%"
    23.     evaluate "%{_}%"
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    In the picture i see the "+" on chat what is it ?
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    I am using the "5-Zig" mod
     
    • Funny Funny x 1

Share This Page

Loading...