#amount of items
1 messages · Page 1 of 1 (latest)
i would loop every slot the player has, make smth like {_x} be the amount of items he has in that slot then add it to a diff variable like {_total}
i was bored so i coded it
function totalItems(p: player):
loop 36 times:
if {_y} is not set:
set {_y} to 0
set {_x} to item amount of slot loop-value - 1 of {_p}'s inventory
add {_x} to {_y}
send "You have &2&l%{_y}% &r&aitems in your inventory!" to {_p}
command /tallyinventory [<player>]:
trigger:
if argument is set:
totalItems(argument)
else:
totalItems(player)
check if this works
command /tallyinventory <p: player=%player%>:
trigger:
totalItems({_p})
yes, it works, thank you!! Please tell me more how I can find the amount of a particular item that has a unique name and description
just item amount of slot {_somevar} should also work but you can also do smth like amount of {var_item} in player's inventory
also amount of stick named "lolxd" in player's inventory and stuff liek that work too
sorry, i didnt understood, I tried to insert your lines into the code, and for some reason it didn't work out for me. What should it look like in code?
oh these are like expressions and not actual pieces of code
you should keep training on seeing how skript format looks
you can apply these for example:
command /testing <player> <number>:
if argument-2 is 1:
set {_x} to amount of stick named "lolxd" in argument-1's inventory
else if argument-2 is 2:
set {_testvar} to stick named "lolxd"
set {_x} to amount of {_testvar} in argument-1's inventory
else:
send "&cInvalid test number!" to argument-1
stop
if argument-1 is player:
send "&aYou have &2&l%{_x}% &r&aof that stick!" to player
stop
send "&e%argument-1% &ahas &2&l%{_x}% &r&aof that stick!" to player
send "&aYou have &2&l%{_x}% &r&aof that stick!" to argument-1
on inventory click:
event-item is stick named "lolxd"
set {_x} to event-itemstack
send "&aYou clicked on a stack of &2&l%{_x}%&r&a custom sticks!"
just some examples
try to wrap your head around the code