 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Flux. Advanced Cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 88 Location: Another World - N5X2 106311411+2123518
|
Posted: Sat Feb 22, 2020 4:32 pm Post subject: How to run lua in AA script |
|
|
Hi all, struggling with a script.
Got this snippet of code
The opcode is on a timer and cl moves a 1 byte value.
I can make this work using two scripts but am trying to make it work from just one, but the symbol is causing me problems.
What i want to do is -
| Code: |
alloc(test,1)
registersymbol(test)
{$lua}t = createTimer(nil)
t.setInterval = 1000
t.OnTimer = function()
local z = "test" -- problem here, cant find the symbol.
if something == true then
writeBytes (z.Address, -0xFF)
sleep(500)
writeBytes (z.Address, -0x00)
else
writeBytes (z.Address, 0x00)
{$asm}
newmem:
add cl,[test]
mov [rax+42],cl
|
Any help would be appreciated. |
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4715
|
Posted: Sat Feb 22, 2020 5:36 pm Post subject: |
|
|
How did you come up with that code? You can't just make stuff up and expect it to work.
You could start by learning the basics of how to write Lua code. Then, look at code others have written using features CE added to Lua, and consult the documentation in celua.txt for more information.
Perhaps this is closer to what you were trying to do?
| Code: | alloc(test,1)
registersymbol(test)
{$lua}
t = createTimer(nil)
t.Interval = 1000
t.OnTimer = function()
local z = readBytes('test',1)
if something then
writeBytes('test', 0xff)
sleep(500)
end
writeBytes('test', 0x00)
end
{$asm}
newmem:
add cl,[test]
mov [rax+42],cl
|
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
Flux. Advanced Cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 88 Location: Another World - N5X2 106311411+2123518
|
Posted: Sat Feb 22, 2020 6:17 pm Post subject: |
|
|
The code was simply an example of what i was trying to.
Like i said i can make it work easily in two scripts (one asm and one lua),
but was asking for help to make it work in one script.
After doing some tests of the code you gave, the only thing i needed to change on the script i posted was this-
to this
| Code: | | local z = readBytes('test',1) |
and a fully functional asm/lua script.
Thank you very much ParkourPenguin, your help is very appreciated. |
|
| 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
|
|