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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved Help item to chat

Discussion in 'Skript' started by bajinzin, Aug 31, 2021.

Tags:
Thread Status:
Not open for further replies.
  1. bajinzin

    bajinzin New Member

    Joined:
    Aug 31, 2021
    Messages:
    5
    Likes Received:
    0
    [​IMG]
    https://gyazo.com/2b76d4f08c3817773e6eb916d0aa838b



    Code (Text):
    1. #------------------
    2. # ChatItem
    3. # - Version 1.7.1
    4. # - Created by D4isDAVID
    5. #------------------
    6. # Dependencies:
    7. # - Minecraft 1.9+
    8. # - Skript 2.5.3+
    9. # - SkBee 1.10.1+
    10. #------------------
    11. # Config
    12. options:
    13.     # itemName - how the item name will look like in chat. default: &8[&r{name}&r &7x{amount}&8]&r
    14.     # {name} is the item name and {amount} is the amount of the item
    15.     itemName: &f[&[email protected]&6{name}&r]
    16. #------------------
    17.  
    18. on chat:
    19.     set {_slotList::hand} to index of player's hotbar slot
    20.     set {_keywordList::hand::*} to "[hand]", "[item]" and "[i]"
    21.     set {_slotList::offhand} to 40
    22.     set {_keywordList::offhand::*} to "[offhand]"
    23.     set {_slotList::helmet} to 39
    24.     set {_keywordList::helmet::*} to "[helmet]", "[helm]", "[cap]" and "[head]"
    25.     set {_slotList::chestplate} to 38
    26.     set {_keywordList::chestplate::*} to "[chestplate]", "[tunic]" and "[chest]"
    27.     set {_slotList::leggings} to 37
    28.     set {_keywordList::leggings::*} to "[leggings]", "[pants]" and "[legs]"
    29.     set {_slotList::boots} to 36
    30.     set {_keywordList::boots::*} to "[boots]", "[feet]"
    31.     loop indices of {_keywordList::*}:
    32.         loop {_keywordList::%loop-value%::*}:
    33.             message contains loop-value-2
    34.             add {_slotList::%loop-value-1%} to {_items::*}
    35.             add loop-value-2 to {_keywords::*}
    36.             exit 1 loop
    37.     if size of {_keywords::*} > 0:
    38.         cancel event
    39.         set {_message} to message
    40.         loop {_keywords::*}:
    41.             loop indices of {_keywordList::*}:
    42.                 {_keywordList::%loop-value-2%::*} contains loop-value-1
    43.                 loop {_keywordList::%loop-value-2%::*}:
    44.                     loop-value-3 is not loop-value-1
    45.                     replace all loop-value-3 with "" in {_message}
    46.             set {_messages::*} to {_message} split at "%loop-value%"
    47.             set {_temp} to {_messages::1}
    48.             delete {_messages::1}
    49.             set {_message} to "%{_temp}%%loop-value%%join {_messages::*} with """"%"
    50.             replace all loop-value with "{CIplaceholder}:{%loop-index%}:{CIplaceholder}" in {_message}
    51.         set {_messages::*} to {_message} split at "{CIplaceholder}"
    52.         loop {_messages::*}:
    53.             set {_messages::%loop-index%} to a new text component of "%loop-value%"
    54.             "%loop-value%" is ":{1}:", ":{2}:", ":{3}:", ":{4}:", ":{5}:" or ":{6}:"
    55.             set {_itemIndex} to subtext of "%loop-value%" from characters 3 to 3
    56.             set {_itemIndexes::%{_itemIndex}%} to loop-index
    57.         loop {_items::*}:
    58.             delete {_name}
    59.             set {_item} to loop-value
    60.             if {_item} is a number:
    61.                 set {_item} to slot {_item} of player's inventory
    62.             if {_item} is not set:
    63.                 set {_messages::%{_itemIndexes::%loop-index%}%} to a new text component of "%{_keywords::%loop-index%}%"
    64.             else if {_item} is not air:
    65.                 set {_name} to name of {_item}
    66.                 if {_name} is not set:
    67.                     set {_name} to a new translate component from {_item}
    68.                 set {_amount} to amount of {_item} in player's inventory
    69.                 set {_itemName} to "{@itemName}"
    70.                 replace "{name}" with "%{_name}%"  in {_itemName}
    71.                 replace "{amount}" with "%{_amount}%" in {_itemName}
    72.                 set {_itemName} to a new text component of "%{_itemName}%"
    73.                 set hover event of {_itemName} to a new hover event showing {_item}
    74.                 set {_messages::%{_itemIndexes::%loop-index%}%} to {_itemName}
    75.             else:
    76.                 set {_messages::%{_itemIndexes::%loop-index%}%} to a new text component of "%{_keywords::%loop-index%}%"
    77.         set {_messageFormat::*} to message format split at "[message]"
    78.         replace "[player]" with player's display name in {_messageFormat::1}
    79.         if message format contains message:
    80.             set {_messageFormat::*} to message format split at message
    81.         set {_temp} to a new text component of "%{_messageFormat::1}%"
    82.         delete {_messageFormat::1}
    83.         loop all players:
    84.             send components {_temp}, {_messages::*} and {_messageFormat::*} to loop-player
    85.         send components {_temp}, {_messages::*} and {_messageFormat::*} to console
    Link: https://forums.skunity.com/resources/chatitem.1168/

    @D4isDAVID

     
  2. Best Answer:
    Post #4 by barrybtw, Sep 1, 2021
  3. barrybtw

    barrybtw Active Member

    Joined:
    Jun 8, 2021
    Messages:
    82
    Likes Received:
    6
    Doesn't seem like errors to say, just skript not liking you :emoji_smirk:
     
  4. bajinzin

    bajinzin New Member

    Joined:
    Aug 31, 2021
    Messages:
    5
    Likes Received:
    0
    is there anything i can do to fix this "notice" on the console?
     
  5. barrybtw

    barrybtw Active Member

    Joined:
    Jun 8, 2021
    Messages:
    82
    Likes Received:
    6
    Turn the errors of that category off in the skript config.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...