Help pls pls
-
Please tell me how to make something happen something every second, two seconds or three
this.onUpdate = function() { if(mc.thePlayer.ticksExisted % (1*20) == 0) do_stuff(); }To give some context here,
mc.thePlayer.ticksExistedis the amount of ticks (20 ticks = one second),x % yis a modulo operation, it takes the residue of x divided by y.== 0checks 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. -
this.onUpdate = function() { if(mc.thePlayer.ticksExisted % (1*20) == 0) do_stuff(); }To give some context here,
mc.thePlayer.ticksExistedis the amount of ticks (20 ticks = one second),x % yis a modulo operation, it takes the residue of x divided by y.== 0checks 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login