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 


[HELP] speed up / optimize lua aob scan?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
memorasus
Newbie cheater
Reputation: 0

Joined: 27 Sep 2016
Posts: 19

PostPosted: Tue Sep 27, 2016 2:12 pm    Post subject: [HELP] speed up / optimize lua aob scan? Reply with quote

I have a script that I have to run a couple times a game and in the script i'm using the AOBScan function. My issue is, it's very slow, and when it's running the other cheats i have enabled stop working. Is there anyway to optimize it or speed it up?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Tue Sep 27, 2016 2:19 pm    Post subject: Reply with quote

run them in a separate thread

Code:

function threadedAOBScan(t)
  local r=AOBScan(YOURAOB)
  --do something with the results

  r.destroy()
end

createNativeThread(threadedAOBScan)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
memorasus
Newbie cheater
Reputation: 0

Joined: 27 Sep 2016
Posts: 19

PostPosted: Tue Sep 27, 2016 2:28 pm    Post subject: Reply with quote

You're a genius. Thank you
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Mon May 10, 2021 5:33 pm    Post subject: Reply with quote

Dark Byte wrote:
run them in a separate thread

Code:

function threadedAOBScan(t)
  local r=AOBScan(YOURAOB)
  --do something with the results

  r.destroy()
end

createNativeThread(threadedAOBScan)


DB, is it possible for you to fill in the "--do something with the results" section of this code uniquely for you?
Many of the examples I use have a "for" loop and it slows down the code too much.
When you find the "AobScan" code, is there a chance to change it one-to-one without entering a for loop?
Note: There will be between 40 and 2000 results in the scan.]
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon May 10, 2021 5:55 pm    Post subject: Reply with quote

ByTransient wrote:
Dark Byte wrote:
run them in a separate thread

Code:

function threadedAOBScan(t)
  local r=AOBScan(YOURAOB)
  --do something with the results

  r.destroy()
end

createNativeThread(threadedAOBScan)


DB, is it possible for you to fill in the "--do something with the results" section of this code uniquely for you?
Many of the examples I use have a "for" loop and it slows down the code too much.
When you find the "AobScan" code, is there a chance to change it one-to-one without entering a for loop?
Note: There will be between 40 and 2000 results in the scan.]


Try unique AOB patterns. Or if you know it's always the same index you can use that.
Code:

result = AOBScan(strSignature, aobSignaturePrivileges)
if result == nil then
   local msg = string.format('AOB pattern not found: "%s"', strSignature)
   error(msg)
elseif result.Count >= 1 then
   local aobAddr = result[index]
   result.destroy()
   if type(aobAddr) == 'string' then
      aobAddr = tonumber(aobAddr, 16)
   end
   return aobAddr
end

_________________
Back to top
View user's profile Send private message Visit poster's website
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Mon May 10, 2021 6:19 pm    Post subject: Reply with quote

TheyCallMeTim13 wrote:


I could not see the replacement section in the code.
No problem traumatizing, is there anything to change without the "for" loop?

Aob is not unique, it finds between 40-2000 scans.
This is the results listed up to 2000 of different versions of the same type of item in the game.

Thanks for the answer. It will enable to broaden the subject ..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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