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 Memo

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
nebusk
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 07 Jun 2019
Posts: 10

PostPosted: Wed Mar 18, 2020 9:57 pm    Post subject: Lua Script to Memo Reply with quote

i have a aob lua script so basically when i execute the script, it would show the list of items my aob finds on the lua engine.

i was wondering instead of it showing on lua engine is there a way to like get the list my aob finds on my memo form?


Last edited by nebusk on Thu Mar 19, 2020 2:40 am; edited 1 time in total
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Mar 18, 2020 11:48 pm    Post subject: Reply with quote

First, this topic should be on the Cheat Engine Lua Scripting subforum.
But whatever, this is an example:

Code:
--------------------------------------------- Create form and components
myform = createForm()
myform.setSize(560,240)
myform.Position = 'poScreenCenter'
myform.BorderStyle = 'bsSingle'
myform.Caption = 'My AOB Result'

button1 = createButton(myform)
button1.setSize(116,25)
button1.setPosition(15,10)
button1.Caption = 'Get Result'

edit1 = createEdit(myform)
edit1.setPosition(140,10)
edit1.setSize(405,25)

memo1 = createMemo(myform)
memo1.setSize(532,180)
memo1.setPosition(15,45)
memo1.ScrollBars = 'ssAutoBoth'

----------------------------------------------- Functions and variables
function getByteString(address, bytecount)
 local bytes = readBytes(address, bytecount, true)
 if bytes then
 local result = ""
 for i = 1, #bytes do
 if #result > 0 then result = result .. " " end
 result = result .. string.format("%02X", bytes[i]) end
 return result end
end

function aobResult(aobStr)
 res = AOBScan(aobStr)
 j = 0
 cnt = 1
 if (res~=nil) then
 print("Results found: "..res.Count)
 while j < res.Count do
 a = getByteString(res[j], 12)
 memo1.append("Address "..cnt.." = "..res[j].." --> AOB :  "..a)
 j=j+1
 cnt = cnt+1
 end
 res.destroy()
 res=nil
 else
 showMessage("No results found or no process opened")
 return
 end
end

function button1_click()
 aobs = edit1.Text
 if aobs == "" or aobs == nil then showMessage("No AOBs to be search!") return end
 memo1.clear()
 aobResult(aobs)
end

function clearance()
 closeCE()
 return caFree
end

----------------------------------------------- Events handler
myform.show()
button1.OnClick = button1_click
myform.OnClose = clearance

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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 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