Skript comes back with no errors but doesn't actually work

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

MPGxxYT

Member
Feb 14, 2018
10
0
1
28
The skript gives no errors but when the command is run the items aren't in the chest that spawned.

command /chestspawn [<text>]:
trigger:
loop {%arg 1%::chest::*}:
#the location of chest pos list
set block at loop-value to chest
set {_item-count} to random integer from 2 to 5
clear inventory of block at loop-value
loop {_item-count} times:
chance of 100%:
set {_item} to random element out of {sg.50::%arg 1%::*}
#<list of items with only chain boots on it
add {_item} to inventory of block at loop-value #I assume it is something to do with this line ~~
send "%{_item}%" #debug item just tells me the item
send "%loop-value%" #debug chest location tells me the chest location
 
Hi, I don't know exactly what you're trying to do, but if you're doing something like Chest Refill, try this skript



Code:
options:
    prefix: &6
    perm: is.admin
    noperm: &cYou don't have the permission to do that!
    minitems: 1
    maxitems: 3


on load:
    clear {ritem::*}
    add 2 eggs to {ritem::*}
    add 10 eggs to {ritem::*}
    add 8 eggs to {ritem::*}
    add gold sword to {ritem::*}
    add gold helmet to {ritem::*}
    add iron chestplate to {ritem::*}
    add gold leggings to {ritem::*}
    add iron boots to {ritem::*}
    add 12 arrow to {ritem::*}
    add 16 arrow to {ritem::*}
    add 24 arrow to {ritem::*}
    add 32 stone to {ritem::*}
    add 16 stone to {ritem::*}
    add 48 bricks to {ritem::*}
    add 15 bricks to {ritem::*}
    add bow to {ritem::*}
    add leather boots to {ritem::*}
    add leather helmet to {ritem::*}
    add leather chestplate to {ritem::*}
    add leather leggings to {ritem::*}
    add 16 snowballs to {ritem::*}
    add 32 snowballs to {ritem::*}
    add 1 golden apple to {ritem::*}
    add 2 golden apple to {ritem::*}
    add 4 golden apple to {ritem::*}
    add 32 oak planks to {ritem::*}
    add 16 oak planks to {ritem::*}
    add 64 oak planks to {ritem::*}
    add 1 ender pearl to {ritem::*}
    add 2 ender pearl to {ritem::*}
    add 3 experience bottle to {ritem::*}
    add 6 experience bottle to {ritem::*}
    add 4 175 named "&cKredit" to {ritem::*}
    add 7 175 named "&cKredit" to {ritem::*}
    add 12 175 named "&cKredit" to {ritem::*}
    add 4 175 named "&cKredit" to {ritem::*}
    add 7 175 named "&cKredit" to {ritem::*}
    add 12 175 named "&cKredit" to {ritem::*}
    add 4 175 named "&cKredit" to {ritem::*}
    add 7 175 named "&cKredit" to {ritem::*}
    add 12 175 named "&cKredit" to {ritem::*}
    add 4 175 named "&cKredit" to {ritem::*}
    add 7 175 named "&cKredit" to {ritem::*}
    add 12 175 named "&cKredit" to {ritem::*}






command /skchest [<text>]:
    trigger:
        if arg 1 is "add":
            if player has permission "{@perm}":
                if target block is chest:
                    add location of target block to {cheloc::*}
                    message "{@prefix} Succesfully executed &3AddChest"
                    loop {cheloc::*}:
                        if loop-value is location of target block:
                            message "{@prefix} This chest has already been checked as a SkChest!"
                            stop
                else:
                    message "&b{@prefix} You need to select a chest!"
            else:
                message "{@noperm}"
        if arg 1 is "remove":
            if player has permission "{@perm}":
                if target block is a chest:
                    remove location of target block from {cheloc::*}
                    message "{@prefix} Succesfully removed the selected chest!"
                    clear inventory of target block
                    stop
                else:
                    message "{@prefix} You need to select a chest!"
            else:
                message "{@noperm}"
        if arg 1 is "refill":
            if player has permission "{@perm}":
                loop {cheloc::*}:
                    set {_cheslot::*} to ""
                    loop 27 times:
                        add loop-number to {_slotnum::*}
                    clear inventory of block at loop-value
                    wait 1 tick
                    message "&b{@prefix} Succesfully executed &3ChestRefill"
                    set {_loop} to a random integer between {@minitems} and {@maxitems}
                    loop {_loop} times:
                        set {_cheitem} to a random element out of {ritem::*}
                        set {_cheslot} to a random element out of {_slotnum::*}
                        add {_cheitem} to slot ({_cheslot} - 1) of block at loop-value-1
            else:
                message "{@noperm}"
        if arg 1 is "about" OR "version":
            message "&3&lSkChests &r&b> Currently running version &3Build 2&b, created by Efnilite"
        if arg 1 is not set:
            if player has permission "{@perm}":
                message "{@prefix} You need to specify a command! Usage: /skchest <add/remove/refill>"
            else:
                message "{@noperm}"

- Commands:
- /skchest > Main command.
- /skchest add > Add a chest to the list of chests.
- /skchest remove > Remove a chest from the list
- /skchest refill > If you have selected all your chests, or if your minigame is over, you can make the console..
 
Status
Not open for further replies.