Auto compressor

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

    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!

Oxyn720

New Member
Aug 8, 2024
5
0
1
I made this skript for an auto compressor but its my first time could anyone double check on it because it seems to be giving me errors

options:
BlocksToCompress1: 64 emerald
UpgradedVersion1: 1 green dye named "<##08561e>Compressed Emeralds"
BlocksToCompress2: 64 lapis lazuli
UpgradedVersion2: 1 blue dye named "<##0d8821>Compressed Lapis"
BlocksToCompress3: 64 diamond
UpgradedVersion3: 1 cyan dye named "<##37adbf>Compressed Oak Log"

every second:
loop all players:
if player's offhand is breeze head named "&6&lCompressor":
set {_n::*} to {@BlocksToCompress1}
set {_m::*} to {@UpgradedVersion1}
loop {_n::*}:
while loop-player has loop-value-2:
remove loop-value-2 from loop-player's inventory
give loop-player {_m::%loop-index%}
set {_n::*} to {@BlocksToCompress2}
set {_m::*} to {@UpgradedVersion2}
loop {_n::*}:
while loop-player has loop-value-2:
remove loop-value-2 from loop-player's inventory
give loop-player {_m::%loop-index%}
set {_n::*} to {@BlocksToCompress3}
set {_m::*} to {@UpgradedVersion3}
loop {_n::*}:
while loop-player has loop-value-2:
remove loop-value-2 from loop-player's inventory
give loop-player {_m::%loop-index%}
 
Last edited:
I made this skript for an auto compressor but its my first time could anyone double check on it because it seems to be giving me errors

options:
BlocksToCompress1: 64 emerald
UpgradedVersion1: 1 green dye named "<##08561e>Compressed Emeralds"
BlocksToCompress2: 64 lapis lazuli
UpgradedVersion2: 1 blue dye named "<##0d8821>Compressed Lapis"
BlocksToCompress3: 64 diamond
UpgradedVersion3: 1 cyan dye named "<##37adbf>Compressed Oak Log"

every second:
loop all players:
if player's offhand is breeze head named "&6&lCompressor":
set {_n::*} to {@BlocksToCompress1}
set {_m::*} to {@UpgradedVersion1}
loop {_n::*}:
while loop-player has loop-value-2:
remove loop-value-2 from loop-player's inventory
give loop-player {_m::%loop-index%}
set {_n::*} to {@BlocksToCompress2}
set {_m::*} to {@UpgradedVersion2}
loop {_n::*}:
while loop-player has loop-value-2:
remove loop-value-2 from loop-player's inventory
give loop-player {_m::%loop-index%}
set {_n::*} to {@BlocksToCompress3}
set {_m::*} to {@UpgradedVersion3}
loop {_n::*}:
while loop-player has loop-value-2:
remove loop-value-2 from loop-player's inventory
give loop-player {_m::%loop-index%}
It seems a bit overly complicated. You could simply write a function to check if player has 64 of item named X then give the player an item named Y.

Example: (Set as spoiler in case you wanna try turning it into a function first)
Code:
function compress(p: player, item: item, name: text, result: item):
   if {_p} has 64 of {_item}:
      give  {_p} 1 of {_result} named "%{_name}%"

on right click:
   if player's offhand is breeze head named "&6&lCompressor":
      if player's held item is emerald:
         compress(player, emerald, "<##08561e>Compressed Emeralds", green dye) # You can use an options variable for the names
 
It seems a bit overly complicated. You could simply write a function to check if player has 64 of item named X then give the player an item named Y.

Example: (Set as spoiler in case you wanna try turning it into a function first)
Code:
function compress(p: player, item: item, name: text, result: item):
   if {_p} has 64 of {_item}:
      give  {_p} 1 of {_result} named "%{_name}%"

on right click:
   if player's offhand is breeze head named "&6&lCompressor":
      if player's held item is emerald:
         compress(player, emerald, "<##08561e>Compressed Emeralds", green dye) # You can use an options variable for the names
Ok thanks bro do you think you could make it so it could do multiple ores? also im trying to make a version that makes it automatically either on pickup or in inventory.
 
Last edited:
Could this work?

every second:
if player's offhand is player head named "&6&lCompressor":
if player has 64 emeralds:
replace with 1 green dye named "<##08561e>Compressed Emeralds"
if player has 64 lapis:
replace with 1 blue dye named "<##0d8821>Compressed Lapis"
if player has 64 diamond:
replace with 1 cyan dye named "<##37adbf>Compressed Diamonds"
 
here's something i think might work.

Code:
every second:
    loop all players:
        if loop-player's offhand item is player head named "Compressor":
            if player has more than 63 lapis:
                replace lapis with lapis block named "&9Compressed Lapis"

Might not though
 
here's something i think might work.

Code:
every second:
    loop all players:
        if loop-player's offhand item is player head named "Compressor":
            if player has more than 63 lapis:
                replace lapis with lapis block named "&9Compressed Lapis"

Might not though
Ok ill try it thx