背景:使用非战斗宠物道具时,屏幕中间提示:“你已经学会Xxx了。”
当触发这个条件时候,删除此道具。代码片段如下:[Lua] 纯文本查看 复制代码 for i=0,1 do
for j =1,72 do
if GetContainerItemLink(i,j) ~= nil
then
--[[itemName = GetItemInfo(GetContainerItemLink(i,j))
BeeRun("/use "..itemName)--]]
local function use(frame,event,...)
if event == "UI_ERROR_MESSAGE" then
local str1 = string.sub(...,1,15)
if str1 == "你已经学会" then
-- 左键点击物品
PickupContainerItem(i,j)
-- 执行销毁
DeleteCursorItem()
end
end
end
end
end
end
local F = CreateFrame("Frame")
F:RegisterEvent("UI_ERROR_MESSAGE")
F:SetScript("OnEvent",use) 没有达到预期效果。请问问题出现在哪里。新手小白求助。
|