#(Skullfurious) Can you flag an item in the player's inventory?

49 messages · Page 1 of 1 (latest)

uncut obsidian
#
        after player clicks rotate_15_item in entity_manipulator_inventory:
        - if <player.item_in_hand> == <item[entity_manipulator_item]>:
            - flag <player.item_in_hand> test
        - narrate "Rotate Target: (15 Degrees) Selected!"
        - inventory close

        ## Triggered Logic
        on player animates ARM_SWING with:entity_manipulator_item:
        - if <player.target.exists>:
            - if <player.item_in_hand.has_flag[test]>:
                - narrate <player.item_in_hand>```
vague cosmosBOT
#

(Skullfurious) Can you flag an item in the player's inventory?

#

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 block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

tropic abyss
#

!c inventory

granite bluffBOT
# tropic abyss !c inventory
Group

item

Syntax

inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)

Short Description

Edits the inventory of a player, NPC, or chest.

Description

Use this command to edit the state of inventories.
By default, the destination inventory is the current attached player's inventory.

If you are copying, swapping, removing from (including via "keep" and "exclude"), adding to, moving, or filling inventories,
you'll need both destination and origin inventories.

Origin inventories may be specified as a list of ItemTags, but destinations must be actual InventoryTags.

Using "open", "clear", or "update" only require a destination.
"Update" also req...

tropic abyss
#

!guide adjust command is not

tropic abyss
#

Also,

#

!guide common mistakes - don't compare raw

vapid estuaryBOT
#
Resolved

Thread closed as resolved.

uncut obsidian
#

Sorry to reopen this. But I have a question. I think I'm flagging the item properly now, but I can't seem to retrieve the flag from the item.

        # Set Active Manipulation Flag:
        after player clicks rotate_15_item in entity_manipulator_inventory:
        - if <player.item_in_hand> matches entity_manipulator_item:
            - inventory flag slot:hand active_manipulator:rotate_15_item
        - inventory close

        # Triggered Logic
        on player animates ARM_SWING with:entity_manipulator_item:
        - if <player.target.exists>:
            - if <player.item_in_hand.flag[active_manipulator]>:
                - narrate <player.item_in_hand>
vapid estuaryBOT
#
Changed to Help/Support

Thread is now a Help/Support thread. A helper will check your thread when available.

uncut obsidian
#

(Am I allowed to use /helpthread to reopen a thread?)

#

Should have checked first, sorry.

exotic valley
#

you want .has_flag

#

you're giving the active_manipulator flag a value of rotate_15_item

#

you can't do if rotate_15_item

#

because thats what you're doing, you're using an if on the flag's value

uncut obsidian
#

@exotic valley Ah, right. I fixed that, thank you.

For some reason however...

- narrate <player.item_in_hand.flag[active_manipulator]>``` just prints out the whole line as if the tag is formed incorrectly. Is that not how you get the flag value?
tropic abyss
#

Do some debugging and watch ya console /ex narrate <player.item_in_hand.has_flag[active_manipulator]>

#

!guide solving problems

uncut obsidian
#

Oh, for some reason on player scrolls is grabbing the item that was in hand previously

#

so i might have to do after

#

yep that does it, sorry about that.

tropic abyss
#

!e scrolls their hotbar

granite bluffBOT
# tropic abyss !e scrolls their hotbar
Group

Player

Event Lines

player scrolls their hotbar player holds item

Switches

item:<item> to only process the event when the player is going to hold a specified item.

Triggers

when a player scrolls through their hotbar.

Has Player

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

Context

<context.new_slot> returns the number of the new inventory slot.
<context.previous_slot> returns the number of the old inventory slot.

Has Known Location

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

Cancellable

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

tropic abyss
#

That event provides some context tags you can use

#

Also switches

uncut obsidian
#

I have the item switch already

#

after player scrolls their hotbar item:entity_manipulator_item:

#

but when you use on it still has the old item in hand i guess

#

when you use after it is correct

#

But <context.new_slot> might be a lot more safe

tropic abyss
#

item:<item> to only process the event when the player is going to hold a specified item.

uncut obsidian
#

- narrate <player.inventory.slot[<context.new_slot>].flag[active_manipulator]>

#

Works great

#

Thanks again ^^