|
--只删除白色/绿色
-- 逆序遍历背包
for bag = 4, 0, -1 do
-- 逆序遍历每个背包槽位
for slot = 40, 1, -1 do
-- 获取槽位上物品的名称
local name = GetContainerItemLink(bag, slot)
-- 如果物品存在
if name then
-- 判断物品名称是否包含关键字
local keywords = {"结构图", "图样", "公式", "设计图", "配方", "食谱", "矮人奶酪", "次级法力药水", "治疗药水", "果汁", "卡德加的胡须", "食谱"}
local containsKeyword = false
for _, keyword in ipairs(keywords) do
if string.find(name, keyword) then
containsKeyword = true
break
end
end
-- 如果物品包含关键字并且符合品质条件
if containsKeyword and (name:sub(5, 10) == "1eff00" or name:sub(5, 10) == "0070dd" or name:sub(5, 10) == "ffffff") then
-- 输出要删除的物品信息
print("Deleting: " .. name)
-- 删除物品
PickupContainerItem(bag, slot)
-- 删除光标上的物品
DeleteCursorItem()
end
end
end
end
这是在论天里面扒拉的代码。 我应该如何修改才能删除指定的 其他颜色的物品
|
|