Jump to content

Help with autocompressor skript.


S0zi

Recommended Posts

options:
    prefix: &2Auto&aCompress
    timeorpickup: 1
    time: 1 second
    autopermission: autocomp.use
    permissionmessage: &fUnknown command. Type "/help" for help.
    getautopermission: staff.getautocomp
    # timeorpickup: Set to 1 for the check to occur every {@time}, and set to 2 to check on every pickup (may not work with auto pickup)

command /autocompress [<text>]:
    permission: {@autopermission}
    permission message: {@permissionmessage}
    trigger:
        if arg-1 is set:
            if arg-1 is "on":
                set {autopickup::%player's uuid%} to true
                send "{@prefix} &aSet automatic compressions to &etrue&a."
            else:
                if arg-1 is "off":
                    set {autopickup::%player's uuid%} to false
                    send "{@prefix} &aSet automatic compressions to &efalse&a."
                else:
                    if arg-1 is "check":
                        if {autopickup::%player's uuid%} is not true:
                            send "{@prefix} &aYou currently have automatic compressions set to &efalse&a."
                        else:
                            send "{@prefix} &aYou currently have automatic compressions set to &etrue&a."
                    else:
                        if arg-1 is "toggle":
                            if {autopickup::%player's uuid%} is true:
                                set {autopickup::%player's uuid%} to false
                                send "{@prefix} &aSet automatic compressions to &efalse&a."
                            if {autopickup::%player's uuid%} is not true:
                                set {autopickup::%player's uuid%} to true
                                send "{@prefix} &aSet automatic compressions to &etrue&a."
                        else:
                            send "&cInvalid usage. Correct usage: &b/autocompress [on | off | toggle | check]"
        else:
            if {autopickup::%player's uuid%} is true:
                set {autopickup::%player's uuid%} to false
                send "{@prefix} &aSet automatic compressions to &efalse&a."
            if {autopickup::%player's uuid%} is not true:
                set {autopickup::%player's uuid%} to true
                send "{@prefix} &aSet automatic compressions to &etrue&a."

command /getautocompressor [<text>]:
    permission: {@getautopermission}
    permission message: {@permissionmessage}
    trigger:
        if arg-1 is set:
            if arg-1 is "dirt":
                give player 1 nether star named "&fDirt AutoCompressor" with lore "&7Automatically compresses dirt!"
                send "{@prefix} &aYou have received an &fDirt AutoCompressor&a!"
            if arg-1 is "rooted dirt":
                give player 1 nether star named "&fRooted Dirt AutoCompressor" with lore "&7Automatically compresses rooted dirt!"
                send "{@prefix} &aYou have received an &fAuto Stone Compressor&a!"
            if arg-1 is "grass block":
                give player 1 nether star named "&fGrass AutoCompressor" with lore "&7Automatically compresses grass!"
                send "{@prefix} &aYou have received an &fAuto Grass Compressor&a!"
            if arg-1 is "podzol":
                give player 1 nether star named "&fPodzol AutoCompressor" with lore "&7Automatically compresses podzol!"
                send "{@prefix} &aYou have received an &eAuto Podzol Compressor&a!"
            if arg-1 is "mycelium":
                give player 1 copper block named "&fMycelium AutooCompressor" with lore "&7Automatically compresses mycelium!"
                send "{@prefix} &aYou have received an &fAuto Mycelium Compressor&a!"
            if arg-1 is "oak log":
                give player 1 nether star named "&fOak AutoCompressor" with lore "&7Automatically compresses oak logs!"
                send "{@prefix} &aYou have received an &fAuto Oak Log Compressor&a!"
            if arg-1 is "birch log":
                give player 1 nether star named "&fBirch AutoCompressor" with lore "&7Automatically compresses birch logs!"
                send "{@prefix} &aYou have received an &fAuto Birch Log Compressor&a!"
            if arg-1 is "acacia log":
                give player 1 nether star named "&fAcacia AutoCompressor" with lore "&7Automatically compresses acacia logs!!"
                send "{@prefix} &aYou have received an &fAuto Acacia Log Compressor&a!"
            if arg-1 is "super" or "auto":
                give player 1 nether star named "&4Super &fAuto Compressor" with lore "&7Automatically compresses everything compressable!"
                send "{@prefix} &aYou have received a &4Super &fAuto Compressor&a!"
            if arg-1 is "all" or "everything":
                give player 1 nether star named "&fDirt AutoCompressor" with lore "&7Automatically compresses dirt!"
                give player 1 nether star named "&fRooted Dirt AutoCompressor" with lore "&7Automatically compresses rooted dirt!"
                give player 1 nether star named "&fGrass AutoCompressor" with lore "&7Automatically compresses grass!"
                give player 1 nether star named "&fPodzol AutoCompressor" with lore "&7Automatically compresses podzol!"
                give player 1 nether star named "&fMycelium AutoCompressor" with lore "&7Automatically compresses mycelium!"
                give player 1 nether star named "&fOak AutoCompressor" with lore "&7Automatically compresses oak logs!"
                give player 1 nether star named "&fBirch AutoCompressor" with lore "&7Automatically compresses birch logs!"
                give player 1 nether star named "&fAcacia AutoCompressor" with lore "&7Automatically compresses acacia logs!"
                give player 1 nether star named "&4Super &fAuto Compressor" with lore "&7Automatically compresses everything compressable!"
                send "{@prefix} &aYou have received &eevery auto compressor&a!"
            if arg-1 is not "oak" or "wood" or "stone" or "coal" or "iron" or "copper" or "gold" or "diamond" or "emerald" or "super" or "auto" or "all" or "everything":
                send "&cInvalid compressor name. Valid compressors: &b/getautocompressor [oak/wood | stone | coal | iron | copper | gold | diamond | emerald | super/auto | all/everything]"
        else:
            send "&cInvalid usage. Correct usage: &b/getautocompressor [oak/wood | stone | coal | iron | copper | gold | diamond | emerald | super/auto | all/everything]"

every {@time}:
    if {@timeorpickup} is 1:
        autoCompress()

on pickup:
    if {@timeorpickup} is 2:
        autoCompress()

function autoCompress():
    loop all players:
        if loop-player's offhand is nether star named "&fDirt AutoCompressor" with lore "&7Automatically compresses dirt!":
            loop 64 times:
                if loop-player has 64 dirt:
                    remove 64 of dirt from loop-player's inventory
                    give 1 of shiny dirt named "&6&lCompressed &b&lDirt" to loop-player
        
        if loop-player's offhand is nether star named "&fRooted Dirt AutoCompressor" with lore "&7Automatically compresses rooted dirt!":
            loop 64 times:
                if loop-player has 64 rooted dirt:
                    remove 64 of rooted dirt from loop-player's inventory
                    give 1 of shiny rooted dirt named "&6&lCompressed &b&lRooted Dirt" to loop-player
        
        if loop-player's offhand is nether star named "&fGrass AutoCompressor" with lore "&7Automatically compresses grass":
            loop 64 times:
                if loop-player has 64 grass block:
                    remove 64 of grass block from loop-player's inventory
                    give 1 of shiny grass block named "&6&lCompressed &b&lGrass" to loop-player
        
        if loop-player's offhand is nether star named "&fPodzol AutoCompressor" with lore "&7Automatically compresses podzol!":
            loop 64 times:
                if loop-player has 64 podzol:
                    remove 64 of podzol from loop-player's inventory
                    give 1 of shiny podzol named "&6&lCompressed &b&lPodzol" to loop-player
        
        if loop-player's offhand is nether star named "&fMycelium AutoCompressor" with lore "&7Automatically compresses mycelium!":
            loop 64 times:
                if loop-player has 64 mycelium:
                    remove 64 of mycelium from loop-player's inventory
                    give 1 of shiny mycelium named "&6&lCompressed &b&lMycelium" to loop-player
        
        if loop-player's offhand is nether star named "&fOak AutoCompressor" with lore "&7Automatically compresses oak logs!":
            loop 64 times:
                if loop-player has 64 oak log:
                    remove 64 of oak log from loop-player's inventory
                    give 1 of shiny oak log named "&6&lCompressed &b&lOak Log" to loop-player
        
        if loop-player's offhand is nether star named "&fBirch AutoCompressor" with lore "&7Automatically compresses birch logs!":
            loop 64 times:
                if loop-player has 64 birch log:
                    remove 64 of birch log from loop-player's inventory
                    give 1 of shiny birch log named "&6&lCompressed &b&lBirch Log" to loop-player
        
        if loop-player's offhand is nether star named "&fAcacia AutoCompressor" with lore "&7Automatically compresses acacia logs!":
            loop 64 times:
                if loop-player has 64 acacia log:
                    remove 64 of acacia log from loop-player's inventory
                    give 1 of shiny acacia log named "&6&lCompressed &b&lAcacia Log" to loop-player

        if loop-player's offhand is nether star named "&4Super &fAuto Compressor" with lore "&7Automatically compresses everything compressable!":
            set {_compressable::*} to dirt, rooted dirt, grass, podzol, mycelium, oak log, birch log, and acacia log
            loop {_compressable::*}:
                if loop-player has 64 of loop-value-2:
                    set {_amount} to number of loop-value-2 in loop-player's inventory
                    set {_amount} to {_amount} / 64
                    set {_amount} to floor({_amount})
                    loop {_amount} times:
                        remove ({_amount} * 64) of loop-value-2 from loop-player's inventory
                        if loop-value-2 is dirt:
                            give {_amount} of shiny dirt named "&6&lCompressed &b&lDirt" to loop-player
                        if loop-value-2 is rooted dirt:
                            give {_amount} of shiny rooted dirt named "&6&lCompressed &b&lRooted Dirt" to loop-player
                        if loop-value-2 is grass block:
                            give {_amount} of shiny grass block named "&6&lCompressed &b&lGrass" to loop-player
                        if loop-value-2 is podzol:
                            give {_amount} of shiny podzol named "&6&lCompressed &b&lPodzol" to loop-player
                        if loop-value-2 is mycelium:
                            give {_amount} of shiny mycelium named "&6&lCompressed &b&lMycelium" to loop-player
                        if loop-value-2 is oak log:
                            give {_amount} of shiny oak log named "&6&lCompressed &b&lOak Log" to loop-player
                        if loop-value-2 is birch log:
                            give {_amount} of shiny birch log named "&6&lCompressed &b&lBirch Log" to loop-player
                        if loop-value-2 is acacia log:
                            give {_amount} of shiny acacia log named "&6&lCompressed &b&lAcacia Log" to loop-player

 

This is the Skript, it functions correctly initially but then stops compressing items. To clarify, it successfully compresses the item once, but subsequently fails to do so while still taking blocks from the player.

Link to comment
Share on other sites

  • 2 months later...

Please make sure that you aren't responding to posts that haven't been responded to in over a month. Thanks!

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Labs, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...