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 


Lua Script to update values every frame?

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

Joined: 28 Jan 2018
Posts: 41

PostPosted: Thu Nov 01, 2018 7:54 pm    Post subject: Lua Script to update values every frame? Reply with quote

Hello,

I was wondering if it were possible to use Lua to change an address' value every frame. I wanted to use it for a camera in a game.

I have all the values and addresses already, I was just hoping to create manual camera movements using if/else statements in Lua that ran on a timer to change the value every frame.

Something like:

Code:


addresslist=getAddressList()
function test()
yv = addresslist.getMemoryRecordByDescription("P1_A_Y_Pos").getValue()
if (yv < 1) then
while (yv < 1) do
yv = addresslist.getMemoryRecordByDescription("P1_A_Y_Pos").getValue()
addresslist.getMemoryRecordByDescription("P1_A_Y_Pos").setValue(1)
end
end
end
Back to top
View user's profile Send private message
mg_01
Cheater
Reputation: 0

Joined: 28 Jan 2018
Posts: 41

PostPosted: Fri Nov 02, 2018 5:02 pm    Post subject: Reply with quote

After more digging, Im still not sure how to do it but from what I can tell, it's possible to use writeFloat or setValue. I'm just not sure how to write the syntax for the address I have.

Code:
{$lua}
[Enable]

function jump()
   yval = readFloat("057930E8")

   if (yval < 1) then
   writeFloat("057930E8",yval + 10)
        end
        end
[Disable]


I'm not sure on the syntax and conversions between Lua and AA. I'm not sure if this thing can be written in Lua as a script to execute. Any help is appreciated.
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Fri Nov 02, 2018 8:43 pm    Post subject: Reply with quote

You can use the memory record's value and tonumber to convert the string to a number, a bit more more flexible than lua especially if you already have it all set. Can't really say how to convert the address to lua parsable one without know what it is but in general to read a pointer just add []s around it. eg "[[game.exe+0xBACE]+30]"

The "problem" is that lua doesn't really have any concept of a "frame" in your game, though you can use a timer and run it every 16.67 milliseconds etc.

_________________
https://github.com/FreeER/ has a few CE related repos
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