lua tics instead of a timer.

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
hcapinjr
Novice Cheater
Novice Cheater
Posts: 15
Joined: Wed Oct 21, 2020 11:27 am
Reputation: 4

lua tics instead of a timer.

Post by hcapinjr »

Hey all I was just wondering if it was possible in scripting lua to use tics instead of a timer. Thank you in advance.

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 489
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 251

Re: lua tics instead of a timer.

Post by LeFiXER »

As in getTickCount? If so:

Code: Select all

local tickCount = getTickCount()

hcapinjr
Novice Cheater
Novice Cheater
Posts: 15
Joined: Wed Oct 21, 2020 11:27 am
Reputation: 4

Re: lua tics instead of a timer.

Post by hcapinjr »

As in

Code: Select all

healthTimer = createTimer()
healthTimer.Interval = 1000
But using ticks in stead of creating a timer

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 489
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 251

Re: lua tics instead of a timer.

Post by LeFiXER »

I'm not really sure why you want to use ticks instead of milliseconds that the timer offers but perhaps using either:

Code: Select all

os.clock() 
os.difftime() 
would be of use.

hcapinjr
Novice Cheater
Novice Cheater
Posts: 15
Joined: Wed Oct 21, 2020 11:27 am
Reputation: 4

Re: lua tics instead of a timer.

Post by hcapinjr »

The game writes way faster than millisecond more like microseconds so I want to use ticks then the cheat can keep up with the games writing.

hcapinjr
Novice Cheater
Novice Cheater
Posts: 15
Joined: Wed Oct 21, 2020 11:27 am
Reputation: 4

Re: lua tics instead of a timer.

Post by hcapinjr »

I should have stated that the interval is at 1 not 1000 and it still can't keep up with the games check and (re)write speeds.

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 489
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 251

Re: lua tics instead of a timer.

Post by LeFiXER »

I think you require a hi-resolution timer for this. The code provided will return the QueryPerformanceCounter value:

Code: Select all

if qpccallerRegistered ~= true then
  qpccallerRegistered = autoAssemble([[
                        alloc(qpccaller, 1024)
                        registersymbol(qpccaller)

                        qpccaller:
                        sub rsp,30
                        lea rcx,[rsp+28]
                        mov [rcx],0
                        call QueryPerformanceCounter
                        mov rax,[rsp+28]
                        add rsp,30
                        ret
                        ]],
                        true)
end
return executeCodeLocal("qpccaller")
Note: works only on 64-bit and version CE 6.5+
Credit: DarkByte

Perhaps these links will provide further insight:
[Link]
[Link]

Post Reply

Who is online

Users browsing this forum: No registered users