#Could someone possible help me make it compress everything in 1 go and not one at a time

1 messages · Page 1 of 1 (latest)

worldly oak
#

just make a while statement insted of an if statement

#

and i would not do every 1 second loop all players

tawny glade
#

why are you looping every second if you're already doing it on pickup?

#

as for compressing everything

#

I have thought of the perfect way to make a compressor skript but ive never made it

#

it would use modulo math

worldly oak
#

use pickup and and then when inventory if the item is dragged or getting into the player's inventory

#

but use a while insted of an if, if u want the other thing to work

tawny glade
#

where {_1} is amount of blocks of the type you wanna compress
where {_2} is amount required for one compressed item
amount of compressed items to give = {_1} % {_2}
then, remove that amount times {_2} of the item from the player's inv

#

I believe skript has a mod() function to do the % math

worldly oak
#

while {_p}'s inventory contains 64 of plain cobblestone:
remove 64 of plain Cobblestone from {_p}'s inventory

tawny glade
#

my solution has 0 loops

#

that's why it's so beautiful and perfect

worldly oak
#

a loop like that wound't lag the server

tawny glade
#

yeah I mean there's many ways to do a good compressor skript

#

but mine's the only one without loops

worldly oak
#

idk how much ur thing takes up compared to mine

tawny glade
#

less resources

#

it's just a bit of math

#

look at player's inventory, do some math, take and give once

worldly oak
#

and the other is just an statement. But we are proberly talking about 1-10 ms

tawny glade
#

you need to look at player inventory every time and then take and give every time

tawny glade
#

there's multiple good ways

#

but if you wanna compare speed, mine is for sure faster cus only math is very often better than loops