 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Gravitary How do I cheat?
Reputation: 0
Joined: 13 Jan 2022 Posts: 0
|
Posted: Thu Jan 13, 2022 10:32 am Post subject: [Q] Complex Lua question |P to Unicode String to P on Button |
|
|
Hello everyone,
I wanted to get more into assembler and LUA so I decided to take one of my favorite games apart, so far successfully, learning a lot in the meantime.
However, I have run into a wall that I can't solve yet.
What I have:
Level 2 pointer to X
Level 2 pointer to Y
Level 4 pointer to X2
Level 4 pointer to Y2
What I want:
At the press of a button, I want to read from X2, Y2 and put the value into the memory of X, Y respectively.
The issue:
X and Y are floats
X2 and Y2 are Unicode String[5] and need to be parsed.
I have no clue how to do all that at the press of a button
Nice to have:
Freezing X and Y via LUA as well instead of over Toggle Freeze.
Any help is appreciated.
Best regards. |
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 512
|
Posted: Sat Jan 15, 2022 6:24 am Post subject: |
|
|
| @atom0s move it to lua scripting,this post is in inappropriate section |
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Sat Jan 15, 2022 7:18 am Post subject: Re: [Q] Complex Lua question |P to Unicode String to P on Bu |
|
|
| Gravitary wrote: | Hello everyone,
I wanted to get more into assembler and LUA so I decided to take one of my favorite games apart, so far successfully, learning a lot in the meantime.
However, I have run into a wall that I can't solve yet.
What I have:
Level 2 pointer to X
Level 2 pointer to Y
Level 4 pointer to X2
Level 4 pointer to Y2
What I want:
At the press of a button, I want to read from X2, Y2 and put the value into the memory of X, Y respectively.
The issue:
X and Y are floats
X2 and Y2 are Unicode String[5] and need to be parsed.
I have no clue how to do all that at the press of a button
Nice to have:
Freezing X and Y via LUA as well instead of over Toggle Freeze.
Any help is appreciated.
Best regards. |
You can use a timer to set the value of X and Y via Lua. As for the Unicode String you could use the Lua function tonumber(variable).
| Code: |
local x = "500.00"
-- print is to show the casting although visibly, they look the same.
print(tonumber(x))
|
For a timer you can do something like this:
| Code: |
local mytimer = createTimer(getMainForm())
mytimer.Interval = 1000 -- Interval is in milliseconds
mytimer.OnTimer = function()
local al = getAddressList()
local X = al.getMemoryRecordByDescription("Entry in table that has X description")
local Y = al.getMemoryRecordByDescription("Entry in table that has Y description")
local X2 = al.getMemoryRecordByDescription("Entry in table that has X2 description")
local Y2 = al.getMemoryRecordByDescription("Entry in table that has Y2 description")
-- Double-check that the entries exist
if X ~= nil and Y ~= nil and X2 ~= nil and Y2 ~= nil then
X.Value = tonumber(X2)
Y.Value = tonumber(Y2)
else
-- If the entries don't exist, we don't want the timer to continue running so we kill it
mytimer.destroy()
mytimer = nil
end
end
|
|
|
| Back to top |
|
 |
|
|
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
|
|