Solved Auto Compresser

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

Neelix_bear

Well-Known Member
Aug 11, 2023
256
8
18
How can i make an auto compressor?
the code i actively have is
Code:
every 0.5 seconds:
    loop all players:
        if 64 <= amount of emeralds in loop-player's inventory:
            remove 64 emeralds from loop-player
            give emerald with nbt of mending with all flags hidden named "§x§D§D§F§F§D§DC§x§C§F§F§F§C§Fo§x§C§1§F§F§C§1m§x§B§4§F§F§B§4p§x§A§6§F§F§A§6r§x§9§8§F§F§9§8e§x§8§A§F§F§8§As§x§7§C§F§F§7§Cs§x§6§F§F§F§6§Fe§x§6§1§F§F§6§1d §x§5§3§F§F§5§3E§x§4§5§F§F§4§5m§x§3§7§F§F§3§7e§x§2§9§F§F§2§9r§x§1§C§F§F§1§Ca§x§0§E§F§F§0§El§x§0§0§F§F§0§0d" to loop-player

and the error is
1722148656406.png
 
How can i make an auto compressor?
the code i actively have is
Code:
every 0.5 seconds:
    loop all players:
        if 64 <= amount of emeralds in loop-player's inventory:
            remove 64 emeralds from loop-player
            give emerald with nbt of mending with all flags hidden named "§x§D§D§F§F§D§DC§x§C§F§F§F§C§Fo§x§C§1§F§F§C§1m§x§B§4§F§F§B§4p§x§A§6§F§F§A§6r§x§9§8§F§F§9§8e§x§8§A§F§F§8§As§x§7§C§F§F§7§Cs§x§6§F§F§F§6§Fe§x§6§1§F§F§6§1d §x§5§3§F§F§5§3E§x§4§5§F§F§4§5m§x§3§7§F§F§3§7e§x§2§9§F§F§2§9r§x§1§C§F§F§1§Ca§x§0§E§F§F§0§El§x§0§0§F§F§0§0d" to loop-player

and the error isView attachment 8722
I've mentioned this in other posts before, but you don't want to have events/loops running every second or so as that can be hard for the server to handle if it has a lot of players. If you can get emeralds from picking them up, simply use a 'on pick up' event instead. Also, the proper syntax for an enchanted, named item with all flags hidden is something I've provided below:
give [player] 1 of [Item] [of] [enchantment] named [name] [with all flags hidden]
ALSO: You can shorten gradient names by using "<##084CFB>T<##3F84FC>e<##76BBFC>s<##ADF3FD>t" (44 characters) instead of "§x§0§8§4§C§F§BT§x§3§F§8§4§F§Ce§x§7§6§B§B§F§Cs§x§A§D§F§3§F§Dt" (60 characters). It also makes it easier to read and change if needed (##000000 is a hex color code)
 
  • Like
Reactions: Neelix_bear
Code:
on pickup:
    if item is emerald:
        broadcast "success"
        if 64 <= amount of emeralds in player's inventory:
            broadcast "success 2"
            remove 64 emeralds from player
            give player 1 emerald of mending named "§x§D§D§F§F§D§DC§x§C§F§F§F§C§Fo§x§C§1§F§F§C§1m§x§B§4§F§F§B§4p§x§A§6§F§F§A§6r§x§9§8§F§F§9§8e§x§8§A§F§F§8§As§x§7§C§F§F§7§Cs§x§6§F§F§F§6§Fe§x§6§1§F§F§6§1d §x§5§3§F§F§5§3E§x§4§5§F§F§4§5m§x§3§7§F§F§3§7e§x§2§9§F§F§2§9r§x§1§C§F§F§1§Ca§x§0§E§F§F§0§El§x§0§0§F§F§0§0d" with all item flags

this works, but once you have 64 compressed, it removes those... how can I fix this?

PS: I have tried 'remove 64 emeralds with no item flags from player'
 
Code:
on pickup:
    if item is emerald:
        broadcast "success"
        if 64 <= amount of emeralds in player's inventory:
            broadcast "success 2"
            remove 64 emeralds from player
            give player 1 emerald of mending named "§x§D§D§F§F§D§DC§x§C§F§F§F§C§Fo§x§C§1§F§F§C§1m§x§B§4§F§F§B§4p§x§A§6§F§F§A§6r§x§9§8§F§F§9§8e§x§8§A§F§F§8§As§x§7§C§F§F§7§Cs§x§6§F§F§F§6§Fe§x§6§1§F§F§6§1d §x§5§3§F§F§5§3E§x§4§5§F§F§4§5m§x§3§7§F§F§3§7e§x§2§9§F§F§2§9r§x§1§C§F§F§1§Ca§x§0§E§F§F§0§El§x§0§0§F§F§0§0d" with all item flags

this works, but once you have 64 compressed, it removes those... how can I fix this?

PS: I have tried 'remove 64 emeralds with no item flags from player'
Check the event-item's name to make sure it isn't a compressed item.
 
Code:
on pickup:
    if item is emerald:
        if 64 <= amount of emeralds named "" in player's inventory:
            remove 64 emeralds named "" from player
            give player 1 emerald of mending named "§x§D§D§F§F§D§DC§x§C§F§F§F§C§Fo§x§C§1§F§F§C§1m§x§B§4§F§F§B§4p§x§A§6§F§F§A§6r§x§9§8§F§F§9§8e§x§8§A§F§F§8§As§x§7§C§F§F§7§Cs§x§6§F§F§F§6§Fe§x§6§1§F§F§6§1d §x§5§3§F§F§5§3E§x§4§5§F§F§4§5m§x§3§7§F§F§3§7e§x§2§9§F§F§2§9r§x§1§C§F§F§1§Ca§x§0§E§F§F§0§El§x§0§0§F§F§0§0d" with all item flags

this works, but autopickup makes it not work
 
Instead of using emeralds named "", you can use plain emeralds.
 
instead of dropping the item, it automatically goes into your inventory
If the item is going into your inventory directly, then you're never actually picking it up. This is not a skript issue, it's just how auto-pickup plugins (or scripts) work. You should check whether the plugin responsible for the auto-pickup mechanic has an API you could use to detect when this auto-pickup occurs.
 
  • Like
Reactions: Luke_Sky_Walker