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 


Tracking value change

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
parthekos
How do I cheat?
Reputation: 0

Joined: 27 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 6:35 am    Post subject: Tracking value change Reply with quote

I would like use Lua, to print the history of how base pointer's value changes over time(on it's own, i do not intend to change the value manually).

Let's say that the xxxxxxx address has value 10.

i want the script to print the 10 to the console and wait until this 10 changes.

when xxxxxxx value grows to for example 25, i want it to print the 25 in new line.

So far I got this, but it freezes upon opening output console.

Code:
local address = "4A3AD230"
local current = readInteger(address)
print(current)

repeat
    sleep(1)
    local new = readInteger(address)
    if new ~= current then
        print(new)
        current = new
    end
until i_get_bored
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Jun 27, 2014 8:36 am    Post subject: Reply with quote

Code:
local address = "4A3AD230"
local current = readInteger(address)
print(current)
local timer = createTimer(nil,false);
timer.onTimer = function(sender)
local newvalue = readInteger(address);
if (current~= newvalue) then
current = newvalue;
print(current);
end
end
timer.Interval = 1;
timer.Enabled = true;

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
parthekos
How do I cheat?
Reputation: 0

Joined: 27 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 8:51 am    Post subject: Reply with quote

This is just perfect. Is there any way to write those values to a .txt file or maybe keep the console minimzed? Because the console window forces itself onto top of the screen on each value change.

Last edited by parthekos on Fri Jun 27, 2014 9:22 am; edited 2 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jun 27, 2014 9:08 am    Post subject: Reply with quote

view->show on print
and you could use the lua io library to write the results to file

_________________
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
parthekos
How do I cheat?
Reputation: 0

Joined: 27 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 9:23 am    Post subject: Reply with quote

just noticed that when the value of an address go way over into high number like 5555555555, then the integer displayed in the console goes into negative (i.e. instead of displaying 678432678423 it displays -32415521). It works corretly on low values though.

Address value type is 4 bytes. I have tried changing the integer in the script to readBytes(address, 4) but it returns ~200ish value.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jun 27, 2014 9:31 am    Post subject: Reply with quote

an address value type of 4 can never contain the value 678432678423 which is a 5 byte value at least

anyhow, if the 4 byte value is smaller than 0, then just add the 4 byte max value to it (4294967296) to get the unsigned version
Code:

if current<0 then
  current=4294967296+current
end

_________________
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
parthekos
How do I cheat?
Reputation: 0

Joined: 27 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 9:47 am    Post subject: Reply with quote

Well it does the job. However I would like to ask if there is any way to make the interval even lower? I assume that "1" stands for 1 second interval which sometimes seems to stack 2-3 value changes into one(i.e. skips those values and doesn't print them). Tried 0.1/0,1/0/false but without success.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Jun 27, 2014 9:57 am    Post subject: Reply with quote

Code:
local address = "4A3AD230"
local current = readInteger(address)
print(current);
createNativeThread(function()
   while true do
      local newvalue = readInteger(address);
      if (current~= newvalue) then
      current = newvalue;
      print(current);
   end
end);

Fastest way to read that I know..
If that doesn't suit enough, look into breakpoints, and store values.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
parthekos
How do I cheat?
Reputation: 0

Joined: 27 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 10:13 am    Post subject: Reply with quote

DaSpamer wrote:
Code:
local address = "4A3AD230"
local current = readInteger(address)
print(current);
createNativeThread(function()
   while true do
      local newvalue = readInteger(address);
      if (current~= newvalue) then
      current = newvalue;
      print(current);
   end
end);

Fastest way to read that I know..
If that doesn't suit enough, look into breakpoints, and store values.


Unexpected symbol near ) at line 11. Tried to work around in 20 different ways, guess I don't understand Lua at all Very Happy
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jun 27, 2014 11:52 am    Post subject: Reply with quote

There needs to be an extra "end" after print
_________________
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
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