Help pls pls
-
this.onUpdate = function() { if(mc.thePlayer.ticksExisted % (1*20) == 0) do_stuff(); }
To give some context here,
mc.thePlayer.ticksExisted
is the amount of ticks (20 ticks = one second),x % y
is a modulo operation, it takes the residue of x divided by y.== 0
checks if the modulo operation returns zero, i.e. x is divisible by y.So, since onUpdate runs every tick:
Ticks = 1: false
Ticks = 2: false
Ticks = 3: false
...
Ticks = 20: true
The if statement now runs every time the amount of ticks the player has existed is divisible by 20, every second. -
@cancernameu Thank you very much, helped a lot