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 


Reading values from file or memory

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

Joined: 16 Aug 2016
Posts: 2

PostPosted: Thu Aug 20, 2020 8:13 pm    Post subject: Reading values from file or memory Reply with quote

Hello,
I'm trying to make a sort of integration between ffmpeg and cheat engine. ffmpeg has a filter cold photosensitivity that is triggered in scenes with a lot of action, or light effects, or chaotic in general. I want to combine that filter with the slow down feature of cheat engine to slow down games in those parts. i have already found in the source code the relevant variable that i will need to trigger the slow down.
I've been trying to use the lua engine to read that value from a written file or directly from memory with read readInteger(), but every time after a few seconds the loop freezes cheat engine and i'm forced to terminate it. i've tried adding a delay but it did not help.
this is the script that i'm using:

a = 1
for a = 1, 9999, +1
do
val = readInteger(0x0034338C)
print (val)
Sleep(10)
end


any help?
thanks
Back to top
View user's profile Send private message AIM Address
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Fri Aug 21, 2020 6:36 am    Post subject: Re: Reading values from file or memory Reply with quote

Code:

Thread=createThread(function()
while(true) do
val = readInteger(0x0034338C)
print (val)
Sleep(10)
end
end
)
Back to top
View user's profile Send private message
amadeok
How do I cheat?
Reputation: 0

Joined: 16 Aug 2016
Posts: 2

PostPosted: Fri Aug 21, 2020 12:07 pm    Post subject: Re: Reading values from file or memory Reply with quote

blankTM wrote:
Code:

Thread=createThread(function()
while(true) do
val = readInteger(0x0034338C)
print (val)
Sleep(10)
end
end
)


Hi thanks for reply. I made a new one,
Code:
val= readInteger(0x00EC338C)
print(val)
Thread=createThread(function()
while(true) do
val= readInteger(0x00EC338C)
if val < 0 then
speedhack_setSpeed(5)
sleep(150)
elseif val > 0 then
speedhack_setSpeed(0.7)
sleep(150)
print(val)
end
end
end)


I works. I'm seeing that it uses about 10% of cpu, is there any way to reduce the cpu usage? thanks
edit: after testing i realized that the high cpu usage comes when becomes these lines:
if val < 0 then
elseif val > 0 then

any advice?
Back to top
View user's profile Send private message AIM Address
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Tue Aug 25, 2020 7:29 am    Post subject: Re: Reading values from file or memory Reply with quote

Code:

Thread=createThread(function()
local speed = 0
while(true) do
local val= readInteger(0x00EC338C)
if val > 0xffff and (val ~ -0x100000000) < 0 then
if speed ~= 5 then
speedhack_setSpeed(5)
speed = 5
end
else if val > 0 then
if speed ~= 0.7 then
speedhack_setSpeed(0.7)
speed = 0.7
end
end
end
sleep(150)
end
end)
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