#(norwaj) Armor check
38 messages · Page 1 of 1 (latest)
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can use
!t InventoryTag.equipment
Returns the equipment of an inventory as a list of items.
For players, the order is boots|leggings|chestplate|helmet.
For horses, the order is saddle|armor.
ListTag(ItemTag)
Returns a MapTag containing the inventory's equipment.
Output keys for players are boots, leggings, chestplate, helmet.
Output keys for horses are saddle, armor.
Air items will be left out of the map.
MapTag
Can I get a specific armor value on just the head or just the legs?
use equipment map for that
example, if they have leather helmet and boots, the output will be, in human readable code:
equipment_map:
helmet: leather_helmet
boots: leather_boots
you see how in this scenario, it doesn't have a leggings or chestplate key? that's because
Air items will be left out of the map.
so, using that in our advantage
you can simply check if the relevant key exists, to know if the player has something equipped
!t map.key
Returns a list of all keys in this map.
ListTag
# Narrates a list of 'a|b|c|'
- narrate <map[a=1;b=2;c=3].key>
Returns the object value at the specified key.
If a list is given as input, returns a list of values.
ObjectTag
# Narrates '2'
- narrate <map[a=1;b=2;c=3].get[b]>
# Demonstrates that list input gives list output - narrates '2' then '3'
- foreach <map[a=1;b=2;c=3].get[b|c]> as:value:
- narrate "One of the values is <[value]>"
!t object.exissts
Did you mean to search for objecttag.exists?
Returns true if the object exists (is non-null). Returns false if the object doesn't exist, is null, or the tag errored.
This functions as a fallback - meaning, if the tag up to this point errors, that error will be hidden.
ElementTag(Boolean)
!t has_equipped
Returns whether the entity has any armor equipment item that matches the given item matcher, using the system behind !language Advanced Object Matching.
For example, has_equipped[diamond_*] will return true if the entity is wearing at least one piece of diamond armor.
element checking
ElementTag(Boolean)
if thats relevant to you as well
oh whaaat that's a tag i have never heard of
Returns "true" if the map is empty (contains no keys), otherwise "false".
ElementTag(Boolean)
- if <map[a=1;b=2].is_empty>:
- narrate "This won't show"
- else:
- narrate "This will show! The map has stuff in it!"
- if <map.is_empty>:
- narrate "This will show! That map is empty!"
- else:
- narrate "This won't show"
if the equipment_map is empty, they nakey
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@regal flax