Bee关于物品使用次数的判定函数
在编写FS脚本时想新增一个项功能,就是在脱战之后判定“法力青玉”是否为3次使用,如果不是3次,就自动使用“制造法力宝石”;但目前所知道的函数GetItemCount和IsEquippableItem都只能判定是否有“法力青玉”,不能判定次数是否是3次;
请问各位大佬是否知道判定物品使用次数的函数;
GetItemCount(ID或物品名字) lk47354813 发表于 2023-6-29 02:15 PM
GetItemCount(ID或物品名字)
“法力青玉”能用3次,我想实现一次战斗之后次数少于3次(2次 or 1次)也能自动重新做一个,用GetItemCount无法实现 用宏把不足3次的摧毁再做不就行了吗 lk47354813 发表于 2023-6-29 03:46 PM
用宏把不足3次的摧毁再做不就行了吗
现在就是没办法判定使用次数是否为3次,如果不论使用次数,又会陷入摧毁、制造、摧毁的循环里 {:5_240:}{:5_240:}{:5_240:}没有哪位大神帮忙一下嘛,FS脚本就快完成了 itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType,
itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType,
expacID, setID, isCraftingReagent
= GetItemInfo(item)
itemStackCount:堆栈计数,行不行? hushuai 发表于 2023-7-7 09:32 AM
itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType,
itemStackCount, it ...
谢谢大神,一会测试一下,希望有用{:5_168:}{:5_168:} 本帖最后由 懒动行不行 于 2023-7-11 11:16 AM 编辑
使用这个函数
GetItemCount
count = GetItemCount(itemInfo [, includeBank, includeUses, includeReagentBank])
返回库存物品的数量(或者可用的使用次数)。
参数
itemInfo
数字或字符串型- 物品的ID, 链接 或名称
includeBank
布尔型? -是否为真, 包括存放在银行中
includeUses
布尔型? - 是否为真, 包括物品的每次使用,类似于 GetActionCount()
includeReagentBank
布尔型? - 是否为真, 包括试剂银行
返回值
count数字型 - 您拥有的物品数量,或使用次数(includeUses为真且有使用次数)。
示例
local count = GetItemCount(29434)
print("Badge of Justice:", count)
local count = GetItemCount(33312, nil, true)
print("Mana Saphire Charges:", count)
local clothInBags = GetItemCount("Netherweave Cloth")
local clothInTotal = GetItemCount("Netherweave Cloth", true)
print("Netherweave Cloth:", clothInBags, "(bags)", (clothInTotal - clothInBags), "(bank)")
补丁更新
Patch 7.2.0 (2017-03-28): Added includeReagentBank optional argument.
Patch 2.3.0 (2007-11-13): Added includeUses optional argument.
Patch 2.0.1 (2006-12-05): Added.参考文献
[*]^ 2017-03-28,MerchantFrame.lua, version 7.2.0.23835, near line 578, archived at Townlong-Yak
[*]^ Iriel 2007-08-27. Upcoming 2.3 Changes - Concise List. BlueTracker. Archived from the original
[*]^ slouken 2006-10-11. Re: 2.0.0 Changes - Concise List. Archived from the original
因此针对楼主的需求,下面是一个示例,可以根据实际情况增加判断条件,以更好的满足实际需求
function DelPoor(itemID)
for bag = 0,4,1 do
for slot = 1, GetContainerNumSlots(bag), 1 do
local name = GetContainerItemLink(bag,slot)
local desname = (select(2,GetItemInfo(itemID)))
if name == desname then
PickupContainerItem(bag,slot)
DeleteCursorItem(bag,slot)
end
end
end
end
local n=GetItemCount("法力青玉",nil,true)
if not BeeUnitAffectingCombat("player") and n<3 then DelPoor("法力青玉");BeeRun("制造法力青玉") end
这里面用到了玄月无尘大佬的摧毁物品函数,法力青玉和制造法力青玉名称我没有确认过,需要你根据实际的名称修改,有问题可以再反馈讨论。
懒动行不行 发表于 2023-7-11 11:01 AM
使用这个函数
GetItemCount
大神,请收下小弟的膝盖{:5_250:}{:5_250:}
页:
[1]