Automatically counts all killed monsters and optionally saves it to the character's database. Exposes the saved data through the public API described below:
Configuration
Edit the saveToDB variable on the init block to specify whether the bot should save the kill count data to the database so that it persists across different sessions.
Public API
killCount.set(count, name¹, name², name*, ...)
Sets the kill count to count for creatures with names name¹, name², name*, ...
killCount.reset(name¹, name², name*, ...)
Sets the kill count to 0 for creatures with names name¹, name², name*, ...
killCount.add(addAmount, name¹, name², name*, ...)
Adds addAmount to the kill count for creatures with names name¹, name², name*, ...
killCount.get(name¹, name², name*, ...)
Gets the sum of the kill count for creatures with names name¹, name², name*, ...
Examples
Checking Amount Killed (Action)
if killCount.get('Medusa') > 500 then
gotolabel('BackToCity')
end
-- If set to true, will save kill count to $chardb so that it is persisted
-- throughout different sessions.
local saveToDB = true
-- DO NOT EDIT BELOW THIS LINE --
-- We don't want to override the object because that'd delete all data in
-- killCount.creatures
if killCount == nil then
killCount = {
creatures = {},
lastRan = $timems
}
killCount.set = function(count, ...)
local names = table.each({...}, string.lower)
for _, v in ipairs(names) do
killCount.creatures[v] = count
if killCount.saveToDB then
$chardb:setvalue('killCount', v, count)
end
end
end
killCount.add = function(addAmount, ...)
local names = table.each({...}, string.lower)
for _, v in ipairs(names) do
killCount.set(killCount.get(v) + addAmount, v)
end
end
killCount.reset = function(...)
killCount.set(0, ...)
end
killCount.get = function(...)
local names = table.each({...}, string.lower)
local count = 0
for _, v in ipairs(names) do
local cCount = killCount.creatures[v]
if cCount == nil then
cCount = 0
killCount.set(cCount, v)
end
count = count + cCount
end
return count
end
if saveToDB then
-- Thanks to [MENTION=1]Lucas Terra[/MENTION] for implementing database iterators for the
-- sole purpose of making this script better. Lucas, you rock!
foreach $chardb:sectionvalue v 'killCount' do
killCount.set(v.value, v.name)
end
end
end
-- We only set saveToDB now because else it would cause unnecessary updates
-- queried to the database when we first read it.
killCount.saveToDB = saveToDB
init end
auto(100)
foreach newmessage m do
if m.type == MSG_INFO then
local creature = m.content:match(REGEX_LOOT)
if creature then
killCount.add(1, creature)
end
end
end
--Check Task if killCount.get("Sea Serpent","Young Sea Serpent") > 900 then gotolabel("Start","TaskMaker") else end
The counter won't reset. So after you reached 900 kills the script will try to do the Tasker every round again right?
So will it work if u edit it to this?
PHP Code:
--Check Task if killCount.get("Sea Serpent","Young Sea Serpent") > 900 then gotolabel("Start","TaskMaker") and killCount.reset("Sea Serpent", "Young Sea Serpent") else end
And will it reset all the creature if u just leave it like this?
PHP Code:
killCount.reset()
Thanks in advance,
Your Dkampen
04-26-2014, 08:47 PM
Raphael
Script Updated!
It's slightly faster and reliable since I'm now using the database iterator to load initial data at boot.
05-01-2014, 07:16 AM
Ragekemi
@Raphael , even after i've added the script on Persistent section and then i've added the hud,
even if i use the public api function on Console / via Action by enabling it once without (auto~~) . yet the Hud shows 0 killed... how can i be sure that i can use killcounter functions? i dont see it recording it trough play sessions even if i got savedb true...
Any tip how to solve?
05-01-2014, 07:21 AM
mistgun
Put it to persistent. To get monsters killed use console then paste
print(killCount.get('monster name'))
05-05-2014, 05:52 PM
Raphael
Quote:
Originally Posted by Ragekemi
@Raphael , even after i've added the script on Persistent section and then i've added the hud,
even if i use the public api function on Console / via Action by enabling it once without (auto~~) . yet the Hud shows 0 killed... how can i be sure that i can use killcounter functions? i dont see it recording it trough play sessions even if i got savedb true...
Any tip how to solve?
What's on your HUD script?
05-05-2014, 09:33 PM
Ragekemi
Quote:
Originally Posted by Raphael
What's on your HUD script?
I've managed to print it via api commands.. the Kill recent hud seems to use another variable to show it...
05-06-2014, 12:53 PM
gustavorip
Good morning!
I'm sure about one thing ... when I reset the kills ...
Check Task:
PHP Code:
if killCount.get("Tarantula") >= 300 then gotolabel(0,"Kill Hide") wait(500,1000) killCount.reset("Tarantula") else gotolabel(0,"Go Hunt") end
Is correct the way I'm using?
05-06-2014, 01:12 PM
Dworak
yes it is correct, but in my opinion kill reset you should make when back from the boss ;)
Regards
05-06-2014, 02:41 PM
Raphael
Quote:
Originally Posted by gustavorip
Good morning!
I'm sure about one thing ... when I reset the kills ...
Check Task:
PHP Code:
if killCount.get("Tarantula") >= 300 then gotolabel(0,"Kill Hide") wait(500,1000) killCount.reset("Tarantula") else gotolabel(0,"Go Hunt") end
Is correct the way I'm using?
Not really, you should only reset the count after killing the Hide.
06-29-2014, 03:51 PM
tranquilo
can i reset the time of task timer? with a command?
07-12-2014, 11:18 AM
mgula
where i must use this script?? Doesn't work for me , i don't know what i will do with this script ;/
08-19-2014, 05:00 AM
netones
Quote:
Originally Posted by mgula
where i must use this script?? Doesn't work for me , i don't know what i will do with this script ;/
dont work for me too ;\
09-03-2014, 11:18 PM
Raphael
Added a few examples for those who are kinda lost.
09-15-2014, 01:54 AM
Culas
killCount.reset is not working properly for me, It doesnt reset the HUD numbers '-'
@Raphael
09-15-2014, 02:05 AM
Raphael
Quote:
Originally Posted by Culas
killCount.reset is not working properly for me, It doesnt reset the HUD numbers '-'
@Raphael
What is your HUD?
09-15-2014, 02:06 AM
Culas
Quote:
Originally Posted by Raphael
What is your HUD?
Leonardo's HUD
10-05-2014, 06:06 PM
marro
I don't get this, i'm using this: but my char keeps hunting, doesn't leave from resp xD what am i doing wrong, help pls
if killCount.get('Medusa') > 500 then
gotolabel(0, "Leave")
end
And where the code goes? D:
10-05-2014, 11:59 PM
Dani Scripts
Quote:
Originally Posted by marro
if killCount.get('Medusa') > 500 then
gotolabel(0, "Leave")
end
This isn't working for me neither, someone know why?
10-07-2014, 10:00 PM
marro
Well i used this:
if killCount.get('Medusa') > 500 then
gotolabel(0, "Leave")
end
But if i enter to a new char it doesn't recognize how many monsters it have killed so far, it only works if i kill the boss 1 time manually cause after it kill the boss it uses killcount.reset so the bot start counting, can someone give me a suggestion of how to make it work? XD
10-09-2014, 07:46 PM
ozzix
@Raphael It doesnt count while im running another game (HoN, fullscreen), Any idea why?
12-17-2014, 01:40 PM
ash katchup
Nevermind. My script had a bug.
01-15-2015, 12:52 AM
bigtri
how do you use this where do you find public api etc? cheers