Hello.
Yes, there are some ways to detect that... However, that depends on the server you are playing and how do you plan to count.
You can find all LUA functions below on this thread:
|Only Registered members can see download links. | Click here to buy subscription or here to register.
1. You can count visible items using itemcount() and/or fluidcount() functions. getcontainers() and getcontainer() could be used to do the same.
itemcount(string/number item, optional string location name, optional boolean countEquipments) [number]: Represent the amount of defined items found on opened containers.
fluidcount(string/number item, optional string location name, optional boolean countEquipments, optional string/number liquidContainer)[number]: Represent the amount of defined items found on opened containers in a VIAL (or specified liquid container). This is only useful when the server you are playing uses mana fluids or so in a VIAL like in Tibia 7.4. If the server you are playing uses mana potion, stackable mana fluid, etc. then don't use this function!
getcontainers()[table]: Get all open containers.
getcontainer(string/number container)[table]: Table of container structure (index or name).
.id [number]
.index [number]
.maxslots [number]
.name [string]
.open [string]
.usedslots [number]
.items [table]
.id [number]: Item ID.
.count [number]: Item amount.
.index [number]: Item index in backpack.
2. If the server you play allows to use item on game-client hotkeys then you could use screenmessage() and itemcountmsg() to count according the "Using one of ..." message.
screenmessage(optional bool visibleOnly = true, optional string type = 'any') [string]: Returns the last green message that appeared to you. The optional parameter bool visible, true by default, if true will only return if the message is currently visible.
itemcountmsg(string item, string message) [number]: Returns the amount of items from a using on message. E.g.: itemcountmsg('vial', 'Using one of 2 vials...') will return value 2. itemcountmsg('vial', 'Using the last vial...') will return value 1.
getmessages() [table]: Get the last messages on the current active channel.
getnewmessages() [table]: Get the news received messages on the current active channel.
.time [string]
.sender [string]
.content [string]
.fullcontent [string]
3. You can use gethudsupply() or getsupplyitems() to get used supplies count that are on Healer and Targeting.
gethudsupply(string/number item) [number]: Returns the amount of items useds of a specific item.
getsupplyitems()[table]: Returns a table with each item that Healer has used.
.itemid [number]
.itemname [string]
.id [number]
resethudsupply() [void]: Reset supplies.
4. Finally, there are many scripts that already does something like that
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.