View previous topic :: View next topic |
Author |
Message |
agauo How do I cheat? Reputation: 0
Joined: 07 Dec 2016 Posts: 6
|
Posted: Wed Dec 07, 2016 12:04 pm Post subject: searching for an array of AOBs using for loop |
|
|
Attempting to search for multiple AOBs within a program and if any of them are present I'd like it to sound an alarm. I don't care about which address they are at, how many exists, etc. I'd like it to check once every 30 seconds or so.
Code: |
atimer = createTimer(nil,false)
atimer.Interval = 30000
atimer.Enabled = true
local checkabc
searches = {'41 00 63 00 74 00 69 00 76 00 65 76', '41 00 63 00 74 00 69 00 76 00 65 74', '41 00 63 00 74 00 69 00 76 00 65 41', '41 00 63 00 74 00 69 00 76 00 55'}
atimer.OnTimer = function(checkabc)
for i, name in ipairs(searches) do
checkabc=AOBScan(name)
end
end
if (checkabc~=nil) then
print(name)
playSound(findTableFile('alert.wav'))
end |
Thanks for any and all help!
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Wed Dec 07, 2016 1:18 pm Post subject: |
|
|
Code: |
local timer = createTimer()
timer.Interval = 30000
timer.OnTimer = function(tm)
for i,aob in ipairs(searches) do
if autoAssemble("aobscan(dummy,"..aob..")") then
-- use AA aobscan so stop scan when one result found,
-- it is the same as Lua aobScan in not found case.
tm.Destroy() -- found, so no more timer action
-- do notify found
print(aob)
playSound(findTableFile('alert.wav'))
-- do end
break --- forget this... break the for loop, no more scan
end
end
end
|
_________________
- Retarded. |
|
Back to top |
|
|
agauo How do I cheat? Reputation: 0
Joined: 07 Dec 2016 Posts: 6
|
Posted: Wed Dec 07, 2016 5:40 pm Post subject: |
|
|
Thanks, working great.
Can anyone explain what this
if autoAssemble("aobscan(dummy,"..aob..")") then
is doing?
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Wed Dec 07, 2016 8:06 pm Post subject: |
|
|
autoAssemble is a Lua function to execute AA script as an input text string, if the script run successfully, it return true else false. check https://raw.githubusercontent.com/cheat-engine/cheat-engine/master/Cheat%20Engine/bin/main.lua
AA has its own version AOBScan that only found 1 result, while Lua version AOBScan will scan for all memory and return all results, but in case there is no result, they will scan all memory anyway.
For your purpose which don't need the actual found address, they are almost the same, except Lua version may need some clean up.
_________________
- Retarded. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Thu Dec 08, 2016 2:48 am Post subject: |
|
|
you can also use threads. give every aob it's own thread and call the aa's auto assembler in them every 30 seconds. when one of them returns true use synchronize() to do things on the GUI side/thread
_________________
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 |
|
|
agauo How do I cheat? Reputation: 0
Joined: 07 Dec 2016 Posts: 6
|
Posted: Fri Dec 16, 2016 7:11 pm Post subject: |
|
|
Ok this is working great, but I am now trying to see how I can run this continuously, but only play the sound once every time it finds one of these AOBs then not play again until none are found and then one is found again. Here is what I got
Code: | OpenProcess("test.exe")
atimer = createTimer()
atimer.Interval = 40000
a = 0
searches = {'41 00 63 00 74 00 69 00 76 00 65 76', '41 00 63 00 74 00 69 00 76 00 65 74', '41 00 63 00 74 00 69 00 76 00 65 41', '41 00 63 00 74 00 69 00 76 00 55'}
atimer.OnTimer = function(checkabc)
for i, aob in ipairs(searches) do
if autoAssemble("aobscan(dummy,"..aob..")") and a == 0 then
print(aob)
playSound(findTableFile('alert.wav'))
f = io.open("C:\\Users\\xxxx\\aaa.txt","a+");
f:close();
a = 1
end
else
a = 0
end
end |
Does this make sense? I want it to set a = 1 if it finds an AOB, then if it does not find one it sets a back to 0.
Thanks again for any and all help!
|
|
Back to top |
|
|
agauo How do I cheat? Reputation: 0
Joined: 07 Dec 2016 Posts: 6
|
Posted: Mon Dec 19, 2016 10:55 pm Post subject: |
|
|
Do I have my else in the wrong spot?
|
|
Back to top |
|
|
agauo How do I cheat? Reputation: 0
Joined: 07 Dec 2016 Posts: 6
|
Posted: Fri Dec 23, 2016 2:34 pm Post subject: |
|
|
Anyone can help me with this?
|
|
Back to top |
|
|
agauo How do I cheat? Reputation: 0
Joined: 07 Dec 2016 Posts: 6
|
Posted: Tue Dec 27, 2016 11:24 am Post subject: |
|
|
Is what I am trying to accomplish possible?
|
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Tue Dec 27, 2016 4:54 pm Post subject: |
|
|
I would recommend using threads (otherwise C.E would freeze once a while) to do this.
And since your pattern is pretty much the same
Code: | 41 00 63 00 74 00 69 00 76 00 XX XX |
It would be much ideal just to do a single aob scan, get all results and check if the last 2 bytes match to your pattern(s).
I just don't find AutoAssemble suitable in this case.
Code: | OpenProcess("test.exe")
atimer = createTimer()
atimer.Interval = 40000
searches = {'41 00 63 00 74 00 69 00 76 00 65 76', '41 00 63 00 74 00 69 00 76 00 65 74', '41 00 63 00 74 00 69 00 76 00 65 41', '41 00 63 00 74 00 69 00 76 00 55'}
function Alert()
-- do your alert stuff
playSound(findTableFile('alert.wav'));
-- f = io.open("C:\\Users\\xxxx\\aaa.txt","a+");
-- f:close();
end
local status = 0; -- 0 - play sound when found, 1 - play sound when not found.
atimer.OnTimer = function(caller)
local shouldplay = false;
for k,aob in pairs(searches) do
if (autoAssemble("aobscan(dummy,"..aob..")")) then
shouldplay = true;
break; -- break from the loop because we care only if one of these aobs is found
end
end
-- we finished the loop now we can play sound or not
if (shouldplay) then -- if aob was found
if (status == 0) then -- our flag of alert
status = 1;
Alert();
end
elseif (not shouldplay and status == 1) then -- nothing was found & aob was previously found and played alert
Alert();
status = 0; -- reset the flag so we could alert again once it finds
end
end |
_________________
|
|
Back to top |
|
|
|