Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Supply Checker & Alarm
#1
Lightbulb 
Hello,


I'm looking for script which one is gonna check

If  enchanted spears in my hand less then 5, or mana fluid less than 50, or UH less then 40  then play alarm.

Can somebody fix it for me?
Reply

#2
Hello.

1. itemcount to count visible items (items on currently open containers)
If you wanna know the EXACTLY COUNT using itemcount then you must have all backpacks open. It's the most accurate method.
However, if you just wanna check when UHs are going out then you just need to leave the last bp open. For example: You have 3 BPs of UH then leave the last bp open, so the function will check for this bp. Once you start to use the last bp of uhs, you will be able to know because the uhs on that bp will be gone.

itemcount(string/number item, optional string location name, optional boolean countEquipments) [number]: Represent the amount of defined items found on opened containers.

|Only Registered members can see download links. | Click here to buy subscription or here to register.




2. screenmessage() and itemcountmsg() to count from the last green message that shows up when you use a hotkey.
This method works based on messages green messages that shows in the middle of your screen when using an item by hotkeys.
screenmessage() [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.
Notice if you use itemcountmsg() with an item but the message is talking about another item OR message is invalid (not related to items) then it will return -1.

The script below checks if it's higher or equal than zero due to reason above. So it would not leave in case of last message related to another item for example.
local item = 'vial' -- mana fluid shows up as a vial on the green message.

local count = itemcountmsg('vial', screenmessage())
if count >= 0 and count <= 10 then
     gotolabel('leave')
end
|Only Registered members can see download links. | Click here to buy subscription or here to register.




3. actionbarcount() to count from the action bar, but i'm not sure how accurate that is and this works only for stackable items.
local item = 'fish'

if actionbarcount(item) <= 10 then
     gotolabel('leave')
end



4. Select server log and use getmessages() to read the "Using ..." message as well.
That's only useful for checking for runes on specific places. For example: Create an Action to select server log, check for supplies and select Default back.

It will count enchanted spears from your LEFT HAND (<<<).
local ENCHANTED_SPEAR_ID = 1234 -- Enchanted spear id.

local leftHandItem = lhand()
if leftHandItem.id == 0 or leftHandItem.id ~= ENCHANTED_SPEAR_ID or (leftHandItem.id == ENCHANTED_SPEAR_ID and leftHandItem.count < 5) then
    playsound('default')
    flashclient()
end



As you wanna alert whenever you get 50 mfs or 40 uhs then the only way is by using itemcountmsg().
Notice that any rune will show up as "spell rune", so if you are using runes to hunt then it's NOT gonna work.
local mf_item = 'vial' -- mana fluid shows up as a vial on the green message.
local uh_item = 'spell rune' -- ultimate healing rune shows up as a vial on the green message.

local mf_count = itemcountmsg(mf_item, screenmessage())
if mf_count >= 0 and mf_count <= 10 then
    playsound('default')
    flashclient()
else
    local uh_count = itemcountmsg(uh_item, screenmessage())
    if uh_count >= 0 and uh_count <= 10 then
        playsound('default')
        flashclient()
    end
end
Reply

#3
|Only Registered members can see download links. | Click here to buy subscription or here to register.

And this one i have to put to "Action" in cavebot, or hotkey or something else?
Reply

#4
|Only Registered members can see download links. | Click here to buy subscription or here to register.

Hello.

That depends on you and how or how often you wanna check it. Persistents runs from time to time. Cavebot -> Action will check only when you go to that waypoint.
Based on your request and the code that I developed, it should work better on Persistents.
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016