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 


How to get multiple addresses?

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

Joined: 02 Sep 2022
Posts: 3

PostPosted: Fri Sep 02, 2022 11:00 pm    Post subject: How to get multiple addresses? Reply with quote

[/code]
x=
function MyAobScan(Bytes)
local StartAddress=0;
local EndAddress=0x00007fffffffffff;
local Scan = createMemScan();
Scan.OnlyOneResult=true;
Scan.firstScan(soExactValue, vtByteArray, rtTruncated, Bytes, "", StartAddress, EndAddress, "", fsmNotAligned, "", true, false, false, false);
Scan.waitTillDone();
return Scan.getOnlyResult();
end

print(MyAobScan(x))

--this only can get one address
--i want to get multiple addresses through code like this
--

local found_list = getCurrentMemscan()
local addr_count = found_list.foundList:getCount()
for i = 0,addr_count - 1 do
local found_addr = getAddress(found_list.foundList:GetAddress(i))
print(found_addr)
end


[/code]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Sep 03, 2022 3:49 am    Post subject: Reply with quote

remove
Code:

Scan.OnlyOneResult=true


and
Code:

return Scan.getOnlyResult();


and then instead of using getCurrentMemscan use Scan

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

Joined: 02 Sep 2022
Posts: 3

PostPosted: Sat Sep 03, 2022 6:01 am    Post subject: Reply with quote

Dark Byte wrote:
remove
Code:

Scan.OnlyOneResult=true


and
Code:

return Scan.getOnlyResult();


and then instead of using getCurrentMemscan use Scan


emmmm....
I tried.but print does not output any results,and pop-up ”attempt to call a nil value (global 'Scan')“.
then I deleted the print function, but the same error still popped up.
Back to top
View user's profile Send private message
len1
How do I cheat?
Reputation: 0

Joined: 02 Sep 2022
Posts: 3

PostPosted: Sun Sep 04, 2022 8:13 am    Post subject: Reply with quote

Dark Byte wrote:
remove
Code:

Scan.OnlyOneResult=true


and
Code:

return Scan.getOnlyResult();


and then instead of using getCurrentMemscan use Scan


Thanks for you answer.I have found a solution.

Code:
function MyAobScan(Bytes)
memscan = createMemScan();
foundlist = createFoundList(memscan)
memscan.firstScan(soExactValue, vtByteArray, rtTruncated, Bytes, nil, 0, 0x00007fffffffffff, "", fsmNotAligned, "", true, false, false, false);
memscan.waitTillDone();
foundlist.initialize()
 for i=0, foundlist.Count-1 do
getAddress(foundlist.Address[i])

print(foundlist.Address[i])

end
end
Back to top
View user's profile Send private message
Y.A.K.E
Advanced Cheater
Reputation: 0

Joined: 15 Jul 2019
Posts: 51

PostPosted: Mon Sep 05, 2022 2:54 am    Post subject: Reply with quote

Code:

-- author:panraven
-- https://forum.cheatengine.org/viewtopic.php?t=606262

function aobscanex( aob, p, a, n, s, e, pb )
  local p, a, n, s, e = p or '*X*W', a or fsmNotAligned, n or '0', s or 0x0, e or 0xffffffffffffffff
  local ms = pb and createMemScan( pb ) or createMemScan()
  local fl = createFoundList( ms )
  ms.firstScan( soExactValue, vtByteArray, nil, aob, nil, s, e, p, a, n, true, false, false, false )
  ms.waitTillDone()
  fl.initialize()
  local result = nil
  if fl ~= nil and fl.getCount() > 0 then
    result = createStringlist()
    for i = 1, fl.getCount() do result.add( fl.getAddress( i - 1 ) ) end
  end
  fl.destroy()
  ms.destroy()
  return result
end



use:


Code:


local aob_str = '8B C? FF 5? * 8B'
local rList = aobscanex( aob_str, nil, nil, nil, getAddress( 'Game.GAME::LootItemTableRandomizer::LoadFromDatabase+A ' ), getAddress('Game.GAME::LootItemTableRandomizer::LoadFromDatabase+178 ' ) )

if rList.Count == 0 then
  error ('error.')
  return "assert (true)"
end

for i = 0,rList.Count-1 do
  local aob_addr = rList[i]
  print(aob_addr)
end

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