Chest refill

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Maezukie

Member
May 21, 2018
15
0
1
the error I'm getting is
There's no loop that matches 'loop-value's inventory' (chest.sk, line 51: add {_randomitem} to the block at loop-value's inventory')

code_language.skript:
command /chest:
    permission: chest.sk
    trigger:
        loop {chestloc::*}:
            if loop-value is a chest:
                clear loop-value's inventory
                set {_item} to a random number between 3 and 6
                loop {_item} times:
                    set {_randomitem} to random element out of {random.item.list::*}
                    add {_randomitem} to the block at loop-value's inventory #<--- The error line
        broadcast "&aChests Refilled! &fNext refill, 5 minutes"
 
the error I'm getting is

code_language.skript:
command /chest:
    permission: chest.sk
    trigger:
        loop {chestloc::*}:
            if loop-value is a chest:
                clear loop-value's inventory
                set {_item} to a random number between 3 and 6
                loop {_item} times:
                    set {_randomitem} to random element out of {random.item.list::*}
                    add {_randomitem} to the block at loop-value's inventory #<--- The error line
        broadcast "&aChests Refilled! &fNext refill, 5 minutes"
Try removing the "block at" part since loop-value is already a block.
 
"There's no loop that matches 'loop-value's inventory' (chest.sk, line 51: add {_randomitem} to the block at loop-value's inventory')"
try add {_randomitem} to inventory of block at loop-value
 
"There's no loop that matches 'loop-value's inventory' (chest.sk, line 51: add {_randomitem} to the block at loop-value's inventory')"
try add {_randomitem} to inventory of block at loop-value
New error message
There are multiple loops that match loop-value. use loop-value-1/2/3/etc. to specify which loop's valse you want. (chest.sk, line 51: add {_randomitem} to inventory of block at loop-value')
 
loop-value-1
no errors but the chests dont refill
[doublepost=1534894279,1534894184][/doublepost]Heres the full code
code_language.skript:
on load:
    delete {random.item.list::*}
    add 2 diamond to {random.item.list::*}
    add 2 iron ingot to {random.item.list::*}
    add 2 leather to {random.item.list::*}
    add 2 tnt to {random.item.list::*}
    add 1 flint and steel to {random.item.list::*}
    add 1 golden apple to {random.item.list::*}
    add 4 cooked beef to {random.item.list::*}
    add 32 stone to {random.item.list::*}
    add 32 cobble stone to {random.item.list::*}
    add 4 cooked porkchop to {random.item.list::*}
    add 32 wooden plank to {random.item.list::*}
    add 2 apple to {random.item.list::*}
    add 1 stone sword to {random.item.list::*}
    add 1 stone pickaxe to {random.item.list::*}
    add 1 stone axe to {random.item.list::*}
    add 1 leather leggings to {random.item.list::*}
    add 1 leather boots to {random.item.list::*}
    add 1 leather chestplate to {random.item.list::*}
    add 1 leather helmet to {random.item.list::*}
    add 4 snowball to {random.item.list::*}
    add 4 arrow to {random.item.list::*}
    add 1 bow to {random.item.list::*}
    add 1 iron sword to {random.item.list::*}
    add 1 iron pickaxe to {random.item.list::*}
    add 1 iron axe to {random.item.list::*}
    add 1 iron leggings to {random.item.list::*}
    add 1 iron boots to {random.item.list::*}
    add 1 iron chestplate to {random.item.list::*}
    add 1 iron helmet to {random.item.list::*}
    add 1 diamond sword to {random.item.list::*}
    add 1 diamond pickaxe to {random.item.list::*}
    add 1 diamond axe to {random.item.list::*}
    add 1 diamond boots to {random.item.list::*}
    add 1 diamond leggings to {random.item.list::*}
    add 1 diamond helmet to {random.item.list::*}
    add 1 diamond chestplate to {random.item.list::*}
    wait 1 tick
    execute console command "/chest"
  
command /chest:
    permission: chest.sk
    trigger:
        loop {chestloc::*}:
            if loop-value is a chest:
                clear loop-value's inventory
                set {_item} to a random number between 3 and 6
                loop {_item} times:
                    set {_randomitem} to random element out of {random.item.list::*}
                    add {_randomitem} to inventory of block at loop-value-1
        broadcast "&aChests Refilled! &fNext refill, 5 minutes"

command /setloc:
    permission: Setchest.loc
    trigger:
        if target block is a chest:
            add target block's location to {chestloc::*}
            send "&aChest location added!"
        else:
            send "&cNot a chest"
 
every 5 minutes:
    execute console command "/chest"
 
okay, so:
add target block's location to {chestloc::*}
You are adding a location the variable

then:
loop {chestloc::*}:
if loop-value is a chest:

you are checking if the loop value is a chest? But the loop value is a location
 
okay, so:
add target block's location to {chestloc::*}
You are adding a location the variable

then:
loop {chestloc::*}:
if loop-value is a chest:

you are checking if the loop value is a chest? But the loop value is a location
oh, how would I fix this
 
code_language.skript:
if target block is a chest:
            add target block's location to {chestloc::*}
when setting the variable, you already have it check for the chest....

so in this one... remove the condition checking the chest
code_language.skript:
 loop {chestloc::*}:
            if loop-value is a chest:
                clear loop-value's inventory
 
Status
Not open for further replies.