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 our 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 On pickup event|Count the amount of items

Discussion in 'Skript' started by Dabriel, Aug 18, 2018.

Thread Status:
Not open for further replies.
  1. Dabriel

    Dabriel Well-Known Member

    Joined:
    Aug 13, 2018
    Messages:
    45
    Likes Received:
    5
    Hello, fellow scripters,
    I'm new here, so my name is Dabriel (Tyler), and I'm looking for a solution for this feature that I'm trying to create.
    Simply, on pick up of emerald named "&aGem", I want to send a message to the player that picked the item up, and tell him the amount that he picked up. like:
    Code (Skript):
    1. message "&r       &a&l+%{pickedupamount}%G" #{pickedupamount} = The amount player picked up
    I tried this,
    Code (Skript):
    1. on pick up of emerald:
    2. if event-item is emerald named "&aGem":
    3.     set {_amount} to amount of event-item
    4.     message "&r     &a&l+%{_amount}%G"
    But it just didn't work.
    Is there any other way I could do this?
     
  2. Best Answer:
    Post #2 by jaylawl, Aug 18, 2018
  3. jaylawl

    jaylawl Well-Known Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Use %item amount%:
    Code (Skript):
    1. set {_amount} to item amount of event-item
    Code (Skript):
    1.     Item Amount:
    2.         ID: ExprItemAmount
    3.         Description:
    4.             The amount of an item stack.
    5.         Examples:
    6.             send "You have got %item amount of player's tool% %player's tool% in your hand !" to player
    7.         Since:
    8.             2.2-dev24
    9.         Return type: Number
    10.         Changers:
    11.             add
    12.             set
    13.             remove
    14.             delete
    15.             reset
    16.         Patterns:
    17.             [the] item[[ ]stack] (amount|size|number) of %itemstacks%
    18.             %itemstacks%'[s] item[[ ]stack] (amount|size|number)
    19.     Item Enchantments:
     
    • Winner Winner x 1
  4. Dabriel

    Dabriel Well-Known Member

    Joined:
    Aug 13, 2018
    Messages:
    45
    Likes Received:
    5
    Thank you so much! You have no idea for how long I was trying to get this working!
     
    • Like Like x 1
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Hey Jaylawl.... im just curious... where are you finding documentation like that?
    Ive seen it payed out that way a few times, im just wondering where that is from
     
    • Like Like x 1
  6. jaylawl

    jaylawl Well-Known Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Ahhh okay cool... I was always wondering where people got that version of documentation.
    And yeah that is the official docs for Bensku's fork. Unfortunately he hasn't updated it since dev36.... i built my own for dev37c and popped it on my website for quick reference .... just so i had the update to date version :emoji_wink:
     
Thread Status:
Not open for further replies.
Loading...