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 


address Filter for no access

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
etioplmld
Advanced Cheater
Reputation: 0

Joined: 09 Feb 2021
Posts: 72

PostPosted: Sat May 13, 2023 1:23 am    Post subject: address Filter for no access Reply with quote

In the built-in game of Window, it has code access one time per second.In the results containing time address,If you use this code to check, it will step by step select all addresses。address Filter not working。
If setbp (i) is placed outside createTimer(), it will instantly select all addresses


How to make the filter work?

Code:

f = createForm(true)
f.Position=poDesktopCenter
f.Width=500
f.Height=220
f.Caption = 'checkForAccess'

local lb = createLabel(f)
lb.Left=44
lb.Top=30
lb.caption='adress'
lb.Color = 16777215
local font=lb.Font
font.Size = 22
font.Color = 0xff0000

debugProcess()
local fl = getMainForm().Foundlist3
ckAccess = 0

function setbp(i)
debug_setBreakpoint(fl.Items[i-1].Caption, 1, bptAccess, function() ckAccess = 1 end)
  if ckAccess == 0 then
       fl.Items[i-1].Selected = true
    end
debug_removeBreakpoint(fl.Items[i-1].Caption)
end

for i=1,fl.Items.Count do
  createTimer(2000*i,function() lb.caption=fl.Items[i-1].Caption;setbp(i) end )
end



捕获.JPG
 Description:
 Filesize:  18.79 KB
 Viewed:  1078 Time(s)

捕获.JPG


Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sat May 13, 2023 12:02 pm    Post subject: Reply with quote

Here is an example.
https://forum.cheatengine.org/viewtopic.php?p=5685269

Or filter and remove if the address value changes;

( Source: https://forum.cheatengine.org/viewtopic.php?p=5685269 )
Code:
function autoFilterFoundList()
fl = getMainForm().Foundlist3

local input = "currentValue ~= previousValue"
local filter = assert(loadstring("local address, currentValue, previousValue = ...; return " .. input))
results = {}

local miRemove
for i=0, fl.PopupMenu.Items.Count-1 do
  if fl.PopupMenu.Items[i].Name == "Removeselectedaddresses1" then
    miRemove = fl.PopupMenu.Items[i]
    break
  end
end
 for i=0, fl.Items.Count-1 do
   currentValue=fl.Items[i].SubItems[0]
   print(i,currentValue)
   previousValue=fl.Items[i].SubItems[1]
  if currentValue~=previousValue then
    results[#results+1] = i
  end
 end
 for i,k in pairs(results) do

   fl.Items[k].Selected = filter(fl.Items[k].Caption, fl.Items[k].SubItems[0], fl.Items[k].SubItems[1]) == true
   print(i.." - "..fl.Items[k].Caption)
   miRemove.DoClick()
 end
end

if filterTmr then filterTmr.Destroy() filterTmr=nil end
filterTmr=cretaeTimer()
filterTmr.Interval=2000 --2 sec.
filterTmr.OnTimer=autoFilterFoundList
filterTmr.Enabled=true -- filter start .. false = filter stop ..

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
etioplmld
Advanced Cheater
Reputation: 0

Joined: 09 Feb 2021
Posts: 72

PostPosted: Sat May 13, 2023 4:58 pm    Post subject: Reply with quote

no ,No problem with Foundlist3.
Code:

local fl = getMainForm().Foundlist3
print(fl.Items[0].Caption) --address
print(fl.Items[0].SubItems[0]) -- value
print(fl.Items[0].SubItems[1]) -- previous value


fl.Items[i-1].Selected = true work well

Code:

for i=1,fl.Items.Count do
  createTimer(2000*i,function()  )
end


the code seems to mean creating a bunch of timers,Execute each function at i seconds.
so
The access should be checked at the next timer,
but the first one did not need check, while the last one requires a timer to check without debug_setBreakpoint.
If there are too many addresses and timers, CE may crash,Iterative timer will More complex.
Back to top
View user's profile Send private message
etioplmld
Advanced Cheater
Reputation: 0

Joined: 09 Feb 2021
Posts: 72

PostPosted: Wed May 24, 2023 9:49 pm    Post subject: Reply with quote

The first address is the target address, only it has code access.If the this code is executed individually, it selects all addresses. All of ckAccess[i-1] is 0.

Code:

f = createForm(true)
f.Position=poDesktopCenter
f.Width=500
f.Height=220
f.Caption = 'checkForAccess'

local lb = createLabel(f)
lb.Left=44
lb.Top=30
lb.caption='adress'
lb.Color = 16777215
local font=lb.Font
font.Size = 22
font.Color = 0xff0000

debugProcess()
local fl = getMainForm().Foundlist3
ckAccess = {}


function countdown()
  local i = 0
  local t = createTimer()
  t.Interval = 1000
  t.OnTimer = function()

if i>=1 then   -- check previous bp
if i<= fl.Items.Count then
 if ckAccess[i-1] == 0 then
       fl.Items[i-1].Selected = true
       debug_removeBreakpoint(fl.Items[i-1].Caption)

     end
   end
end

if i< fl.Items.Count then  -- set bp
 ckAccess[i] =0
debug_setBreakpoint(fl.Items[i].Caption, 1, bptAccess, function() ckAccess[i] = 1 end)
lb.caption=fl.Items[i].Caption
end

  i = i + 1
if i > fl.Items.Count then
  t.Destroy()
  end
end
end
countdown()


After multiple attempts to confirm, due to some mysterious reason, using the timer in this way will fail
Code:


local cctimer = createTimer()
cctimer.Interval = 1000
i = 0
function countdown()
i=i + 1
print(i)
if i>= 5 then
object_destroy(cctimer)
end
end
cctimer.OnTimer = countdown


function countdown()
  local i = 0
  local t = createTimer()
  t.Interval = 1000
  t.OnTimer = function()
  i = i + 1
  print(i)
if i>=5 then
  t.Destroy()
  end
end
end
countdown()
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