Solved Help With autoCompress skript

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

Status
Not open for further replies.

Plav

Member
Dec 18, 2022
14
1
3
26
Recently I started making a skymining server, and players need to be able to have a certain item, and if its in their offhand, it will compress iron ingots into compressed iron ingots, but I keep getting these errors when I reload the skript, can someone remake the skript and send it to me?
Code:
every 1 second:
    loop all players:
        if player's offhand is stone named "&f&lIronAutoCompressor":
        loop all players where [input has 32 of iron ingots]:
            set {_n} to number of iron ingots in loop-player's inventory
            set {_n} to {_n} / 32
            set {_n} to floor({_n})
            loop {_n} times:
                remove ({_n} * 32) of iron ingots from loop-player's offhand
                give {_n} of iron ingots named "&dCompressed iron ingots" to the loop-player
image.png

[doublepost=1673367441,1673314673][/doublepost]can someone please reply?
 

Attachments

  • image.png
    image.png
    67.7 KB · Views: 88
Recently I started making a skymining server, and players need to be able to have a certain item, and if its in their offhand, it will compress iron ingots into compressed iron ingots, but I keep getting these errors when I reload the skript, can someone remake the skript and send it to me?
Code:
every 1 second:
    loop all players:
        if player's offhand is stone named "&f&lIronAutoCompressor":
        loop all players where [input has 32 of iron ingots]:
            set {_n} to number of iron ingots in loop-player's inventory
            set {_n} to {_n} / 32
            set {_n} to floor({_n})
            loop {_n} times:
                remove ({_n} * 32) of iron ingots from loop-player's offhand
                give {_n} of iron ingots named "&dCompressed iron ingots" to the loop-player
image.png

[doublepost=1673367441,1673314673][/doublepost]can someone please reply?
Spoon feeding time

Quick explanation, your syntax is wrong skript doesn't recognize
Code:
loop-players offhand
what it can read is
Code:
loop-player's offhand tool
and when in a periodical event, such as "every {x} second/tick", you can't use 'player' because there is no specific player, here and to get the value of player, use loop-player.

Also you don't need to loop all players twice, because you're already looping all players, just add an if statement like i did here:


Code:
every second:
    loop all players:
        if loop-player's offhand tool is stone named "&f&lIronAutoCompressor":
            if loop-player has 32 iron ingot:
                set {_n} to number of iron ingots in loop-player's inventory
                set {_n} to {_n} / 32
                set {_n} to floor({_n})
                loop {_n} times:
                    remove ({_n} * 32) of iron ingots from loop-player's inventory
                    give {_n} of iron ingots named "&dCompressed iron ingots" to the loop-player
 
It will remove any iron ingots, can you make is so it only removes normal iron ingots?
 
It will remove any iron ingots, can you make is so it only removes normal iron ingots?
Code:
every second:
    loop all players:
        if loop-player's offhand tool is stone named "&f&lIronAutoCompressor":
            if loop-player has 32 iron ingot named "&dCompressed iron ingots":
                set {_n} to number of iron ingots named "&dCompressed iron ingots" in loop-player's inventory
                set {_n} to {_n} / 32
                set {_n} to floor({_n})
                loop {_n} times:
                    remove ({_n} * 32) of iron ingots named "&dCompressed iron ingots" from loop-player's inventory
                    give {_n} of iron ingots named "&dCompressed iron ingots" to the loop-player

Here you go
 
No I meant I want it to convert 32 vanilla iron ingots into 1 iron ingot named ¨&dCompressed iron ingot, but this looks like it will convert ingots that are already compressed, so it will just prevent you from getting more than 31 compressed ingots
 
No I meant I want it to convert 32 vanilla iron ingots into 1 iron ingot named ¨&dCompressed iron ingot, but this looks like it will convert ingots that are already compressed, so it will just prevent you from getting more than 31 compressed ingots
well thats something you should do, and if you encounter errors, you can come make ask for help here ;-
 
Status
Not open for further replies.