Autocompressors

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

Spartan7106

Member
Feb 11, 2025
3
0
1
24
I am making a box server, and to make this box server i need to make autocompressors. I know basically nothing about skript. but through googling and my small brain, I got this:
code_language.skript:
#overworld
on mine:
    loop all players:
        if loop-player's inventory contains compass named "&aOverworld Autocompressor":
            if lore of item contains "&e- &x&8&6&7&7&5&2Wood":
                set {_s} to number of stripped oak log in loop-player's inventory
                give ({_s} * 4) of oak log to loop-player
                remove {_s} of stripped oak log from loop-player's inventory
                if loop-player has 16 oak log:
                    set {_n} to number of oak log in loop-player's inventory
                    set {_n} to {_n} / 16
                    set {_n} to floor({_n})
                    loop {_n} times:
                        remove ({_n} * 16) of oak log from loop-player's inventory
                        give {_n} of oak wood named "&x&8&6&7&7&5&2C&x&8&2&7&3&5&0o&x&7&E&7&0&4&Dm&x&7&A&6&C&4&Bp&x&7&5&6&9&4&8r&x&7&1&6&5&4&6e&x&6&D&6&2&4&3s&x&6&D&6&2&4&3s&x&7&1&6&5&4&6e&x&7&5&6&9&4&8d &x&7&A&6&C&4&BW&x&7&E&7&0&4&Do&x&8&2&7&3&5&0o&x&8&6&7&7&5&2d" to the loop-player
            if lore of item contains "&e- &7Stone":
                set {_s} to number of smooth stone in loop-player's inventory
                give ({_s}* 4) of cobblestone to loop-player
                remove {_s} of smooth stone from loop-player's inventory
                if loop-player has 32 cobblestone:
                    set {_n} to number of cobblestone in loop-player's inventory
                    set {_n} to {_n} / 32
                    set {_n} to floor({_n})
                    loop {_n} times:
                        remove ({_n} * 32) of cobblestone from loop-player's inventory
                        give {_n} of stone named "&x&8&6&8&6&8&6Compressed Stone" to the loop-player
            if lore of item contains "&e- &#FFFFFFIron":
                set {_s} to the number of iron block in loop-player's inventory
                give ({_s} * 4) of raw iron to loop-player
                remove {_s} of iron block from loop-player's inventory
                if loop-player has 32 raw iron:
                    set {_n} to number of raw iron in loop-player's inventory
                    set {_n} to {_n} / 32
                    set {_n} to floor({_n})
                    loop {_n} times:
                        remove ({_n} * 32) of raw iron from loop-player's inventory
                        give {_n} of iron ingot named "&x&C&8&C&8&C&8Compressed Iron" to the loop-player
            if lore of item contains "&e- &bDiamond":
                if loop-player has diamond block:
                    set {_s} to the number of diamond block in loop-player's inventory
                    give ({_s} * 4) of diamond to loop-player
                    remove {_s} of diamond block from loop-player's inventory
                if loop-player has 64 diamond:
                    set {_n} to number of diamond in loop-player's inventory
                    set {_n} to {_n} / 64
                    set {_n} to floor({_n})
                    loop {_n} times:
                        remove ({_n} * 64) of diamond from loop-player's inventory
                        give {_n} of diamond ore named "&x&0&0&4&8&6&7C&x&0&0&5&1&7&8o&x&0&0&5&9&8&Am&x&0&0&6&2&9&Bp&x&0&0&6&B&A&Cr&x&0&0&7&3&B&De&x&0&0&7&C&C&Fs&x&0&0&8&4&E&0s&x&0&0&8&D&F&1e&x&0&0&8&4&E&0d &x&0&0&7&C&C&FD&x&0&0&7&3&B&Di&x&0&0&6&B&A&Ca&x&0&0&6&2&9&Bm&x&0&0&5&9&8&Ao&x&0&0&5&1&7&8nd" to the loop-player
            if lore of item contains "&e- &dAmethyst":
                if loop-player has purple concrete:
                    set {_s} to the number of purple concrete in loop-player's inventory
                    give ({_s} * 4) of amethyst block to loop-player
                    remove {_s} of purple concrete from loop-player's inventory
                if loop-player has 64 amethyst block:
                    set {_n} to number of amethyst block in loop-player's inventory
                    set {_n} to floor({_n})
                    loop {_n} times:
                        remove ({_n} * 64) of amethyst block from loop-player's inventory
                        give {_n} of amethyst shard named "&x&E&7&0&0&F&BC&x&D&C&0&8&F&Bo&x&D&0&1&0&F&Bm&x&C&5&1&8&F&Cp&x&B&A&2&0&F&Cr&x&A&F&2&8&F&Ce&x&A&3&3&0&F&Cs&x&9&8&3&8&F&Ds&x&8&D&4&0&F&De&x&7&F&4&A&F&Dd &x&6&F&5&5&F&DA&x&5&F&6&0&F&Em&x&4&F&6&B&F&Ee&x&4&0&7&6&F&Et&x&3&0&8&1&F&Eh&x&2&0&8&D&F&Fyst" to the loop-player
            if lore of item contains "&e- &aEmerald":
                if loop-player has emerald block:
                    set {_s} to the number of emerald block in loop-player's inventory
                    give ({_s} * 8) of emerald to loop-player
                    remove {_s} of emerald block from loop-player's inventory
                if loop-player has 64 emerald:
                    set {_n} to number of emerald in loop-player's inventory
                    set {_n} to {_n} / 64
                    set {_n} to floor({_n})
                    loop {_n} times:
                        remove ({_n} * 64) of emerald from loop-player's inventory
                        give {_n} of emerald ore named "&aCompressed Emerald" to the loop-player

this code does not give any errors. I am positive that the compass has the right lore because i copied and pasted it. if somebody could please help me fix my code. I would greatly appreciate that.
 
Last edited:
Check conditions by send "a" to players, check conditions like:

1: if loop-player has 16 oak log:

2: if lore of item contains "&e- &x&8&6&7&7&5&2Wood":
 
Check conditions by send "a" to players, check conditions like:

1: if loop-player has 16 oak log:

2: if lore of item contains "&e- &x&8&6&7&7&5&2Wood":
I tried but it didn't send any messages to me except it sent me a message saying that it was named overworld compressor. even when I make a new item without any extra lore, it still doesn't work. I copied and pasted the lore so I thought it should be working. is there a small mistake that I made and am just overlooking? I think that it still has something to do with the
if lore of item contains "&e- &x&8&6&7&7&5&2Wood":
lines of code. because when I don't have them, it compresses the items completely fine. but I tried all i could think of and it just doesn't work.