Jump to content
  • 0

Auto Compressor Skript Error


Stuff455

Question

Hi there, I'm having an issue with this script. Whenever I try to reload it, it doesn't seem to work.

the script is:

command /setCompressed <item>:
    permission: server.admin
    trigger:
        if player's held item is air:
            message "&cEH can't set an compressed item to air" to player
            stop
        set {compressedInfo::%arg 1%} to player's tool
        message "&7Compressed item for &c%arg 1% &7set" to player

command /createACompressor [<text>]:
    permission: server.admin
    trigger:
        if arg 1 is not set:
            send "&6Creation of a auto compressor"
            send "&6Hold an item and choose item to compress"
            send "&eex: &7/createACompressor raw iron"
            send "&eex: &7/createACompressor diamond"
        else if player's tool is air:
            send "&cHold an item please"
        else:
            set {_i} to player's tool
            set player's tool to {_i} with nbt (nbt compound from "{compType:""%arg 1%""}")

function AutoCompress(p: player, it: item):
    if item amount of {_it} > 1:
        set {_it} to 1 of {_it}
    {compressedInfo::%{_it}%} is set
    set {_pHas} to rounded down (amount of {_it} in {_p}'s inventory / 64) ? 0
    {_pHas} > 0
    remove {_pHas}*64 of {_it} from {_p}'s inventory
    give {_p} {_pHas} of {compressedInfo::%{_it}%}
    if {_it} is plain gold nugget:
        if {_p}'s inventory contains 64 of plain raw gold:
            AutoCompress({_p}, plain raw gold)
    else if {_it} is plain ancient debris:
        if {_p}'s inventory contains 64 of plain netherite ingot:
            AutoCompress({_p}, netherite ingot)

on mine:
    set {_drop} to first element out of drops of event-block using player's tool
    if "%type of {_drop}%" contains tag "tag;compType" of nbt compound of player's offhand tool:
        AutoCompress(player, type of {_drop})

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

You can get a lot of help in the #skript channel in the Discord.

You can join the Discord at https://www.discord.gg/minehut.

No rank - 2017-2021

Minehut Tester - 2021-2023

Minehut Volunteer Moderator - 2023-Current

Report a player/server: Report Player / Server

Create a support ticket: Submit a request

 

Did I help you? If so, feel free to give me a like!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...