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 on Emulator

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

Joined: 15 Mar 2016
Posts: 23

PostPosted: Mon May 06, 2019 10:03 pm    Post subject: Lua Script on Emulator Reply with quote

Hello guys I have a script that is working fine with pc games but the only problem, it cannot work with an emulator. I am trying this script on gens32 emulator but the error comes with the address I guess.
Simple question. How to put this address so that it can work.
"Gens32Surreal.exe+2A3026"

Also see Screenshots





This is the script and it is working fine with pc games

DoneState = false
local addr = 0x00559118
local val = 1
local function timer_tick(timer)
local v = readInteger(addr) -- read value
if v < 100 then -- check value
writeInteger(addr, val + v) -- write value
else

end
if DoneState == true then
timer.destroy()
end
end

if syntaxcheck then return end
local someTimer = createTimer(MainForm)
someTimer.Interval = 3000
someTimer.OnTimer = timer_tick


Thank you in Adv.



Capture3.JPG
 Description:
 Filesize:  85.45 KB
 Viewed:  2414 Time(s)

Capture3.JPG



Capture2.JPG
 Description:
 Filesize:  99.75 KB
 Viewed:  2414 Time(s)

Capture2.JPG



Capture.JPG
 Description:
 Filesize:  94.32 KB
 Viewed:  2414 Time(s)

Capture.JPG


Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon May 06, 2019 10:18 pm    Post subject: Reply with quote

Make "addr" a string.
https://wiki.cheatengine.org/index.php?title=Lua#Reading
https://wiki.cheatengine.org/index.php?title=Lua:readInteger

_________________
Back to top
View user's profile Send private message Visit poster's website
danishdanish
Newbie cheater
Reputation: 0

Joined: 15 Mar 2016
Posts: 23

PostPosted: Mon May 06, 2019 10:41 pm    Post subject: Reply with quote

I dont know how to. Can you just make it. So I can simply copy and paste Smile
Plzzzz
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon May 06, 2019 11:26 pm    Post subject: Reply with quote

danishdanish wrote:
I dont know how to. Can you just make it. So I can simply copy and paste Smile
Plzzzz

"Gens32Surreal.exe+2A3026"

_________________
Back to top
View user's profile Send private message Visit poster's website
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue May 07, 2019 6:29 am    Post subject: Reply with quote

use
Code:
addr = getAddress('Gens32Surreal.exe') + 0x2A3026;

as lua cannot understand what is Gens32Surreal.exe nor that it is memory address

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue May 07, 2019 7:53 am    Post subject: Reply with quote

^^ readInteger, writeInteger, and getAddress can all take a string for the address parameter, but readInteger and writeInteger basically call getAddress on it. But this would keep it from needing to be called twice.

Plus this would work too:
Code:
addr = getAddress('Gens32Surreal.exe+2A3026')


@danishdanish
And I noticed your address is a 2 byte WORD in your table so you might want to use "readSmallInteger" and "writeSmallInteger".
https://wiki.cheatengine.org/index.php?title=Lua:readSmallInteger
https://wiki.cheatengine.org/index.php?title=Lua:writeSmallInteger

_________________
Back to top
View user's profile Send private message Visit poster's website
danishdanish
Newbie cheater
Reputation: 0

Joined: 15 Mar 2016
Posts: 23

PostPosted: Tue May 07, 2019 10:09 pm    Post subject: Reply with quote

Thank You guys it worked Very Happy
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