How to create 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
User avatar
Blayde
Expert Cheater
Expert Cheater
Posts: 230
Joined: Fri Aug 25, 2017 2:37 pm
Reputation: 47

How to create a timer ?

Post by Blayde »

Help. I feel stuck and stupid. :lol:

I need a timer to read value (constantly).

al = getAddressList()
mr = al.getMemoryRecordByDescription("Description here")
CEEditBox.Text = mr.Value

TimFun13
Expert Cheater
Expert Cheater
Posts: 1354
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 6

Re: How to create a timer ?

Post by TimFun13 »

Code: Select all

--------
-------- Timer
--------
local aTimer = nil
local aTimerInterval = 10
local aTimerTicks = 0
local aTimerTickMax = 0
local function aTimer_tick(timer)
	if aTimerTickMax > 0 and aTimerTicks >= aTimerTickMax then
		timer.destroy()
	end
	aTimerTicks = aTimerTicks + 1
	-- body
end
aTimer = createTimer(getMainForm(), false)
aTimer.Interval = aTimerInterval
aTimer.OnTimer = aTimer_tick
aTimer.Enabled = true
Generated with: [Link]

User avatar
FreeER
Expert Cheater
Expert Cheater
Posts: 116
Joined: Fri Mar 10, 2017 7:11 pm
Reputation: 28

Re: How to create a timer ?

Post by FreeER »

A simpler option might be to let CE handle it whenever it updates the memory record using OnGetDisplayValue

Code: Select all

al = getAddressList()
mr = al.getMemoryRecordByDescription("Description here")

mr.OnGetDisplayValue = function(mr,valuestring)
  --CETrainer.CEEdit1.Text = valuestring -- testing
  CEEditBox.Text = valuestring
end

User avatar
Blayde
Expert Cheater
Expert Cheater
Posts: 230
Joined: Fri Aug 25, 2017 2:37 pm
Reputation: 47

Re: How to create a timer ?

Post by Blayde »

FreeER wrote:
Sun Jan 07, 2018 3:20 pm
A simpler option might be to let CE handle it whenever it updates the memory record using OnGetDisplayValue

Code: Select all

al = getAddressList()
mr = al.getMemoryRecordByDescription("Description here")

mr.OnGetDisplayValue = function(mr,valuestring)
  --CETrainer.CEEdit1.Text = valuestring -- testing
  CEEditBox.Text = valuestring
end
Thanks.
I'll do some tests and report.


Edit:
Error

Code: Select all

al = getAddressList()
mr = al.getMemoryRecordByDescription("Description here")
mr.OnGetDisplayValue = function(mr,valuestring)
  --CETrainer.CEEdit1.Text = valuestring -- testing
  CEEditBox.Text = valuestring
end
Working

Code: Select all

al = getAddressList()
mr = al.getMemoryRecordByDescription("Description here")
mr.OnGetDisplayValue = function(mr,valuestring)
  CETrainer.CEEdit1.Text = valuestring -- testing
  --CEEditBox.Text = valuestring
end
Thank you

Post Reply

Who is online

Users browsing this forum: No registered users