#(danjoe3) Item Flagged in inventory

113 messages · Page 1 of 1 (latest)

topaz phoenix
#

Hey there,

I'm currently working on a currency deposit system, where it converts the physical currency into virtual ones.
I recently created an event currency where I'd like to deposit in the same GUI with this particular GUI that I've created. So I added an item flag for the currencies, as currency with the value event for the event items, and gem for the normal gem item.
The event I've been using previously for the gem item was -
after player clicks air in gem_deposit_inventory with:gems
But I changed it to
after player clicks in gem_deposit_inventory with:item_flagged:currency:
It doesnt seem to show up properly.

But here is the entire script to give an idea. https://paste.denizenscript.com/View/118814

Would you suggest I just stick with my previous event, or do you reckon it would be easy to do it with flags?

south turtleBOT
#

(danjoe3) Item Flagged in inventory

south turtleBOT
#

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.

topaz phoenix
#

The final event, basically disables players from placing any other item in the GUI, other than the gems or the event item itself

severe tree
topaz phoenix
#

The one commented out

severe tree
#

You can't cancel an event after it's already happened by the way

#
after player places dirt:
- determine cancelled```
This won't do anything
#

!l on vs after

empty salmonBOT
#
Possible Confusion

Did you mean to search for script event after vs on?

empty salmonBOT
# severe tree !l on vs after

Modern ScriptEvents let you choose between "on" and "after".
An "on" event looks like "on player breaks block:" while an "after" event looks like "after player breaks block:".

An "on" event fires *before* the event actually happens in the world. This means some relevant data won't be updated
(for example, "<context.location.material>" would still show the block type that is going to be broken)
and the result of the event can be changed (eg the event can be cancelled to stop it from actually going through).

An "after" event, as the name implies, fires *after* the event actually happens. This means data will be already updated to the new state
(so "<context.location.material>" would now show air) but could potentially contain an arbitrary new state from unrelated changes
(for example "<con...

Group

Script Events

severe tree
#

This also means you cannot affect the outcome of the event at all (you can't cancel it or anything else - the "determine" command does nothing).

topaz phoenix
#

Oh right

severe tree
#

As for you original question, uhh

#

I need to look over your script a few times

#

To get how it supposed to work

#

Do you have a video of how it's supposed to work maybe?

topaz phoenix
#

Sure!

#

One sec

#

This one, I;ve mentioned the item

#

But i'd like to use the flag method, if its easier and possible?

severe tree
#

I mean uh, if the previous event was
after player clicks air in gem_deposit_inventory with:gems then try replacing it exactly the same except the item matcher part

#

So I guess that'd be after player clicks air in gem_deposit_inventory with:item_flagged:currency:

#

You could also use a name matcher instead of item flags

#

Could name your currency items like currency_gem, currency_cookie and use with:currency_*

#

Kinda in a hurry right now will help you out later if someone doesn't help you first

topaz phoenix
#

The deposit command basically just opens that inventory, so anyone can try it out!

topaz phoenix
severe tree
#

If the currency flag's value has no meaning to you (ie you only need to match any item that represents a physical currency) i'd stick with this method

#

If you wanted for example to keep some data in the flag that you'd use when listening to the event (how much currency the item* represents or something similar) you could use the item_flagged method

topaz phoenix
#

Oh right, I could just give the value of the currency in the item_flagged method

#

I feel that’s what I need

#

Cuz the currency tends to have different values

#

I’ll probably keep a sub flag too to test it out

#

Hopefully keeping it as currency.Christmas, currency.halloween
Will not make any difference to the event if I just mention item_flagged:currency?

#

Because I plan to change the value of the coins gradually

cloud dagger
#

the matcher would still be fine

#

currency.christmas:value is actually currency:<map[christmas=value]>

#

i.e the base flag is unchanged

topaz phoenix
#

Ah alright

#

So I’ll probably try that method out

topaz phoenix
#

How do I check the item flag value?

#

I understand it's flag[currency] ? But, do I check it with server?

marble zephyr
#

server.flag

topaz phoenix
#

It doesnt seem to show the value when the item is being clicked in

severe tree
#

!debug

empty salmonBOT
# severe tree !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!

kind bramble
topaz phoenix
marble zephyr
#

It seems your server does not have the flag currency.

#

The second error is a follow up error due the tag not parsing properly, because your server does not has the flag.

topaz phoenix
#

Ohh okay!

#

Lemme flag the server as currency and check it out

#

I just wanted to clarrify, will the value within the item script, show up?

    type: item
    material: cookie
    mechanisms:
        custom_model_data: 10002
    display name: <&a>Christmas <&6>cookie
    flags:
        currency: 4```
#

Because it doesnt seem to be showing it. The numbers are basically individual currency values

severe tree
#

That's not a server flag

#

It's an item flag

#

Why are you checking a server flag if the item itself has the currency value in the flag

topaz phoenix
#

I was wondering how I could get the item value

#

And accordingly I could have it show?

kind bramble
#

it depends on where the item is in context

topaz phoenix
#

It's meant to be placed in a deposit inventory

kind bramble
#

what event is it used with?

topaz phoenix
#

And according to the item, the currency value is kept

#

Click

kind bramble
#

click wot

topaz phoenix
#

Drag, left_shift and all

kind bramble
#

!event clicks in inventory

topaz phoenix
empty salmonBOT
# kind bramble !event 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.

kind bramble
#

!tag drags in inventory

empty salmonBOT
#
Possible Confusion

Did you mean to search for locationtag.drops?

topaz phoenix
#

I've done all that

kind bramble
#

im pulling it up for reference

#

!event drags in inventory

empty salmonBOT
# kind bramble !event drags in inventory
Group

Player

Event Lines

player drags in inventory player drags (<item>) (in <inventory>)

Switches

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.

Triggers

when a player drags in an inventory (that is, clicks and then holds the mouse button down while moving the mouse across multiple slots).

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

Has Known Location

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

Cancellable

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

kind bramble
#

<context.item> returns the ItemTag the player has clicked on.
<context.item> returns the ItemTag the player has dragged.

#

!t flaggableobject.flag

empty salmonBOT
kind bramble
#

context.item.flag[name]

topaz phoenix
#

Oh cool

#

Lemme check that rq

#

Danke

topaz phoenix
#

Doesn’t seem to show the value, I’m a bit confused over it lol

marble zephyr
#

Hmm, could you post your current script and debug please?

topaz phoenix
#
severe tree
#

after player clicks air in gem_deposit_inventory with:item_flagged:currency:
under same event
- define gems_value <context.item.flag[currency]>

#

<context.item> returns the item being clicked, which in this case is air

#

You want <context.cursor_item.flag[currency]>

#

You're not clicking the currecy item, you're clicking with it

#

!e player click_type clicks item in inventory

empty salmonBOT
# severe tree !e player click_type clicks item 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.

topaz phoenix
#

Okay, that seems to fix it. But the define total <[quantity]>:*:<[gems_value]> Seems to be the issue now regarding the gem_display_amt script

#

It show up as 1:*:4 and doesnt display the amount

#

Which makes it false

marble zephyr
#

This looks like an invalid script line

#

You can't use data actions in variables.

#

- define total:*:<[gems_value]> would be valid.

#

- define total <[quantity].mul[<[gems_value]>]> would be valid too.

topaz phoenix
#

Oh right

#

Thank you Thank you!

#

Got it working now!

#

A Christmas miracle

#

🥳