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 


Delete addresses in search results without accessed

 
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: 87

PostPosted: Mon Sep 28, 2026 9:12 am    Post subject: Delete addresses in search results without accessed Reply with quote

AI programming has become more powerful this year. With this tool, the code it gives in the web version is almost successful on the first try, with no errors; in the end, only some detail and window adjustments are needed. It is also familiar with all CE functions.if people ask AI before asking a question, and then share the answers AI gives. This can make modifying games easier.


Code:

f = createForm(true)
f.Position = poDesktopCenter
f.Width = 760
f.Height = 300
f.Caption = 'checkForAccess'


-- 当前检查地址
local lbAddress = createLabel(f)
lbAddress.Left = 40
lbAddress.Top = 35
lbAddress.Width = 680
lbAddress.Height = 45
lbAddress.Caption = '准备开始...'

local fontAddress = lbAddress.Font
fontAddress.Size = 22
fontAddress.Color = 0xff0000


-- 进度文字
local lbProgress = createLabel(f)
lbProgress.Left = 40
lbProgress.Top = 100
lbProgress.Width = 680
lbProgress.Height = 30
lbProgress.Caption = '进度:0 / 0'

local fontProgress = lbProgress.Font
fontProgress.Size = 16


-- 进度条
local progress = createProgressBar(f)
progress.Left = 40
progress.Top = 140
progress.Width = 680
progress.Height = 30
progress.Min = 0
progress.Max = 1
progress.Position = 0


-- 状态
local lbStatus = createLabel(f)
lbStatus.Left = 40
lbStatus.Top = 195
lbStatus.Width = 680
lbStatus.Height = 30
lbStatus.Caption = '状态:准备开始'

local fontStatus = lbStatus.Font
fontStatus.Size = 14


--------------------------------------------------
-- 检查调试器是否已经附加
--------------------------------------------------

if not debug_isDebugging() then
    debugProcess()
end


--------------------------------------------------
-- FoundList
--------------------------------------------------

local fl = getMainForm().Foundlist3

local total = fl.Items.Count
local checkedCount = 0


-- 清除 FoundList 原来的选择
for i = 0, total - 1 do
    fl.Items[i].Selected = false
end


--------------------------------------------------
-- 找到右键菜单里的 Remove selected addresses
--------------------------------------------------

local function getRemoveMenuItem(fl)

    local pm = fl.PopupMenu

    for i = 0, pm.Items.Count - 1 do

        if pm.Items[i].Name == 'Removeselectedaddresses1' then
            return pm.Items[i]
        end

    end

    return nil
end


local miRemove = getRemoveMenuItem(fl)

assert(
    miRemove,
    'Remove selected addresses menu item not found'
)


--------------------------------------------------
-- 更新进度
--------------------------------------------------

local function updateProgress()

    progress.Max = total
    progress.Position = checkedCount

    local percent = 0

    if total > 0 then
        percent = math.floor(checkedCount * 100 / total)
    end

    lbProgress.Caption =
        string.format(
            '进度:%d / %d    (%d%%)',
            checkedCount,
            total,
            percent
        )
end


--------------------------------------------------
-- 逐个检查地址
--------------------------------------------------

local function checkAddress(i)

    -- 全部检查完成
    if i >= total then

        lbAddress.Caption = '检查完成'
        lbStatus.Caption = '状态:正在删除未访问地址...'

        -- 删除所有没访问、已经被选中的地址
        miRemove.DoClick()

        lbStatus.Caption = '状态:完成'

        lbProgress.Caption =
            string.format(
                '进度:%d / %d    (100%%)',
                checkedCount,
                total
            )

        return
    end


    local address = fl.Items[i].Caption
    local accessed = false


    -- 显示当前地址
    lbAddress.Caption = address
    lbStatus.Caption = '状态:检查中...'

    updateProgress()


    --------------------------------------------------
    -- 设置 Access Breakpoint
    --------------------------------------------------

    debug_setBreakpoint(
        address,
        1,
        bptAccess,

        function()

            accessed = true

            -- 继续运行目标程序
            debug_continueFromBreakpoint(co_run)

            return 0

        end
    )


    --------------------------------------------------
    -- 等待 1000毫秒
    --------------------------------------------------

    createTimer(500, function()

        -- 1秒内没有访问
        if not accessed then
            fl.Items[i].Selected = true
        end


        -- 删除当前地址的 BP
        debug_removeBreakpoint(address)


        -- 完成数量 +1
        checkedCount = checkedCount + 1

        updateProgress()


        -- 检查下一个
        checkAddress(i + 1)

    end)

end


--------------------------------------------------
-- 开始
--------------------------------------------------

if total == 0 then

    lbAddress.Caption = '没有搜索结果'
    lbProgress.Caption = '进度:0 / 0'
    lbStatus.Caption = '状态:没有可检查的地址'

else

    updateProgress()
    checkAddress(0)

end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

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

PostPosted: Mon Sep 28, 2026 2:40 pm    Post subject: Reply with quote

It's good to see it's improving. But I see it still makes the mistake of not taking into account the DPI.

Code:

local dpiscale=getScreenDPI() / 96

and multiply every pixel specific value with this value

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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