求助:提取提醒关键字来删除物品问题
背景:使用非战斗宠物道具时,屏幕中间提示:“你已经学会Xxx了。”当触发这个条件时候,删除此道具。代码片段如下: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)没有达到预期效果。请问问题出现在哪里。新手小白求助。
你用的str==而不是strfind
或许你可以先把回调信息给打印出来看看是个啥
再进行字符串对比
页:
[1]