#(Niklas) open players inventory

130 messages · Page 1 of 1 (latest)

red vessel
#

when doing /loot while looking at a player the player.target inventory should be opened.

west starBOT
#

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>

fast bough
#

!c inventory

haughty whaleBOT
# fast bough !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...

fast bough
#

use the open arg

red vessel
#
  • inventory open d:<player.target.inventory>
fast bough
#

(should ideally check if the player has a target, and that the target is a player)

#

!guide handling player commands

red vessel
#

yes of course

red vessel
#

well..

#
    type: command
    name: looten
    usage: /looten
    description: loot
    script:
        - define open <player.location.find_players_within[2]>
        - if <[open].has_flag[bewusstlos]>:
            - if !<player.target.is_npc>:
                - inventory open d:<[open]>```
#

can anybody help me with this

#

it opens my inv

fast bough
#

use the.. player.target? and check if its not null

#

I dont know why you're using <player.location.find_players_within[2]>

red vessel
#

Because I have armorstands above the player....

fast bough
#

!t ray_trace

haughty whaleBOT
# fast bough !t ray_trace
Cannot Specify Searched Tag

Multiple possible tags: <LocationTag.ray_trace[(range=<#.#>/{200});(return=<{precise}/block/normal>);(default=<{null}/air>);(fluids=<true/{false}>);(nonsolids=<true/{false}>);(entities=<matcher>);(ignore=<entity>|...);(raysize=<#.#>/{0})]>, <LocationTag.ray_trace_target[(range=<#.#>/{200});(blocks=<{true}/false>);(fluids=<true/{false}>);(nonsolids=<true/{false}>);(entities=<matcher>);(ignore=<entity>|...);(raysize=<#.#>/{0})]>.

fast bough
#

!t location.ray_trace

haughty whaleBOT
# fast bough !t location.ray_trace

Traces a line from this location towards the direction it's facing, returning the location of the first hit block or (optionally) entity.
This tag has also been referred to as 'cursor_on' or 'precise_cursor_on' in the past.
For ray tracing entities, see !tag LocationTag.ray_trace_target.
Using 'return=normal' instead replaces the old 'precise_impact_normal' tag.
Optionally specify:
range: (defaults to 200) a maximum distance (in blocks) to trace before giving up.
return: (defaults to prec...

Group

world

Returns

LocationTag

Examples
# Destroys whatever solid block the player is looking at.
- define target <player.eye_location.ray_trace[return=block]||null>
- if <[target]> != null:
    - modifyblock <[target]> air
# Spawns a heart wherever the player is looking, no more than 5 blocks away.
- playeffect effect:heart offset:0 at:<player.eye_location.ray_trace[range=5;entities=*;ignore=<player>;fluids=true;nonsolids=true;default=air]>

and more... Check the website for more examples

fast bough
#

You can exclude armor stands

#

thats not the correct tag one moment

#

!t location.ray_trace_target

haughty whaleBOT
# fast bough !t location.ray_trace_target

Traces a line from this location towards the direction it's facing, returning the first hit entity (if any).
This is similar to !tag LocationTag.precise_target and !tag PlayerTag.target, except offering more options for how the ray trace is performed.
For ray tracing locations, see !tag LocationTag.ray_trace.
Optionally specify:
range: (defaults to 200) a maximum distance (in blocks) to trace before giving up.
blocks: (defaults to true) specify "false" to ignore all blocks, ...

Group

world

Returns

EntityTag

Examples
# Removes the entity a player is looking at.
- define target <player.eye_location.ray_trace_target[ignore=<player>]||null>
- if <[target]> != null:
    - remove <[target]>
# Returns any player within the view of an NPC.
- define target <npc.eye_location.ray_trace_target[entities=player;raysize=2]||null>
# Highlights an entity through any number or types of blocks.
- define target <player.eye_location.ray_trace_target[ignore=<player>;blocks=false]||null>
- if <[target]> != null:
    - adjust <[target]> glowing:true
fast bough
#

This is the one

red vessel
#
  • define open <player.location.ray_trace_target[ignore=[armor_stand];blocks=false]>
#

like this

red vessel
#

no

#

doesnt work

#

hate this

warped token
red vessel
#

ok... well. I still dont know how to get this run.

#

I think I will just du: execute as_op "inventory open <player.target>"

fast bough
#

that wont work

red vessel
#

yeah....

fast bough
#

you want only players right

red vessel
#

yeah

fast bough
#

so use the matcher aya provided

#

with player as value

#

I mean

#

its literally an example

fast bough
#

should do the thing

red vessel
#

doesnt work... Debug incoming

#

only error

fast bough
#

Yeah so

#

This tag returned null

#

so it doesn't have any player attached

#

And <player> is not a valid argument in the inventory command

#

specifically, you don't need it at all

#

you alreaay have d:<[open]>

#

which is the destination

#

probably want .inventory attached on it after you verified the input

#

aaaaaalso

#

<player.location.ray_trace_target[entities=player,raysize=2]||null>

#

this isn't valid

#

do you see in the example that it's separated by a semicolon?

#

you used a , which borked the tag

red vessel
fast bough
#

does it worky worky now?

red vessel
#

no.

fast bough
#

try <player.eye_location

#

instead of <player.location

red vessel
#

doesnt change anything. still doesnt work.

#

Do you know the answer and just want me to learn it?

fast bough
#

currently I'm not sure why its not working

red vessel
#

ouf....

#

how should I know if you dont even know...

fast bough
#

another helperino might know

red vessel
#

I think I am just gonna remove the loot feature.

#

I hate it... It just wont work.

#

just remove it

tropic orchid
#
    script:
        - define players <player.location.find_npcs_within[3]>
        - if <[players].has_flag[bewusstlos]>:
            - inventory open d:<[players].name.inventory>
#

<player.location.find_npcs_within[3]> finds NPCs within 3 blocks of the player location

#

if <[players].has_flag[bewusstlos]> will never return true,

#

<[players]> is a list of NPCs within 3 blocks

#

a list that is "me, you, and icecapade" does not have a flag

#

if you want to check if any of those NPCs have a flag, you'd filter it

#
- if <[players].filter[has_flag[bewusstlos].is_empty>:
  - narrate "no players have this flag"
#

if you want to open the inventory of the One person who Does have this flag:

#

<[players].filter[has_flag[bewusstlos]]> will return a list of players who Do

#

<[players].filter[has_flag[bewusstlos]].first> will return the first NPC in this tag who has the flag

#

- inventory open destination:<[players].filter[has_flag[bewusstlos]].first.inventory> opens that NPC's inventory

#

be mindful that i'm saying NPC because you wrote in your first tag find_npcs_within

#

if you actually meant players, you want find_players_within

red vessel
#

Hab a little break smashink the sh out of my wall. Now i will try this.

#

still doesnt work

fast bough
#

Hold up

#

Are you looking at an NPC laying on the ground?

uneven cove
#

what does "doesnt work" mean? you open an empty inventory? are you sure those npcs actually have an inventory (/npc equip does not populate any inventories)

#

also...

red vessel
#

I absolutly dont know...
I will take a break and try It again tomorrow

lucid prawn
red vessel
red vessel
#

ok back to this.

red vessel
warped token
#

Since you - stop in the if, anything after it will only run if the if didn't

#

So using else is pointless there, can just have the code after the if

#

That style is called early return, where instead of having

    if <y>:
      if <z>:
         the code here

you have

if !<x>:
   stop
if !<y>:
   stop
if !<z>:
   stop
the code here

which generally is a lot cleaner and more readable

red vessel
#

        - define players <player.location.find_npcs_within[3]>
        - if <[players].filter[has_flag[bewusstlos]].is_empty>:
            - narrate "<gold>Gemmeria-Kampf <&8>| <&7>Kein bewusstloser Spieler"
        - else:
            - inventory open d:<[players].filter[has_flag[bewusstlos]].first.inventory>```

this better?
#

it now narrates that there is no player flagged bewusstlos

#

no doesnt work

warped token
#

But uh, you're using find_npcs_within, that won't return players

red vessel
#

I have tried with Player
Doesnt work....

#

I hate it

warped token
#

!debug

haughty whaleBOT
# warped token !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!

undone martenBOT
#
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.)

#

@red vessel