#attempting to make a potential item stash failed miserably and i cant find anything on the subject

1 messages · Page 1 of 1 (latest)

silk vortex
#
on mine:
  set {_drops::*} to drops of block
  clear drops
  if player has enough space for {_drops::*}:
    give player {_drops::*}
  else:
    add {_drops::*} to {excess.%player's uuid%::*}
    send title "&cFull inventory!" to player
    broadcast "%{excess.%player's uuid%::*}%"
    
command test:
    trigger:
        #if player has enough space for {excess.%player's uuid%::*}:
        add {excess.%player's uuid%::*} to player's inventory
        #{excess.%player's uuid%::*}
        #else:
        #send title "&cNot enough space!" to player

i disabled some parts of the test command to see if it worked without checking the space in players inventory and it does? but it clears the variable and doesnt give all items

rotund flax
#

ok

#

whats the issue?

silk vortex
#

well when the code with the # is enabled instead of giving the items until the inventory is full it just wont will trigger the else code which is to be expected but im wondering how to make it fill the inventory, and only remove the items from the variable list that get added to the players inventory

rotund flax
#

use loops

#

loop through the list, and check if they have room for each

silk vortex
#

okay let me fiddle with that idea and ill be back alr?

rotund flax
#

great!

silk vortex
# rotund flax great!

It appears I did the code right, I’m currently just mining the blocks to do the command and test it

#

that did work, thank you very much!

rotund flax
#

👍

silk vortex
#
command test:
    trigger:
        loop {excess.%player's uuid%::*}:
            if player has enough space for {excess.%player's uuid%::%loop-value%}:
                wait 1 second
                add {excess.%player's uuid%::%loop-value%} to player's inventory
        #{excess.%player's uuid%::*}
            #lse:
                #send title "&cNot enough space!" to player
#

this is what the code looks like now

#

im assuming if i remove loop value it will remove all blocks in the list?

#

alright it appears i broke it again

#

somehow

#

@rotund flax theres a high chance i messed up lol i've never tried to do this before this way

#

sorry for the inconveinence 😭

rotund flax
#

ok

#

youre kind of confusing values with indexes

silk vortex
#

(i searched google )

#

(and thats sorta what i got)

rotund flax
#

index is whats after the ::

#

value is what its actually set to

silk vortex
#

oh wait so instead of :: is it just .

rotund flax
#

no

silk vortex
#

oh alr

rotund flax
#

:: is what makes it a list

#

so ```set {example::1} to "this"
set {example::2} to "is"
set {example::3} to "an"
set {example::4} to "example"

Indexes are 1, 2, 3, 4

Values are "this", "is", "an", "example"

#looping will use the indexes in numerical/alphabetical order by default

so in this case {example::1} then {example::2}, and so on

loop {example::*}:
broadcast "Message number %loop-index%: %loop-value%"```

silk vortex
#

im not sure i entirely follow but i understand whats being said

#

so the thing i got from that with my low amount of sleep is use %loop-value%

rotund flax
#

you can run that if you need to see how it would work

rotund flax
silk vortex
#

yeah last 2 nights have been 5hs of sleep

#

let me try lol

#

if i did the code with %loop-value% then removed the looped values would it clear the whole list since it loops the whole list?

rotund flax
#

its just value is shorter

rotund flax
silk vortex
#

wanna see my current code so you can guide me a bit since im having a bit of a hard time understanding

#

i feel bad for you since i have like no idea what im doing with this 😭

#

OHHHHHH

#

LOOP-VALUE

#

that clicked it

#

YES

#

yo i

#

bro 😭 im so happy rn

#
command test:
    trigger:
        loop {excess.%player's uuid%::*}:
            if player has enough space for loop-value:
                wait .5 second
                add loop-value to player's inventory
        #{excess.%player's uuid%::*}
            #lse:
                #send title "&cNot enough space!" to player
#

watching those individual blocks go into my inventory was like a dream

#

and then if im correct

#
command test:
    trigger:
        loop {excess.%player's uuid%::*}:
            if player has enough space for loop-value:
                wait .5 second
                add loop-value to player's inventory
                remove loop-value from {excess.%player's uuid%::*}
            else:
                send title "&cNot enough space!" to player
rotund flax
#

try it

silk vortex
#

so

#

in the creative menu

#

clicking on them

#

deletes the item

#

it deletes any item i click on

#

i think if i made the delay low enough so its not instant but not so slow there can be a balance so it doesnt delete

#

i think im just gonna make it instant

#

hey it worked well

#

ty @rotund flax