Solved On pickup event|Count the amount of items

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Dabriel

Member
Aug 13, 2018
45
5
0
27
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_language.skript:
message "&r       &a&l+%{pickedupamount}%G" #{pickedupamount} = The amount player picked up

I tried this,
code_language.skript:
on pick up of emerald:
if event-item is emerald named "&aGem":
    set {_amount} to amount of event-item
    message "&r     &a&l+%{_amount}%G"

But it just didn't work.
Is there any other way I could do this?
 
Use %item amount%:
code_language.skript:
set {_amount} to item amount of event-item

code_language.skript:
    Item Amount:
        ID: ExprItemAmount
        Description:
            The amount of an item stack.
        Examples:
            send "You have got %item amount of player's tool% %player's tool% in your hand !" to player
        Since:
            2.2-dev24
        Return type: Number
        Changers:
            add
            set
            remove
            delete
            reset
        Patterns:
            [the] item[[ ]stack] (amount|size|number) of %itemstacks%
            %itemstacks%'[s] item[[ ]stack] (amount|size|number)
    Item Enchantments:
 
Use %item amount%:
code_language.skript:
set {_amount} to item amount of event-item

code_language.skript:
    Item Amount:
        ID: ExprItemAmount
        Description:
            The amount of an item stack.
        Examples:
            send "You have got %item amount of player's tool% %player's tool% in your hand !" to player
        Since:
            2.2-dev24
        Return type: Number
        Changers:
            add
            set
            remove
            delete
            reset
        Patterns:
            [the] item[[ ]stack] (amount|size|number) of %itemstacks%
            %itemstacks%'[s] item[[ ]stack] (amount|size|number)
    Item Enchantments:
Thank you so much! You have no idea for how long I was trying to get this working!
 
  • Like
Reactions: jaylawl
Use %item amount%:
code_language.skript:
set {_amount} to item amount of event-item

code_language.skript:
    Item Amount:
        ID: ExprItemAmount
        Description:
            The amount of an item stack.
        Examples:
            send "You have got %item amount of player's tool% %player's tool% in your hand !" to player
        Since:
            2.2-dev24
        Return type: Number
        Changers:
            add
            set
            remove
            delete
            reset
        Patterns:
            [the] item[[ ]stack] (amount|size|number) of %itemstacks%
            %itemstacks%'[s] item[[ ]stack] (amount|size|number)
    Item Enchantments:
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
Reactions: jaylawl
Hey. I'm using this file which was extracted by TusKe: https://hastebin.com/epayamidef.coffeescript
This should be more or less the official skript documentation, which afaik is this: https://skriptlang.github.io/Skript/expressions.html#ExprFormatTime
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:
 
Status
Not open for further replies.