LUACN论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
热搜: YJWOW MagicStone BoL
查看: 330|回复: 6

[综合] 这个宏是自动洗属性的宏,好像是根据关键字来判定的

[复制链接]
发表于 2023-8-28 10:42:18 | 显示全部楼层 |阅读模式
/run local previousText = ""; local usedResetItem = false; local function PrintTooltipChanges() local item = GameTooltip:GetItem(); local currentText = ""; for i = 1, GameTooltip:NumLines() do local lineText = _G["GameTooltipTextLeft"..i]:GetText(); currentText = currentText .. lineText; end if currentText ~= previousText then print(currentText); previousText = currentText; local foundText = false; local _, _, str = string.find(currentText, "+(%d+) 急速等级"); if not str or tonumber(str) < 100 then local _, _, spellpower = string.find(currentText, "+(%d+)%% 法术强度"); local _, _, stamina = string.find(currentText, "+(%d+)%% 耐力"); if not spellpower and not stamina then if not usedResetItem then usedResetItem = true; RunMacroText("/use item:60012"); RunMacroText("/use 0 1"); end end end end end GameTooltip:HookScript("OnTooltipSetItem", PrintTooltipChanges);


但是写在游戏里好像没法全部都复制进去,求高手看看如何使用,最好能告诉哪些可以自己添加,谢谢!
回复

使用道具 举报

发表于 2023-8-28 12:45:39 | 显示全部楼层
虽然挺想给你解释一下
但如果你没办法真正意义上理解每行代码的意义的话
这段代码你拿着也没啥用
因为你不知道怎么通过改参来适配其他服务器= =
回复 支持 反对

使用道具 举报

发表于 2023-8-28 14:16:25 | 显示全部楼层
本帖最后由 贾维斯117 于 2023-8-28 02:19 PM 编辑

[Lua] 纯文本查看 复制代码
-- 定义变量以保存之前的鼠标提示文本
local previousText = ""
-- 用于标记是否使用了重置物品
local usedResetItem = false

-- 定义打印鼠标提示变化的函数
local function PrintTooltipChanges()
    -- 获取当前鼠标提示的物品信息
    local item = GameTooltip:GetItem()
    local currentText = ""
    
    -- 遍历每一行的文本,将所有行的文本拼接起来
    for i = 1, GameTooltip:NumLines() do
        local lineText = _G["GameTooltipTextLeft"..i]:GetText()
        currentText = currentText .. lineText
    end
    
    -- 如果当前的文本不同于之前的文本,则进行处理
    if currentText ~= previousText then
        print(currentText) -- 打印当前文本
        
        -- 更新之前的文本
        previousText = currentText
        
        -- 检查是否存在特定的属性变化
        local foundText = false
        local _, _, str = string.find(currentText, "+(%d+) 急速等级")
        
        -- 如果没有急速等级属性或急速等级小于 100
        if not str or tonumber(str) < 100 then
            -- 检查是否存在法术强度和耐力属性
            local _, _, spellpower = string.find(currentText, "+(%d+)%% 法术强度")
            local _, _, stamina = string.find(currentText, "+(%d+)%% 耐力")
            
            -- 如果没有法术强度和耐力属性
            if not spellpower and not stamina then
                -- 如果没有使用过重置物品,则尝试使用
                if not usedResetItem then
                    usedResetItem = true
                    -- 使用重置物品
                    RunMacroText("/use item:60012")
                    RunMacroText("/use 0 1")
                end
            end
        end
    end
end

-- 钩子函数,在显示物品鼠标提示时调用打印函数
GameTooltip:HookScript("OnTooltipSetItem", PrintTooltipChanges)

拿超级宏运行一次应该就行了,具体怎么用,怎么改,注释看得懂应该就懂了



回复 支持 反对

使用道具 举报

 楼主| 发表于 2023-8-28 15:49:56 | 显示全部楼层
超级宏是什么?求大佬解释一下,谢谢!
回复 支持 反对

使用道具 举报

发表于 2023-8-29 17:09:24 | 显示全部楼层
WOW本身的宏只允许输入255个字符,但是通过超级宏插件supermacro可以将单个宏的字符数提升至1000个以上,这是一个插件,你可以在各个插件网站上找到他
回复 支持 反对

使用道具 举报

 楼主| 发表于 2023-8-29 19:59:41 | 显示全部楼层
懒动行不行 发表于 2023-8-29 05:09 PM
WOW本身的宏只允许输入255个字符,但是通过超级宏插件supermacro可以将单个宏的字符数提升至1000个以上,这 ...

已经下载好那个插件了,但是好像不知道怎么用,不知道能不能指导一下?
回复 支持 反对

使用道具 举报

发表于 2023-8-29 23:07:28 | 显示全部楼层
谢谢分享 插眼插眼
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

小黑屋|手机版|Archiver|LUACN论坛

GMT+8, 2024-5-29 02:04 AM , Processed in 0.049324 second(s), 25 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表