• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TalkAction [Development] Fully functional Bot system

Dilio

Owner of Project Thala
Joined
Jun 8, 2008
Messages
188
Reaction score
7
Location
London, Ontario
TESTED AND WORKING IN 0.3.4PL1

NEEDED FOR AUTO HEAL AND AUTO MAGIC TRAIN


I have decided to test my scripting skills by making a "botting" system. Basically, I am aiming to make a fully working bot system that will work on talkactions.

Uhm... so ya, if you think there are more features that I have not listed in the "To be added" just let me know.

Features
Added:
-Bot Info (!bot)
-Auto Eat (!bot startfood/stopfood)
-Full Light (!bot light)
-Auto Heal (!bot startheal/stopheal)
-Auto Magic (!bot startmagic/stopmagic)

To be added:
-Auto Attack
-Auto Target
-Auto Loot
-Auto Stack
-Cavebot

Lua:
local eat = {}
local heal = {}
local magic = {}
local foods = {
	{8, "Crunch.", 2362},
	{15, "Munch.", 2666},
	{12, "Munch.", 2667},
	{10, "Mmmm.", 2668},
	{17, "Munch.", 2669},
	{4, "Gulp.", 2670},
	{30, "Chomp.", 2671},
	{60, "Chomp.", 2672},
	{5, "Yum.", 2673},
	{6, "Yum.", 2674},
	{13, "Yum.", 2675},
	{8, "Yum.", 2676},
	{1, "Yum.", 2677},
	{18, "Slurp.", 2678},
	{1, "Yum.", 2679},
	{2, "Yum.", 2680},
	{9, "Yum.", 2681},
	{20, "Yum.", 2682},
	{17, "Munch.", 2683},
	{8, "Crunch.", 2684},
	{6, "Munch.", 2685},
	{9, "Crunch.", 2686},
	{2, "Crunch.", 2687},
	{9, "Munch.", 2688},
	{10, "Crunch.", 2689},
	{3, "Crunch.", 2690},
	{8, "Crunch.", 2691},
	{6, "Munch.", 2792},
	{9, "Munch.", 2793},
	{6, "Gulp.", 2695},
	{9, "Smack.", 2696},
	{9, "Munch.", 2787},
	{4, "Munch.", 2788},
	{22, "Munch.", 2789},
	{30, "Munch.", 2790},
	{30, "Munch.", 2791},
	{6, "Munch.", 2792},
	{3, "Munch.", 2794},
	{36, "Munch.", 2795},
	{5, "Munch.", 2796},
	{9, "Munch.", 2793},
	{4, "Yum.", 5097},
	{8, "Gulp.", 6125},
	{10, "Mmmm.", 6278},
	{15, "Mmmm.", 6279},
	{12, "Mmmm.", 6393},
	{15, "Mmmm.", 6394},
	{20, "Mmmm.", 6501},
	{6, "Gulp.", 6541},
	{6, "Gulp.", 6542},
	{6, "Gulp.", 6543},
	{6, "Gulp.", 6544},
	{6, "Gulp.", 6545},
	{1, "Mmmm.", 6569},
	{4, "Mmmm.", 6574},
	{15, "Munch.", 7158},
	{13, "Munch.", 7159},
	{7, "Yum.", 7372},
	{7, "Yum.", 7373},
	{7, "Yum.", 7374},
	{7, "Yum.", 7375},
	{7, "Yum.", 7376},
	{7, "Yum.", 7377},
	{4, "Crunch.", 7909},
	{7, "Gulp.", 8838},
	{5, "Yum.", 8839},
	{2, "Yum.", 8840},
	{3, "Urgh.", 8841},
	{3, "Munch.", 8842},
	{3, "Crunch.", 8843},
	{3, "Gulp.", 8844},
	{2, "Munch.", 8845},
	{11, "Yum.", 8447}
}

function botInfo(cid)
	doPlayerPopupFYI(cid, "Bot System by Aziz\n" ..
	"--Tools--\n" ..
	"!bot startfood/stopfood   (Auto Eat)\n" ..
	"!bot light  (Full Light)\n\n" ..
	"--Auto Heal--\n" ..
	"!bot startheal, spellname, healthneeded, mananeeded\n" ..
	"(example !bot startheal, exura, 500, 20)\n" ..
	"!bot stopheal\n\n" ..
	"--Auto Magic--\n" ..
	"!bot startmagic, spellname, mananeeded\n" ..
	"(example !bot startmagic, utevo lux, 84)\n" ..
	"!bot stopmagic\n" ..
	""
	)
end

function botEat(cid)
	local food = nil
	for _, v in ipairs(foods) do
		if getPlayerItemCount(cid, v[3]) > 0 then
			food = v
			break
		end
	end

	if food ~= nil then
		if((getPlayerFood(cid) + food[1]) >= 400) then
			doPlayerSendCancel(cid, "You are full.")
			eat[getPlayerGUID(cid)] = addEvent(botEat, 20000, cid)
			return
		end
		doPlayerFeed(cid, food[1] * 4)
		doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1)
		doPlayerRemoveItem(cid, food[3], 1)
	end
	eat[getPlayerGUID(cid)] = addEvent(botEat, 20000, cid)
	return true
end

function botLoot(cid, itemid)
	if not isItemStackable(itemid) then
		return false
	end

	local count = getPlayerItemCount(cid, itemid)
	if count > 100 then
		count = count - math.floor(count / 100) * 100
	end
	
	local newCount = count
	if count ~= 0 then
		doRemoveItem(getPlayerItemById(cid, true, itemid, count).uid)
	end
	doPlayerAddItem(cid, itemid, newCount)
end

function botMoneyLoot(cid)
	local count = getPlayerItemCount(cid, 2148)
	if count > 100 then
		count = count - math.floor(count / 100) * 100
	end
	if count ~= 0 then
		doPlayerRemoveItem(cid, 2148, count)
	end
	doPlayerAddItem(cid, 2148, count)
end

function botHeal(params)
	if getCreatureMana(params[1]) < tonumber(params[4]) then
		heal[getPlayerGUID(params[1])] = addEvent(botHeal, 100, params)
		return true
	elseif getCreatureHealth(params[1]) < tonumber(params[3]) then
		doPlayerCastSpell(params[1], params[2])
		heal[getPlayerGUID(params[1])] = addEvent(botHeal, 100, params)
		return true
	end
	heal[getPlayerGUID(params[1])] = addEvent(botHeal, 100, params)
	return true
end

function botMagic(params)
	if getCreatureMana(params[1]) < tonumber(params[3]) then
		magic[getPlayerGUID(params[1])] = addEvent(botMagic, 100, params)
		return true
	else
		doPlayerCastSpell(params[1], params[2])
		magic[getPlayerGUID(params[1])] = addEvent(botMagic, 100, params)
		return true
	end
end

function onSay(cid, words, param, channel)
	if param == "" then
		botInfo(cid)
	end

     local params = string.explode(param, ",")
     if params[1] == "startfood" then
          eat[getPlayerGUID(cid)] = addEvent(botEat, 100, cid)
     elseif params[1] == "stopfood" then
          stopEvent(eat[getPlayerGUID(cid)])
     elseif params[1] == "light" then
          doSetCreatureLight(cid, 100, 215, -1)
     elseif (params[1] == "startheal" and #params == 4) then
          botHeal({cid, params[2], params[3], params[4]})
     elseif (params[1] == "stopheal") then
		stopEvent(heal[getPlayerGUID(cid)])
	elseif (params[1] == "startmagic" and #params == 3) then
		botMagic({cid, params[2], params[3]})
	elseif (params[1] == "stopmagic") then
		stopEvent(magic[getPlayerGUID(cid)])
     end     
     return true
end

Credit:
Idea - Me
Script - Me and Nahruto
doPlayerCast - Evil Hero

Comments/Suggestions.
 
Last edited:
But why would anyone actually use this for real? Or you're just doing it for skill showoff?
 
But why would anyone actually use this for real? Or you're just doing it for skill showoff?

You would be surprised, there are some servers out there who support bots, so now players do not need to download a bot if they are on those servers. xP

But on a serious note, I am just doing it to test my skills and for fun. :3
 
now players dont need bot.
server auto bot players .
heuauehauhahhaue


Code:
[2:27:55.177] [Error - TalkAction Interface] 
[2:27:55.177] data/talkactions/scripts/bot.lua:onSay
[2:27:55.177] Description: 
[2:27:55.177] data/talkactions/scripts/bot.lua:107: attempt to call global 'doSetCreatureLight' (a nil value)
[2:27:55.177] stack traceback:
[2:27:55.177] 	data/talkactions/scripts/bot.lua:107: in function <data/talkactions/scripts/bot.lua:101>
0.4_DEV
 
Last edited:
now players dont need bot.
server auto bot players .
heuauehauhahhaue


Code:
[2:27:55.177] [Error - TalkAction Interface] 
[2:27:55.177] data/talkactions/scripts/bot.lua:onSay
[2:27:55.177] Description: 
[2:27:55.177] data/talkactions/scripts/bot.lua:107: attempt to call global 'doSetCreatureLight' (a nil value)
[2:27:55.177] stack traceback:
[2:27:55.177] 	data/talkactions/scripts/bot.lua:107: in function <data/talkactions/scripts/bot.lua:101>
0.4_DEV

Forgot to say, this was made for 0.3.4PL1, just find the new function for setting light in 0.4
 
It's actually a nice idea for FUN servers (I mean RL Maps, TP Servers), maybe not the cavebot shit but auto attacker and auto looter.
 
But why would anyone actually use this for real? Or you're just doing it for skill showoff?

Not much skill show off, it's just food.lua edited.

@Topic,
Anyway, I suppose it was an all right idea.
 
PHP:
local eat = {}
local heal = {}
local foods = {
        {8, "Crunch.", 2362},
        {15, "Munch.", 2666},
        {12, "Munch.", 2667},
        {10, "Mmmm.", 2668},
        {17, "Munch.", 2669},
        {4, "Gulp.", 2670},
        {30, "Chomp.", 2671},
        {60, "Chomp.", 2672},
        {5, "Yum.", 2673},
        {6, "Yum.", 2674},
        {13, "Yum.", 2675},
        {8, "Yum.", 2676},
        {1, "Yum.", 2677},
        {18, "Slurp.", 2678},
        {1, "Yum.", 2679},
        {2, "Yum.", 2680},
        {9, "Yum.", 2681},
        {20, "Yum.", 2682},
        {17, "Munch.", 2683},
        {8, "Crunch.", 2684},
        {6, "Munch.", 2685},
        {9, "Crunch.", 2686},
        {2, "Crunch.", 2687},
        {9, "Munch.", 2688},
        {10, "Crunch.", 2689},
        {3, "Crunch.", 2690},
        {8, "Crunch.", 2691},
        {6, "Munch.", 2792},
        {9, "Munch.", 2793},
        {6, "Gulp.", 2695},
        {9, "Smack.", 2696},
        {9, "Munch.", 2787},
        {4, "Munch.", 2788},
        {22, "Munch.", 2789},
        {30, "Munch.", 2790},
        {30, "Munch.", 2791},
        {6, "Munch.", 2792},
        {3, "Munch.", 2794},
        {36, "Munch.", 2795},
        {5, "Munch.", 2796},
        {9, "Munch.", 2793},
        {4, "Yum.", 5097},
        {8, "Gulp.", 6125},
        {10, "Mmmm.", 6278},
        {15, "Mmmm.", 6279},
        {12, "Mmmm.", 6393},
        {15, "Mmmm.", 6394},
        {20, "Mmmm.", 6501},
        {6, "Gulp.", 6541},
        {6, "Gulp.", 6542},
        {6, "Gulp.", 6543},
        {6, "Gulp.", 6544},
        {6, "Gulp.", 6545},
        {1, "Mmmm.", 6569},
        {4, "Mmmm.", 6574},
        {15, "Munch.", 7158},
        {13, "Munch.", 7159},
        {7, "Yum.", 7372},
        {7, "Yum.", 7373},
        {7, "Yum.", 7374},
        {7, "Yum.", 7375},
        {7, "Yum.", 7376},
        {7, "Yum.", 7377},
        {4, "Crunch.", 7909},
        {7, "Gulp.", 8838},
        {5, "Yum.", 8839},
        {2, "Yum.", 8840},
        {3, "Urgh.", 8841},
        {3, "Munch.", 8842},
        {3, "Crunch.", 8843},
        {3, "Gulp.", 8844},
        {2, "Munch.", 8845},
        {11, "Yum.", 8447}
}

function botEat(cid)
        local food = nil
        for _, v in ipairs(foods) do
                if getPlayerItemCount(cid, v[3]) > 0 then
                        food = v
                        break
                end
        end

        if food ~= nil then
                if((getPlayerFood(cid) + food[1]) >= 400) then
                        doPlayerSendCancel(cid, "You are full.")
                        eat[getPlayerGUID(cid)] = addEvent(botEat, 20000, cid)
                        return
                end
                doPlayerFeed(cid, food[1] * 4)
                doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1)
                doPlayerRemoveItem(cid, food[3], 1)
        end
        eat[getPlayerGUID(cid)] = addEvent(botEat, 20000, cid)
        return true
end

function healBot(params)
	if(getPlayerHealth(params[1])>params[3]) then return TRUE end
	doCreatureSay(params[1], params[2], TALKTYPE_YELLOW)
	heal[getPlayerGUID(params[1])] = addEvent(healBot, 100, params) return TRUE
end

function onSay(cid, words, param, channel)
	local params = string.explode(param, ",")
        if params[1] == "startfood" then
            eat[getPlayerGUID(cid)] = addEvent(botEat, 100, cid)
        elseif params[1] == "stopfood" then
            stopEvent(eat[getPlayerGUID(cid)])
        elseif params[1] == "light" then
            doSetCreatureLight(cid, 100, 215, -1)
		elseif (params[1] == "healing" and #params == 3) then
			healBot({cid, params[2], params[3]})
		elseif (params[1] == "stop healing" and #params == 3) then
			stopEvent(heal[getPlayerGUID(cid)])
        end     
        return true
end

Added auto healing.

command params:
TO START:
healing, spell_name, min_hp
ex.
healing, exura vita, 250
TO STOP:
stop healing

ex.
/bot healing, exura vita,250
/bot stop healing
 
Last edited:
PHP:
local eat = {}
local heal = {}
local foods = {
        {8, "Crunch.", 2362},
        {15, "Munch.", 2666},
        {12, "Munch.", 2667},
        {10, "Mmmm.", 2668},
        {17, "Munch.", 2669},
        {4, "Gulp.", 2670},
        {30, "Chomp.", 2671},
        {60, "Chomp.", 2672},
        {5, "Yum.", 2673},
        {6, "Yum.", 2674},
        {13, "Yum.", 2675},
        {8, "Yum.", 2676},
        {1, "Yum.", 2677},
        {18, "Slurp.", 2678},
        {1, "Yum.", 2679},
        {2, "Yum.", 2680},
        {9, "Yum.", 2681},
        {20, "Yum.", 2682},
        {17, "Munch.", 2683},
        {8, "Crunch.", 2684},
        {6, "Munch.", 2685},
        {9, "Crunch.", 2686},
        {2, "Crunch.", 2687},
        {9, "Munch.", 2688},
        {10, "Crunch.", 2689},
        {3, "Crunch.", 2690},
        {8, "Crunch.", 2691},
        {6, "Munch.", 2792},
        {9, "Munch.", 2793},
        {6, "Gulp.", 2695},
        {9, "Smack.", 2696},
        {9, "Munch.", 2787},
        {4, "Munch.", 2788},
        {22, "Munch.", 2789},
        {30, "Munch.", 2790},
        {30, "Munch.", 2791},
        {6, "Munch.", 2792},
        {3, "Munch.", 2794},
        {36, "Munch.", 2795},
        {5, "Munch.", 2796},
        {9, "Munch.", 2793},
        {4, "Yum.", 5097},
        {8, "Gulp.", 6125},
        {10, "Mmmm.", 6278},
        {15, "Mmmm.", 6279},
        {12, "Mmmm.", 6393},
        {15, "Mmmm.", 6394},
        {20, "Mmmm.", 6501},
        {6, "Gulp.", 6541},
        {6, "Gulp.", 6542},
        {6, "Gulp.", 6543},
        {6, "Gulp.", 6544},
        {6, "Gulp.", 6545},
        {1, "Mmmm.", 6569},
        {4, "Mmmm.", 6574},
        {15, "Munch.", 7158},
        {13, "Munch.", 7159},
        {7, "Yum.", 7372},
        {7, "Yum.", 7373},
        {7, "Yum.", 7374},
        {7, "Yum.", 7375},
        {7, "Yum.", 7376},
        {7, "Yum.", 7377},
        {4, "Crunch.", 7909},
        {7, "Gulp.", 8838},
        {5, "Yum.", 8839},
        {2, "Yum.", 8840},
        {3, "Urgh.", 8841},
        {3, "Munch.", 8842},
        {3, "Crunch.", 8843},
        {3, "Gulp.", 8844},
        {2, "Munch.", 8845},
        {11, "Yum.", 8447}
}

function botEat(cid)
        local food = nil
        for _, v in ipairs(foods) do
                if getPlayerItemCount(cid, v[3]) > 0 then
                        food = v
                        break
                end
        end

        if food ~= nil then
                if((getPlayerFood(cid) + food[1]) >= 400) then
                        doPlayerSendCancel(cid, "You are full.")
                        eat[getPlayerGUID(cid)] = addEvent(botEat, 20000, cid)
                        return
                end
                doPlayerFeed(cid, food[1] * 4)
                doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1)
                doPlayerRemoveItem(cid, food[3], 1)
        end
        eat[getPlayerGUID(cid)] = addEvent(botEat, 20000, cid)
        return true
end

function healBot(params)
	if(getPlayerMana(params[1])<params[3]) then doPlayerSendCancel(params[1], "You don't have enough mana.") addEvent(healBot, 1000, params) return TRUE end
	doCreatureSay(params[1], params[2], TALKTYPE_YELLOW)
	heal[getPlayerGUID(params[1])] = addEvent(healBot, 100, params) return TRUE
end

function onSay(cid, words, param, channel)
	local params = string.explode(param, ",")
        if params[1] == "startfood" then
            eat[getPlayerGUID(cid)] = addEvent(botEat, 100, cid)
        elseif params[1] == "stopfood" then
            stopEvent(eat[getPlayerGUID(cid)])
        elseif params[1] == "light" then
            doSetCreatureLight(cid, 100, 215, -1)
		elseif (params[1] == "healing" and #params == 3) then
			healBot({cid, params[2], params[3]})
		elseif (params[1] == "stop healing" and #params == 3) then
			stopEvent(heal[getPlayerGUID(cid)])
        end     
        return true
end

Added auto healing.

command params:
TO START:
healing, spell_name, need_mana
ex.
healing, exura vita, 160
TO STOP:
stop healing

ex.
/bot healing, exura vita, 160
/bot stop healing

Is it tested? doCreatureSay does not seem like it would cast a spell.

@JDB
The showoff kicks in when more complex parts of the "bot" are added. .-.
 
not tested but, doCreatureSay with TALKTYPE_YELLOW = normal say, spells should works.. :D
I fixed one bug. don't check hps.. :D
 
not tested but, doCreatureSay with TALKTYPE_YELLOW = normal say, spells should works.. :D
I fixed one bug. don't check hps.. :D

Client will crash if you use TALKTYPE_YELLOW
and no... it wont work with doCreatureSay function.


kind regards, Evil Hero.
 
Code:
doCreatureSay(cid, "Hello", TALKTYPE_SAY)
 
#up
hehehhe ; )

I have one idea for you... :D

Don't make any arrays... make one..
PHP:
local eat = {}
local heal = {}
local magic = {}
you can make
PHP:
temp = {}
and using:
PHP:
temp[getPlayerGUID(cid)].magic
temp[getPlayerGUID(cid)].heal
temp[getPlayerGUID(cid)].eat
it's easier. : ) but add for works good:
PHP:
if(type(temp[getPlayerGUID(cid)])~="table")then temp[getPlayerGUID(cid)] = {} end

: )
 
Great Job ^^ That System is very good for War server or Custom with high exp xd
 
Cipsoft will steal this and add certain features to real tibia in a few updates.

I mean, what haven't they stole yet that doesnt completely deplete Tibia's 'rpg-ness'?
 
I might finish making this just for fun, but should I release the finished script or will no one use it? I am guessing not which is why I have avoided doing anything serious with it at the moment.
 
Back
Top