Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Print out value every time it changes

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
abahbob
Advanced Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 63

PostPosted: Sat Dec 08, 2012 3:35 pm    Post subject: Print out value every time it changes Reply with quote

So, pretty much I want a script that will print out a value at a specific address everytime it changes. I can't manage to get it to print out correctly, as it is 4 Byte Big Endian. So pretty much I would like it to get printed out to the console or some way I can put it into a spreadsheet, already converted.
_________________
Back to top
View user's profile Send private message AIM Address
Dark Byte
Site Admin
Reputation: 373

Joined: 09 May 2003
Posts: 22014
Location: The netherlands

PostPosted: Sat Dec 08, 2012 4:57 pm    Post subject: This post has 1 review(s) Reply with quote

Since ce's lua doesn't have support for readCustomTypeAsInt()/readCustomTypeAsFloat() yet you'll need to add the big endian address to the addresslist using the big endian custom type ( http://forum.cheatengine.org/viewtopic.php?t=544988 ) and then use lua to read it as a string

Code:

al=getAddressList()
mr=addresslist_getMemoryRecord(al,0) --get the first entry in the list
lastValue=memoryrecord_getValue(mr)

print(lastValue)

function readValueTimer(t)
  local currentValue=memoryrecord_getValue(mr)
  if currentValue ~= lastValue then --value changed
    print(currentValue)
    lastValue=currentValue
  end
end

t1=createTimer(nil)
timer_setInterval(t1,100) --check every 1/100th second if the value has changed
timer_onTimer(t1,readValueTimer)


to stop execute
Code:

object_destroy(t1)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
abahbob
Advanced Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 63

PostPosted: Sat Dec 08, 2012 6:06 pm    Post subject: Reply with quote

Wow Dark Byte, thanks a ton!
_________________
Back to top
View user's profile Send private message AIM Address
engineer_professor
Newbie cheater
Reputation: 0

Joined: 31 Jan 2013
Posts: 10

PostPosted: Thu Jan 31, 2013 1:12 am    Post subject: Reply with quote

How can I make this script check the address more often?

It is missing at least 50% of the values. This means it is not printing 50% of the values.

Thanks!!

EDIT:

I found that changing the setinterval to 10 now prints all values. Very Happy

Dark Byte wrote:


Code:

al=getAddressList()
mr=addresslist_getMemoryRecord(al,0) --get the first entry in the list
lastValue=memoryrecord_getValue(mr)

print(lastValue)

function readValueTimer(t)
  local currentValue=memoryrecord_getValue(mr)
  if currentValue ~= lastValue then --value changed
    print(currentValue)
    lastValue=currentValue
  end
end

t1=createTimer(nil)
timer_setInterval(t1,100) --check every 1/100th second if the value has changed
timer_onTimer(t1,readValueTimer)


to stop execute
Code:

object_destroy(t1)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites