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 


Get number of results for a string search using LUA

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Lemchast
How do I cheat?
Reputation: 0

Joined: 11 Jun 2019
Posts: 6

PostPosted: Tue Jun 11, 2019 10:46 pm    Post subject: Get number of results for a string search using LUA Reply with quote

I have .txt file containing search strings, each separated by a new line. I would like to write a LUA script that reads one line at a time from the .txt file.

For each line that is read, a String memory scan should be performed on the opened process in Cheat Engine (in my case, BlueStacks).

The number of results for that scan should then be printed to the console. This should repeat with new scans for each search string in the .txt file until the end is reached.

I would greatly appreciate any help on this matter. Thanks very much!
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Jun 11, 2019 11:17 pm    Post subject: Reply with quote

Yeah, I am waiting for someone to make the function/tool for these. Then what I need just to copy paste the function script or tool if any. Cool
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Jun 12, 2019 12:20 am    Post subject: Reply with quote

something like this:
Code:

s=createStringlist()
s.LoadFromFile([[d:\bla.txt]])
local protectionflags='' --change this to the kind you need. empty string is everything *X*C*W
local casesensitive=true

local ms=createMemScan()
local fl=createFoundList(ms)

local i
for i=0,s.count-1 do
  ms.firstScan(soExactValue, vtString,nil,s[i],'',0,0x7fffffffffffffff,protectionflags,fsmNotAligned,'1',false,true,false,casesensitive)
  ms.waitTillDone()

  fl.initialize()
  print(s[i]..'='..fl.count)
  fl.deinitialize()
end

fl.destroy()
ms.destroy()
s.destroy()


use threads if you don't want the gui to freeze, or start multiple scans at the same time by moving the waitTillDone() out of the loop and create a new memscan for each string, or use the OnScanDone event of the memscan objects

_________________
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
Lemchast
How do I cheat?
Reputation: 0

Joined: 11 Jun 2019
Posts: 6

PostPosted: Fri Jun 14, 2019 1:51 am    Post subject: Reply with quote

Dark Byte wrote:
something like this:
Code:

s=createStringlist()
s.LoadFromFile([[d:\bla.txt]])
local protectionflags='' --change this to the kind you need. empty string is everything *X*C*W
local casesensitive=true

local ms=createMemScan()
local fl=createFoundList(ms)

local i
for i=0,s.count-1 do
  ms.firstScan(soExactValue, vtString,nil,s[i],'',0,0x7fffffffffffffff,protectionflags,fsmNotAligned,'1',false,true,false,casesensitive)
  ms.waitTillDone()

  fl.initialize()
  print(s[i]..'='..fl.count)
  fl.deinitialize()
end

fl.destroy()
ms.destroy()
s.destroy()


use threads if you don't want the gui to freeze, or start multiple scans at the same time by moving the waitTillDone() out of the loop and create a new memscan for each string, or use the OnScanDone event of the memscan objects


Much appreciated, Dark Byte! That's exactly what I was looking for. Many thanks! 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