#(yukiyahana) How to get the slot of <context.item> in the inventory

40 messages · Page 1 of 1 (latest)

junior coral
#

Using '- inventory adjust durability' requires the slot where the item is located, but players can place the item in either their left or right hand. The player's issue can be resolved in a relatively simple manner, but there's also the issue with items in a dispenser. When the event 'on dispenser dispenses item' is triggered, even if '- determine cancelled' is passively placed as the first command, it still reports that the dispenser has 9 empty slots (originally there should be a tool inside). Is there any way to get this?

lucid merlinBOT
#

(yukiyahana) How to get the slot of <context.item> in the inventory

lucid merlinBOT
#

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.

junior coral
#

anyone!?

keen pumice
#

Hi

#

not sure what you're asking

#

can you explain and post your script?

#

!paste

vestal vaultBOT
zinc elk
#

I don't think a context exists for this event, even on the spigot api. Maybe the paper API but I could be wrong?

#

I suppose a quick solution would be...

#

!t inventorytag.find_item

vestal vaultBOT
zinc elk
junior coral
# zinc elk !t inventorytag.find_item

Sorry for the late reply
Can <InventoryTag.find_item[<matcher>]> match a specific item?
I tried <context.bow> but it doesn't work
If a player holds multiple identical items, this will cause problems with my script

junior coral
# keen pumice can you explain and post your script?

https://paste.denizenscript.com/View/117008

This is my script, along with specific explanations

zinc elk
#

Also.

#

!tias

vestal vaultBOT
# zinc elk !tias
Info: tias

Try it and see!

If somebody pulled this up for you, you're probably asking a question of the public channel that's easier and faster to figure out by just attempting your idea in-game and looking at the result of that attempt.

languid agate
#

!e dispenser dispenses

vestal vaultBOT
# languid agate !e dispenser dispenses
Group

Block

Event Lines

<block> dispenses <item>

Triggers

when a block dispenses an item.

Context

<context.location> returns the LocationTag of the dispenser.
<context.item> returns the ItemTag of the item being dispensed.
<context.velocity> returns a LocationTag vector of the velocity the item will be shot at.

Determine

LocationTag to set the velocity the item will be shot at.
ItemTag to set the item being shot.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

junior coral
#

<context.bow> is 'after player shoots crossbow' one

languid agate
#

Spigot doesn't seem to expose the slot, you could theoretically go over all of the dispenser's items and find one that's equal to the one being dispensed, but that isn't flawless either

zinc elk
#

Oh I see you're also having trouble seeing which slot the hand is in for the shoots event.

#

This seems to be a missing context.

junior coral
#

Yes, this issue has been troubling me for two days, driving me crazy

zinc elk
#

But the denizen event has no context for it.

zinc elk
languid agate
#

Yeah that event looks like it could be useful for that, could feature request that if you'd like

junior coral
#

It seems that to solve this problem, I might have to do a feature request. How should I go about doing this?

languid agate
#

Create a thread explaining your request and /featurethread

junior coral
languid agate
#

No worries! feel free to open these feature threads if you'd like to requerst that, but for this thread -

bitter oxideBOT
#
Thread Closing Reminder

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.)

#

@junior coral