<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[脚本里增加开关选项后无法正常运行]]></title><description><![CDATA[[[topic:post-is-deleted]]]]></description><link>https://www.byteohm.com/topic/48/脚本里增加开关选项后无法正常运行</link><generator>RSS for Node</generator><lastBuildDate>Thu, 19 Nov 2026 06:27:10 GMT</lastBuildDate><atom:link href="https://www.byteohm.com/topic/48.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Nov 2026 12:43:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 脚本里增加开关选项后无法正常运行 on Thu, 05 Nov 2026 14:42:16 GMT]]></title><description><![CDATA[<p dir="auto">没有把键盘插入键鼠助手,程序根本不会走到主要逻辑中,键盘灯判断完全无效</p>
]]></description><link>https://www.byteohm.com/post/62</link><guid isPermaLink="true">https://www.byteohm.com/post/62</guid><dc:creator><![CDATA[byteohm]]></dc:creator><pubDate>Thu, 05 Nov 2026 14:42:16 GMT</pubDate></item><item><title><![CDATA[Reply to 脚本里增加开关选项后无法正常运行 on Thu, 05 Nov 2026 14:40:56 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">@Bitwalker <a href="/post/58">说</a>:</p>
<p dir="auto">没有看到你的脚本内容,可能是CPU完全占满了,建议给你的语句上加个Delay,1ms也好</p>
</blockquote>
<pre><code class="language-lua">while true do
    -- 判断 NumLock 灯是否亮起（大于0通常代表亮起）
    if IsLockKeyOn("numlock") &gt; 0 then
    
        -- 1. 记录本次点击前的精准时间
        local start_time = GetUptime()
    
        -- 2. 使用 MouseClick 统一按压时长，消除极值误差
        MouseClick(1)
    
        -- 3. 生成大跨度目标间隔：内部目标 151 ~ 169（防误差后外部锁定150~170）
        local seed = start_time % 1000000
        seed = (seed * 1103515245 + 12345) % 2147483648
    
        -- 【核心跳跃算法】提取高位，打碎连续接近的规律
        local high_seed = (seed - (seed % 10000)) / 10000
        local target_gap = 151 + (high_seed % 19)
    
        -- 4. 动态补偿循环：精确等待剩余时间，同时吸收鼠标移动导致的卡顿
        while true do
            local elapsed = GetUptime() - start_time
            if elapsed &gt;= target_gap then
                break
            end
        
            local remain = target_gap - elapsed
        
            -- 将剩余时间拆分为多段极短的延时，防止被系统“卡死”
            if remain &gt; 3 then
                Delay(3)
            else
                Delay(remain)
                break
            end
        end
    
    else
        -- NumLock 灯灭时，稍微延迟防止 CPU 空转卡死系统
        Delay(50)
    end
end
</code></pre>
]]></description><link>https://www.byteohm.com/post/59</link><guid isPermaLink="true">https://www.byteohm.com/post/59</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 05 Nov 2026 14:40:56 GMT</pubDate></item></channel></rss>