Page 1 of 1

lua tics instead of a timer.

Posted: Wed Jul 20, 2022 2:29 am
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.

Re: lua tics instead of a timer.

Posted: Wed Jul 20, 2022 9:45 pm
by LeFiXER
As in getTickCount? If so:

Code: Select all

local tickCount = getTickCount()

Re: lua tics instead of a timer.

Posted: Sat Jul 23, 2022 5:33 am
by hcapinjr
As in

Code: Select all

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

Re: lua tics instead of a timer.

Posted: Sat Jul 23, 2022 4:32 pm
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.

Re: lua tics instead of a timer.

Posted: Mon Jul 25, 2022 2:03 am
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.

Re: lua tics instead of a timer.

Posted: Mon Jul 25, 2022 2:17 am
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.

Re: lua tics instead of a timer.

Posted: Mon Jul 25, 2022 11:18 am
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]