#(uncvr) Replacing an item in a custom GUI.

1 messages · Page 1 of 1 (latest)

civic storm
#

I'm trying to replace an item in my custom GUI, this is what I have for the world event.

    type: world
    events:
        after player clicks damage_indicator_off_item in server_menu:
            - ratelimit <player> 5t
            - narrate <context.slot>
            - playsound sound:block.note_block.pling <player> pitch:2
            - inventory set slot:<context.slot> o:<item[damage_indicator_on_item]>
            - stop

Specifying d: (destination) doesn't help.

silk sonnetBOT
#

(uncvr) Replacing an item in a custom GUI.

silk sonnetBOT
#

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.

plain quartz
#
  1. You dont need the <item[]> bit, just use the item name itself
#

!debug

calm canyonBOT
# plain quartz !debug
Info: 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!

steady wind
#

You're missing the destination inventory, it probably is setting them item, just in your inventory

civic storm
#
granite frost
#

server_menu is an inventory script container, I don't believe it can be edited except through the script itself.

#

Use the context inventory.

#

!e clicks in inventory

calm canyonBOT
# granite frost !e clicks in inventory
Group

Player

Event Lines

player (<click_type>) clicks (<item>) in <inventory>

Switches

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.

Triggers

when a player clicks in an inventory. Note that you likely will also want to listen to !event player drags in inventory.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

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

Determine

ItemTag to set the current item for the event.

Has Known Location

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

Cancellable

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

granite frost
#

or alternatively.

#

!t playertag.open_inventory

calm canyonBOT
granite frost
#

Also there's no need to stop?

#

Your inventory is a gui, it's automatically cancelling the event and no code is running afterwards.

granite frost
#

!debug

calm canyonBOT
# granite frost !debug
Info: 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!

civic storm
#

replacing destination with d:<context.inventory> helped, thx 👍