wulinnike 发表于 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);


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

vshrd 发表于 2023-8-28 12:45:39

虽然挺想给你解释一下
但如果你没办法真正意义上理解每行代码的意义的话
这段代码你拿着也没啥用
因为你不知道怎么通过改参来适配其他服务器= =

贾维斯117 发表于 2023-8-28 14:16:25

本帖最后由 贾维斯117 于 2023-8-28 02:19 PM 编辑

-- 定义变量以保存之前的鼠标提示文本
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)
拿超级宏运行一次应该就行了,具体怎么用,怎么改,注释看得懂应该就懂了



wulinnike 发表于 2023-8-28 15:49:56

超级宏是什么?求大佬解释一下,谢谢!

懒动行不行 发表于 2023-8-29 17:09:24

WOW本身的宏只允许输入255个字符,但是通过超级宏插件supermacro可以将单个宏的字符数提升至1000个以上,这是一个插件,你可以在各个插件网站上找到他

wulinnike 发表于 2023-8-29 19:59:41

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

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

霸罢坝吧 发表于 2023-8-29 23:07:28

谢谢分享 插眼插眼{:5_243:}
页: [1]
查看完整版本: 这个宏是自动洗属性的宏,好像是根据关键字来判定的