#(itsnoury) offhand
48 messages · Page 1 of 1 (latest)
(itsnoury) offhand
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.
!e swaps items
Player
player swaps items
main:<item> to only process the event if the item being put into the main hand matches the input item.
offhand:<item> to only process the event if the item being put into the off-hand matches the input item.
when a player swaps the items in their main and off hands.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.main> returns the ItemTag switched to the main hand.
<context.offhand> returns the ItemTag switched to the off hand.
"MAIN:<ItemTag>" to set the item in the main hand.
"OFFHAND:<ItemTag>" to set the item in the off hand.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
And if you want to stop putting it there through the inventory as well,
!e inventory click
Did you mean to search for player click_type clicks item in inventory?
Player
player (<click_type>) clicks (<item>) in <inventory>
with:<item> to only process the event if a specified cursor item was used.
in_area:<area> replaces the default 'in:<area>' for this event.
action:<action> to only process the event if a specified action occurred.
slot:<slot> to only process the event if a specified slot or slot_type was clicked. For slot input options, see !language Slot Inputs.
when a player clicks in an inventory. Note that you likely will also want to listen to !event player drags in inventory.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.item> returns the ItemTag the player has clicked on.
<context.inventory> returns the InventoryTag (the 'top' inventory, regardless of which slot was clicked).
<context.clicked_inventory> returns the InventoryTag that was clicked in.
<context.cursor_item> returns the item the Player is clicking with.
<context.click> returns an ElementTag with the name of the click type. Click type list: <@link url...
<context.slot_type> returns an ElementTag with the name of the slot type that was clicked. Slot ty...
<context.slot> returns an ElementTag with the number of the slot that was clicked.
<context.raw_slot> returns an ElementTag with the raw number of the slot that was clicked.
<context.is_shift_click> returns true if 'shift' was used while clicking.
<context.action> returns the inventory_action. See <@link language Inventory Actions>.
... and 1 more.
ItemTag to set the current item for the event.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
!e drags in inventory
Player
player drags in inventory player drags (<item>) (in <inventory>)
in_area:<area> replaces the default 'in:<area>' for this event.
drag_type:<type> to only run the event if the given drag type (SINGLE or EVEN) was used.
when a player drags in an inventory (that is, clicks and then holds the mouse button down while moving the mouse across multiple slots).
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.item> returns the ItemTag the player has dragged.
<context.inventory> returns the InventoryTag (the 'top' inventory, regardless of which slot was clicked).
<context.clicked_inventory> returns the InventoryTag that was clicked in.
<context.slots> returns a ListTag of the slot numbers dragged through.
<context.raw_slots> returns a ListTag of the raw slot numbers dragged through.
<context.drag_type> returns either SINGLE or EVEN depending on whether the player used their left or right mouse button.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
uh sorry but how to make like a if statment with the offhand like which of the player drag <context.> returns the offhand?
<context.slots>returns a ListTag of the slot numbers dragged through.
Check if that contains the offhand slot's ID
(Not sure what is it offhand pun intended, but can test in-game and see)
ok thanks so much for the help :D
Thread closed as resolved.
uh small proplem so i'm using this on player clicks item in inventory: - if <context.slot> == 41: - determine cancelled right now to cancel the player putting item into offhand but when he tries ti put item it just disappers
Thread was manually reopened by @humble fog.
!debug
If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!
And also, what client are you testing with? default vanilla one or a modified one?
Thread is now a Help/Support thread. A helper will check your thread when available.
vanilla
Content of Server Log Paste #115748: Denizen Debug Logs From A Minecraft Server... pasted 2023/09/28 12:55:46 UTC-07:00, Paste length: 2586 characters across 33 lines, Content: Java Version: 17.0.7Up-time: 2m 42s
I think that's just a creative mode thing, try doing it in survival mode
Hmmm yeah it doen't take it tho now u can put items u just cant take them out
Content of Server Log Paste #115749: Denizen Debug Logs From A Minecraft Server... pasted 2023/09/28 13:19:58 UTC-07:00, Paste length: 9469 characters across 109 lines, Content: Java Version: 17.0.7Up-time: 26m
if u spam click it
u can put an item
So a single click is stopped as expected, but spamming puts it in?
yea
Sounds like a client desync thing - is the item actually there if you relog?
And do you cancel both drag and click? you might be accidently moving the mouse a bit or something which would fire the drag event
Not using drag because i tried to get it to fire anything to see <context.slot> but it wasn't firing at all
on player clicks item in inventory:
- if <context.slot> == 41:
- determine cancelled
on player drags item in inventory:
- if <context.slot> == 41:
- determine cancelled``` added it rn
and still same proplem
^ context.slot isn't a thing in drags
It's a list of slots, so can check if that contains 41
!l operator
An operator is a tool for comparing values, used by commands like !command if, !command while, !command waituntil, ... and tags like !tag ObjectTag.is.than
Available Operators include:
"Equals" is written as "==" or "equals".
"Does not equal" is written as "!=".
"Is more than" is written as ">" or "more".
"Is less than" is written as "<" or "less".
"Is more than or equal to" is written as ">=" or "or_more".
"Is less than or equal to" is written as "<=" or "or_less".
"does this list or map contain" is written as "contains". For example, "- if a|b|c contains b:" or "- if [a=1;b=2] contains b:"
"is this in the list or map" is written as "in". For example, "- if b in a|b|c:", or "- if [a=1;b=2] contains b:"
"does this object or text match an advanced matcher" is wr...
Comparables
"does this list or map contain" is written as "contains". For example, "- if a|b|c contains b:" or "- if [a=1;b=2] contains b:" the contains operator will be useful for this