#(empyrealpa) saving, clearing and restoring inventory on region exit

61 messages ยท Page 1 of 1 (latest)

spice heartBOT
#

(empyrealpa) saving, clearing and restoring inventory on region exit

#

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>

paper lagoonBOT
#

@spiral spoke

Thread Close Blocked

Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.

#

@spiral spoke

Thread Close Blocked

Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.

spiral spoke
#

sorry, tried closing it as I realised I'd posted it in the wrong place FacePalm sorry

hot minnow
#

Also note:

#

!rule 8

edgy rockBOT
# hot minnow !rule 8
Rule 8

Don't overuse the edit/delete buttons. https://denizenscript.com/discord_rules#rule8
Use the edit button to fix typos, and the delete button to remove an accidental post shortly after posting.
Do not remove a post that pings someone, do not edit or delete a post that people have already replied to.

paper lagoonBOT
#
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.)

#

@spiral spoke

spiral spoke
#

ahhh sorry, my bad

paper lagoonBOT
#
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.)

#

@spiral spoke

hot minnow
#

But also uh, this looks like the correct place? if you're trying to make a Denizen script then this is the right channel to ask in @spiral spoke

hot minnow
spiral spoke
#

Oh sorry, I thought it might be classed as a question and therefore the wrong place to ask

hot minnow
#

This channel is for questions, it's the Denizen support channel

spiral spoke
#

right so I was in the right place ๐Ÿ˜‚

#

I was trying to wrap my head around saving, clearing and then restoring players inventories based on worldguard regions, I was looking through the inventory commands but wasn't quite sure which ones to use

hot minnow
#

WorldGuard doesn't seem to have any useful API for detecting that, so your best bet is probably to use Denizen notes - can either note them with the same area the WG region or replace the WG region with them

#

!g special memory

edgy rockBOT
hot minnow
#

!t WorldGuardRegionTag.area

edgy rockBOT
hot minnow
#

Not sure if you want it to be dynamic or not, but can use that to easily get a region's area ^

#

After you have the area noted, can use

#

!e enters exists

edgy rockBOT
#
Possible Confusion

Did you mean to search for entity enters portal?

hot minnow
#

!e enters|exists area

edgy rockBOT
#
Possible Confusion

Did you mean to search for entity enters|exits area?

edgy rockBOT
# hot minnow !e enters|exists area
Group

Entity

**WARNING**

cancelling this event will have different results depending on the cause. Teleporting the entity away 1 tick later might be safer.

Event Lines

<entity> enters|exits <area>

Triggers

when an entity enters or exits a noted area (cuboid, ellipsoid, or polygon). On Spigot servers, only fires for players. Paper is required for other mob types.

Has Player

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

Context

<context.area> returns the area object that was entered or exited.
<context.cause> returns the cause of the event. Can be: WALK, WORLD_CHANGE, JOIN, QUIT, TELEPORT, VEHICLE.
<context.to> returns the location the entity moved to (might not be available in exit events).
<context.from> returns the location the entity moved from (when available, depending on cause).
<context.entity> returns the entity that entered/exited an area.

Cancellable

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

hot minnow
#

That ^ to detect a player going in/out

#

You can then store all of the items currently in their inventory:

#

!t PlayerTag.inventory

edgy rockBOT
hot minnow
#

!t InventoryTag.list_contents

edgy rockBOT
hot minnow
#

!g flags

edgy rockBOT
hot minnow
#

Flag the player with their current inventory contents, and then clear their inventory

#

!c inventory u

edgy rockBOT
# hot minnow !c inventory u
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.

Use to open a chest inventory, at a location.
- inventory open d:<context.location>
Use to open a virtual inventory with a title and some items.
- inventory open d:generic[size=27;title=BestInventory;contents=snowball|stick]
Use to open another player's inventory.
- inventory open d:<[player].inventory>
Use to remove all items from a chest, except any items in the specified list.
- inventory keep d:<context.location.inventory> o:snowball|ItemScript
Use to remove all sticks and stones from the player's inventory.
- inventory exclude origin:stick|stone
Additional Usage Examples

... and 5 more.

hot minnow
#

See the clear option there ^

#

And that should handle clearing and saving it once they exit the region, for setting it back once they enter, all you need to do is get their items from the flag

#

!t FlaggableObject.flag

edgy rockBOT
hot minnow
#

And set it back into their inventory - can use inventory set ^

#

Feel free to ask here if you're having any trouble / anything is unclear, we're always happy to help :D

spiral spoke
#

Amazing! thank you so much ๐Ÿ™‚

paper lagoonBOT
#
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.)

#

@spiral spoke