What does updateticks++, ticks and updateticks do in scriptapi?

Avatar

By 6Sence 6 September 2019 06:30

Member · 28 comments

What does updateticks++, ticks and updateticks do in scriptapi?

Avatar

By soulplexis 6 September 2019 07:06

Donator · 479 comments

It's a bad coding method to limit the rate that things happen or other.. like setting a stopwatch and at some amount of time passed you do something, and then reset the clock to 0 repeat..
Like instead of it executing the code 20x second you can put this to make it once every second
Ticks++;
If(ticks >=20) {
[Something here]
Ticks = 0;
}


【ソルプレクサス】

Avatar

By michaelpt9 20 September 2019 13:32

Member · 97 comments

using TicksExisted is better tho.


Config creator.

Avatar

By Aftery 21 September 2019 09:33

Member · 69 comments
michaelpt9 wrote

using TicksExisted is better tho.

Depends.
If you want it to run something precisely after enabling a module, etc... a ticks variable should be used
For example, say I have this code:
if (mc.thePlayer.ticksExisted % 500 == 0) mc.thePlayer.jump();
Say for example you enable your module at tick 501, you'll have to wait 499 ticks for it to happen.
But if you enable it at 499, it gets executed next tick.


@Aftery#5051 on discord.