Cleverbot "crazy"
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Cleverbot "crazy"

Started by Loading, 26 June, 2005, 17:17:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Loading

hello ppl

i have this script in lua 5 :

--[[
	Thks to Ptaczek for his Trickerbot.lua
	Thks to Skrollster, for the math.random synthax
	Thks to MatrixX for some help, too...
	And thks to the others, for their help... ;o)
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
	seNsi: the 'clever' bot :p
	Description:
	- Each 20 math.min, bot is talking alone, with math.random questions...
	- If someone speaks again on main chat, there is a math.random answer, and then the timer is starting again.
	- If the user says a known trig (ex: 'hey '), and the bot was feeling alone, bot will choose the correct answer (ex:'Yessss,...[USER] happy to hear U again,, :))')
	- Sorry for the 'a' synthax (a = 0, a = 1, etc...), but I'm quite nb in lua...
	- Hope u'll enjoy it ! :o)
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
	- heavily touched by Herodes :: 28/3/2005 ( 16.08 compliant too )
	- many optimizations .. couldn't count them .. just enjoy..
	- some fixes by Dessamator
--]]
bot = {
	["name"] = "?Bot-Maluco??",
	["email"] = "WWW.Marado.com",
	["desc"] = "HA , HA , LOLOLOL ...",
}

Interval = 15 -- every how many minutes ?

s = {}
s.trigs = {
	["inte"] = "inte [USER]",
	["boas"] = "Boas [USER] tudo fixe ? ",
	["lol"] = "Tas-te a rir de ke ????   LOLOL ",
	["sporting"] = "J? vi melhores, o SLB por exemplo....",
	["benfica"] = "O melhor clube do mundo..viva ao glorioso!!!",
	["jantar"] = "hummmm, tb tenho fome, ? pra tua casa q vou... :o)",
        ["raiva"] = "J? existe vacina para isso, sabias????",
        ["Loading"] = "MY Master...... :)",
        ["slots"] = "queres slots????Para que CPU? Existe slot 1, Slot 2, Slot A etc....hehehehe...",
        ["haha"] = "hehehehehe",
        ["xau"] = "XAUZ?o [USER] , a tua falta e dos ficheiros que partilhas ser? sentida.",
        ["dasse"] = "Ent?o [USER]!!!! ''T?s-ta esticar''....? melhor teres tento na lingua!",
        ["adeus"] = "Adeus [USER] , volta sempre !!!!",
        ["boas"] = "Boas [USER], tudo na maior? Queres dar uma????.................Volta?LOLOL",
        ["fdx"] = "Asneiras eh que n?o [USER]...controla-te!!!!",
        ["virus"] = "Afastem essas coisas de mim que sou AL?RGICO !!!!!",
        ["cala-te"] = "Ai sim!? Queres obrigar-me [USER] ??? tu e mais quantos??(hahaha)!",
        ["alguem tem"] = "[USER]...e se usasses a ferramenta do SEARCH ????",
        ["ao hub"] = "Est?s a fazer PUB [USER] ?????? Isso ? muito feio... ",
        ["algum op"] = "Ops??hummm!!!!Deixa-me ver...t?o ali aqueles com uma chavinha la em cima querias ter ne ?? mas n?o tens =P ",
        ["firewall"] = "Bem lembrado [USER] !!!! TODOS VOCES devem usar FIREWALLs (para vossa seguran?a)",
        ["tasse"] = "Tasse [USER] !!!",
        ["come"] = "Kom? [USER] !!! ",
	}

s.idle ={} -- don't touch this line pls .. if you do don't blame it on me ..

s.idle.questions = {
	"Ninguem estah por a? ???!",
	"Toda a gente tah a ferrar ??!",
	"Alguem sabe Algum site de Jogos  ???!",
	"HeeeeeeeeeeeLLLLLLLoooooooooooooo !!! ",
	"Nao me deixem Sozinho.... :'(",
	}

s.idle.answers = {
	"Aaaahh, ''caro'' [USER]... j? me estava a sentir SOZINHO :o)",
	"OHHH,...[USER] tava a ver k me ias ignorar :))",
	"Ahhhhh -----> www.Megagames.com",
	"Onde podemos nos encontrar ?? no palace ???",
	"Isso ? que era bom...mas parece ke ninguem ker!!!",
	}

s.idle.morninganswers = {
	"Wow... [USER]... ou dormiste pouco ou ainda n?o te deitaste.... :p",
	"Yeahh !!! BOM Diiiiiiiiiiiiiiiiiiiiiiiiiiiaaaaaa [USER] !",
	"Sendo assim [USER],...podes fazer um caf? para mim ??!! please... :o)",
        "Ha ???.....ser? possivel dizeres-me como est? o tempo a? fora?!!! (loool)",
	}

s.idle.morning = {
	"RiiiiiiiNG... HORAS de ACORDAR !!! ...:D",
	"BOM DIA a TODOS !!!!!!! , cheira-me que hoje vai ''bombar forte e feio!!!!!!!",
	"Hmm.....Alguem est? acordado ??!!!",
        "Ningu?m diz nada ??? J? ? de manh?.....",
	}

s.idle.evening = {
	"T? na hora de ir beber umas Cervejolas , n?o ??!?",
	"Hum hum... isto t? muito calmo para estas horas....que se passa ppl??!",
	"A estas horas n?o deviam tar a dormir....ACORDEM ppl !!!",
	}

s.idle.eveninganswers = {
	"EU PAGO a 1? RODADA ....depois s?o voc?s !!!!",
	"Estou s? preocupado.....? isso.",
	"Mas...o que se passa...??? Devem estar a sacar algo muito importante.",
	}



function Main()
	talk = true
	frmHub:RegBot(bot.name, 1, bot.desc, bot.email)
	bot = bot.name
	w = { ["quiet"] = false,["morn"] = false,["even"] = false }
	SetTimer(Interval*60000)
	StartTimer()
end

function ParseCommands(user, data, pm_start)
	local findstr = (pm_start or "").."%b<>%s+[!#?+](%S+)"
	local _,_, cmd = string.find ( data, findstr )
	local check=nil
	if cmd then
		if cmd == "calado" then
			Talk(false)
			SendToAll(bot, "Hmm, Tempo de ir Descansar , mas.. ILL BE BACK !!")
			StopTimer()
			return cmd
		elseif cmd == "fala" then
			Talk(true)
			SetWait(false,false,false)
			StartTimer()
			SendToAll(bot, "Volteeeiiiii... , Sentiram a minha falta ? , :D")
			return cmd
		end
	end
end 

function Talk(b)
	if b then talk = b end
	return talk
end

function ToArrival(user, data)
	if (string.sub(data, 1, string.len(bot)+5 ) == "$To: "..bot ) then
		if user.bOperator then
			if ParseCommands(user, string.sub(data,1, -2), "%$") then
				return 1
			end
		end
	end
end

-- Main Chat events --
function ChatArrival(user, data)
	if ( user.bOperator and ParseCommands( user, string.sub(data,1, -2) ) ) then return 1 end
	local _,_,msg = string.find( data, "%b<>%s*(.*)|")
	local talked = nil
	msg = string.lower(msg)
	for trig, replace in s.trigs do
		if ( w.quiet == false) then
			if string.find( msg, trig ) then
				talked = (Produce( replace, "%[USER%]", user.sName))	
			end
		end
	end

	-- Restart the timer each time someone is talking on the main chat, if bot is allowed to talk --
	if Talk() then
		local function idleresponce(idle)
			dostuff=Produce( idle, "%[USER%]", user.sName)
			return dostuff
		end		
		StopTimer()
		StartTimer()

		if w.quiet then
			talked = idleresponce(s.idle.answers )
			SetWait(false)	
		elseif 	(w.morn) then
			talked =idleresponce(s.idle.morninganswers)
			SetWait(false,false)
		elseif w.even then 
			talked = idleresponce(s.idle.eveninganswers)
			SetWait(false,false,false)
	
		end
	end
-- To Send A msg after the users "speaks" not b4 --
	if talked then
		SendToAll( user.sName, msg)
		SendToAll( bot, talked )
		return 1
	end
end

function OnTimer()
	local h, trig = tonumber(os.date("%H")), nil
	-- Idle trigs, for the morning, and the evening :o) --
	if h == 7 then
		SendToAll( bot, Produce(s.idle.morning) )
		SetWait(false,true,false)
		StartTimer()
		trig = true
	elseif h == 19 then
		SendToAll( bot, Produce(s.idle.evening) )
		SetWait(false,false,true)
		StartTimer()
		trig = true
	end

	-- Others idle trigs --
	if not trig then
		SendToAll( bot, Produce(s.idle.questions))
		SetWait(true)
	end
end

function Produce( val, what, with )
	if what then
		if type(val) == "table" then
			return string.gsub( val[math.random(1,table.getn(val))], what, with )
		end
		return string.gsub( val, what, with )
	end
	return val[math.random(1,table.getn(val))]
end

function SetWait( q, m, e )
	w.quiet = q --quiet
	w.morn  = m --morning
	w.even  = e --evening
end--------------------------------------------------------------------------------

but the comand !calado ( is for shut up the bot )

not work
 well work but it activate again if someone talks

can anyone see this error ?

best regards

Loading

Dessamator

change ur functions as follows:

function Main()
	talk = true
	frmHub:RegBot(bot.name, 1, bot.desc, bot.email)
	bot = bot.name
	w = { ["quiet"] = false,["morn"] = false,["even"] = false,["silence"]=false, }
	SetTimer(Interval*60000)
	StartTimer()
end

function ParseCommands(user, data, pm_start)
	local findstr = (pm_start or "").."%b<>%s+[!#?+](%S+)"
	local _,_, cmd = string.find ( data, findstr )
	if cmd then
tCmd={
["calado"]=function()
		Talk(false)
		SendToAll(bot, "away")
		StopTimer()
		w.silence =true
end,
	["fala"]=function()
		Talk(true)
		SetWait(false,false,false)
		w.silence =false
		StartTimer()
		SendToAll(bot, "Back")
		
		end,
}
		if tCmd[cmd] then
			return "cmd",tCmd[cmd]()
		else
			return cmd
		end
	end
end

and this :
if ( user.bOperator and ParseCommands( user, string.sub(data,1, -2) ) ) then return 1 end


to this :
if  user.bOperator and ParseCommands( user, string.sub(data,1, -2))=="cmd" then return 1 end


and finally change this :
if talked and not(w.silence) and not ParseCommands( user, string.sub(data,1, -2)) then
		SendToAll( user.sName, msg)
		SendToAll( bot, talked )
		return 1
	end
Ignorance is Bliss.

Loading

hello ppl

tanks for your time Dessamator

but i get this error:

Syntax ...s\Ptokax 0.3.3.0.b17.04.nt.dbg\scripts\CleverBot.lua:191: attempt to call global `Produce' (a nil value)

i have the script like this:
--[[
	Thks to Ptaczek for his Trickerbot.lua
	Thks to Skrollster, for the math.random synthax
	Thks to MatrixX for some help, too...
	And thks to the others, for their help... ;o)
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
	seNsi: the 'clever' bot :p
	Description:
	- Each 20 math.min, bot is talking alone, with math.random questions...
	- If someone speaks again on main chat, there is a math.random answer, and then the timer is starting again.
	- If the user says a known trig (ex: 'hey '), and the bot was feeling alone, bot will choose the correct answer (ex:'Yessss,...[USER] happy to hear U again,, :))')
	- Sorry for the 'a' synthax (a = 0, a = 1, etc...), but I'm quite nb in lua...
	- Hope u'll enjoy it ! :o)
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
	- heavily touched by Herodes :: 28/3/2005 ( 16.08 compliant too )
	- many optimizations .. couldn't count them .. just enjoy..
	- some fixes by Dessamator
--]]
bot = {
	["name"] = "?Bot-Maluco??",
	["email"] = "WWW.Marado.com",
	["desc"] = "HA , HA , LOLOLOL ...",
}

Interval = 15 -- every how many minutes ?

s = {}
s.trigs = {
	["inte"] = "inte [USER]",
	["boas"] = "Boas [USER] tudo fixe ? ",
	["lol"] = "Tas-te a rir de ke ????   LOLOL ",
	["sporting"] = "J? vi melhores, o SLB por exemplo....",
	["benfica"] = "O melhor clube do mundo..viva ao glorioso!!!",
	["jantar"] = "hummmm, tb tenho fome, ? pra tua casa q vou... :o)",
        ["raiva"] = "J? existe vacina para isso, sabias????",
        ["Loading"] = "MY Master...... :)",
        ["slots"] = "queres slots????Para que CPU? Existe slot 1, Slot 2, Slot A etc....hehehehe...",
        ["haha"] = "hehehehehe",
        ["xau"] = "XAUZ?o [USER] , a tua falta e dos ficheiros que partilhas ser? sentida.",
        ["dasse"] = "Ent?o [USER]!!!! ''T?s-ta esticar''....? melhor teres tento na lingua!",
        ["adeus"] = "Adeus [USER] , volta sempre !!!!",
        ["boas"] = "Boas [USER], tudo na maior? Queres dar uma????.................Volta?LOLOL",
        ["fdx"] = "Asneiras eh que n?o [USER]...controla-te!!!!",
        ["virus"] = "Afastem essas coisas de mim que sou AL?RGICO !!!!!",
        ["cala-te"] = "Ai sim!? Queres obrigar-me [USER] ??? tu e mais quantos??(hahaha)!",
        ["alguem tem"] = "[USER]...e se usasses a ferramenta do SEARCH ????",
        ["ao hub"] = "Est?s a fazer PUB [USER] ?????? Isso ? muito feio... ",
        ["algum op"] = "Ops??hummm!!!!Deixa-me ver...t?o ali aqueles com uma chavinha la em cima querias ter ne ?? mas n?o tens =P ",
        ["firewall"] = "Bem lembrado [USER] !!!! TODOS VOCES devem usar FIREWALLs (para vossa seguran?a)",
        ["tasse"] = "Tasse [USER] !!!",
        ["come"] = "Kom? [USER] !!! ",
	}

s.idle ={} -- don't touch this line pls .. if you do don't blame it on me ..

s.idle.questions = {
	"Ninguem estah por a? ???!",
	"Toda a gente tah a ferrar ??!",
	"Alguem sabe Algum site de Jogos  ???!",
	"HeeeeeeeeeeeLLLLLLLoooooooooooooo !!! ",
	"Nao me deixem Sozinho.... :'(",
	}

s.idle.answers = {
	"Aaaahh, ''caro'' [USER]... j? me estava a sentir SOZINHO :o)",
	"OHHH,...[USER] tava a ver k me ias ignorar :))",
	"Ahhhhh -----> [URL]www.Megagames.com[/URL]",
	"Onde podemos nos encontrar ?? no palace ???",
	"Isso ? que era bom...mas parece ke ninguem ker!!!",
	}

s.idle.morninganswers = {
	"Wow... [USER]... ou dormiste pouco ou ainda n?o te deitaste.... :p",
	"Yeahh !!! BOM Diiiiiiiiiiiiiiiiiiiiiiiiiiiaaaaaa [USER] !",
	"Sendo assim [USER],...podes fazer um caf? para mim ??!! please... :o)",
        "Ha ???.....ser? possivel dizeres-me como est? o tempo a? fora?!!! (loool)",
	}

s.idle.morning = {
	"RiiiiiiiNG... HORAS de ACORDAR !!! ...:D",
	"BOM DIA a TODOS !!!!!!! , cheira-me que hoje vai ''bombar forte e feio!!!!!!!",
	"Hmm.....Alguem est? acordado ??!!!",
        "Ningu?m diz nada ??? J? ? de manh?.....",
	}

s.idle.evening = {
	"T? na hora de ir beber umas Cervejolas , n?o ??!?",
	"Hum hum... isto t? muito calmo para estas horas....que se passa ppl??!",
	"A estas horas n?o deviam tar a dormir....ACORDEM ppl !!!",
	}

s.idle.eveninganswers = {
	"EU PAGO a 1? RODADA ....depois s?o voc?s !!!!",
	"Estou s? preocupado.....? isso.",
	"Mas...o que se passa...??? Devem estar a sacar algo muito importante.",
	}



function Main()

	talk = true

	frmHub:RegBot(bot.name, 1, bot.desc, bot.email)

	bot = bot.name

	w = { ["quiet"] = false,["morn"] = false,["even"] = false,["silence"]=false, }

	SetTimer(Interval*60000)

	StartTimer()

end



function ParseCommands(user, data, pm_start)

	local findstr = (pm_start or "").."%b<>%s+[!#?+](%S+)"

	local _,_, cmd = string.find ( data, findstr )

	if cmd then

tCmd={

["calado"]=function()

		Talk(false)

		SendToAll(bot, "away")

		StopTimer()

		w.silence =true

end,

	["fala"]=function()

		Talk(true)

		SetWait(false,false,false)

		w.silence =false

		StartTimer()

		SendToAll(bot, "Back")

		
		end,

}

		if tCmd[cmd] then

			return "cmd",tCmd[cmd]()

		else

			return cmd

		end

	end

end


function ToArrival(user, data)
	if (string.sub(data, 1, string.len(bot)+5 ) == "$To: "..bot ) then
		if user.bOperator then
			if ParseCommands(user, string.sub(data,1, -2), "%$") then
				return 1
			end
		end
	end
end

-- Main Chat events --
function ChatArrival(user, data)
	if  user.bOperator and ParseCommands( user, string.sub(data,1, -2))=="cmd" then return 1 end
	local _,_,msg = string.find( data, "%b<>%s*(.*)|")
	local talked = nil
	msg = string.lower(msg)
	for trig, replace in s.trigs do
		if ( w.quiet == false) then
			if string.find( msg, trig ) then
				talked = (Produce( replace, "%[USER%]", user.sName))	
			end
		end
	end

	-- Restart the timer each time someone is talking on the main chat, if bot is allowed to talk --
	if Talk() then
		local function idleresponce(idle)
			dostuff=Produce( idle, "%[USER%]", user.sName)
			return dostuff
		end		
		StopTimer()
		StartTimer()

		if w.quiet then
			talked = idleresponce(s.idle.answers )
			SetWait(false)	
		elseif 	(w.morn) then
			talked =idleresponce(s.idle.morninganswers)
			SetWait(false,false)
		elseif w.even then 
			talked = idleresponce(s.idle.eveninganswers)
			SetWait(false,false,false)
	
		end
	end
-- To Send A msg after the users "speaks" not b4 --
	if talked and not(w.silence) and not ParseCommands( user, string.sub(data,1, -2)) then

		SendToAll( user.sName, msg)

		SendToAll( bot, talked )

		return 1

	end

function OnTimer()
	local h, trig = tonumber(os.date("%H")), nil
	-- Idle trigs, for the morning, and the evening :o) --
	if h == 7 then
		SendToAll( bot, Produce(s.idle.morning) )
		SetWait(false,true,false)
		StartTimer()
		trig = true
	elseif h == 19 then
		SendToAll( bot, Produce(s.idle.evening) )
		SetWait(false,false,true)
		StartTimer()
		trig = true
	end

	-- Others idle trigs --
	if not trig then
		SendToAll( bot, Produce(s.idle.questions))
		SetWait(true)
	end
end

function Produce( val, what, with )
	if what then
		if type(val) == "table" then
			return string.gsub( val[math.random(1,table.getn(val))], what, with )
		end
		return string.gsub( val, what, with )
	end
	return val[math.random(1,table.getn(val))]
end

function SetWait( q, m, e )
	w.quiet = q --quiet
	w.morn  = m --morning
	w.even  = e --evening
end--------------------------------------------------------------------------------
end


best regards

Loading

Dessamator

#3
--[[
	Thks to Ptaczek for his Trickerbot.lua
	Thks to Skrollster, for the math.random synthax
	Thks to MatrixX for some help, too...
	And thks to the others, for their help... ;o)
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
	seNsi: the 'clever' bot :p
	Description:
	- Each 20 math.min, bot is talking alone, with math.random questions...
	- If someone speaks again on main chat, there is a math.random answer, and then the timer is starting again.
	- If the user says a known trig (ex: 'hey '), and the bot was feeling alone, bot will choose the correct answer 

(ex:'Yessss,...[USER] happy to hear U again,, :))')
	- Sorry for the 'a' synthax (a = 0, a = 1, etc...), but I'm quite nb in lua...
	- Hope u'll enjoy it ! :o)
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
	- heavily touched by Herodes :: 28/3/2005 ( 16.08 compliant too )
	- many optimizations .. couldn't count them .. just enjoy..
	- some fixes by Dessamator
--]]
bot = {
	["name"] = "•Bot-Maluco•™",
	["email"] = "WWW.Marado.com",
	["desc"] = "HA , HA , LOLOLOL ...",
}

Interval = 15 -- every how many minutes ?

s = {}
s.trigs = {
	["inte"] = "inte [USER]",
	["boas"] = "Boas [USER] tudo fixe ? ",
	["lol"] = "Tas-te a rir de ke ????   LOLOL ",
	["sporting"] = "J? vi melhores, o SLB por exemplo....",
	["benfica"] = "O melhor clube do mundo..viva ao glorioso!!!",
	["jantar"] = "hummmm, tb tenho fome, ? pra tua casa q vou... :o)",
        ["raiva"] = "J? existe vacina para isso, sabias????",
        ["Loading"] = "MY Master...... :)",
        ["slots"] = "queres slots????Para que CPU? Existe slot 1, Slot 2, Slot A etc....hehehehe...",
        ["haha"] = "hehehehehe",
        ["xau"] = "XAUZ?o [USER] , a tua falta e dos ficheiros que partilhas ser? sentida.",
        ["dasse"] = "Ent?o [USER]!!!! ''T?s-ta esticar''....? melhor teres tento na lingua!",
        ["adeus"] = "Adeus [USER] , volta sempre !!!!",
        ["boas"] = "Boas [USER], tudo na maior? Queres dar uma????.................Volta?LOLOL",
        ["fdx"] = "Asneiras eh que n?o [USER]...controla-te!!!!",
        ["virus"] = "Afastem essas coisas de mim que sou AL?RGICO !!!!!",
        ["cala-te"] = "Ai sim!? Queres obrigar-me [USER] ??? tu e mais quantos??(hahaha)!",
        ["alguem tem"] = "[USER]...e se usasses a ferramenta do SEARCH ????",
        ["ao hub"] = "Est?s a fazer PUB [USER] ?????? Isso ? muito feio... ",
        ["algum op"] = "Ops??hummm!!!!Deixa-me ver...t?o ali aqueles com uma chavinha la em cima querias ter ne ?? mas n?o tens =P ",
        ["firewall"] = "Bem lembrado [USER] !!!! TODOS VOCES devem usar FIREWALLs (para vossa seguran?a)",
        ["tasse"] = "Tasse [USER] !!!",
        ["come"] = "Kom? [USER] !!! ",
	}

s.idle ={} -- don't touch this line pls .. if you do don't blame it on me ..

s.idle.questions = {
	"Ninguem estah por a? ???!",
	"Toda a gente tah a ferrar ??!",
	"Alguem sabe Algum site de Jogos  ???!",
	"HeeeeeeeeeeeLLLLLLLoooooooooooooo !!! ",
	"Nao me deixem Sozinho.... :'(",
	}

s.idle.answers = {
	"Aaaahh, ''caro'' [USER]... j? me estava a sentir SOZINHO :o)",
	"OHHH,...[USER] tava a ver k me ias ignorar :))",
	"Ahhhhh -----> [URL]www.Megagames.com[/URL]",
	"Onde podemos nos encontrar ?? no palace ???",
	"Isso ? que era bom...mas parece ke ninguem ker!!!",
	}

s.idle.morninganswers = {
	"Wow... [USER]... ou dormiste pouco ou ainda n?o te deitaste.... :p",
	"Yeahh !!! BOM Diiiiiiiiiiiiiiiiiiiiiiiiiiiaaaaaa [USER] !",
	"Sendo assim [USER],...podes fazer um caf? para mim ??!! please... :o)",
        "Ha ???.....ser? possivel dizeres-me como est? o tempo a? fora?!!! (loool)",
	}

s.idle.morning = {
	"RiiiiiiiNG... HORAS de ACORDAR !!! ...:D",
	"BOM DIA a TODOS !!!!!!! , cheira-me que hoje vai ''bombar forte e feio!!!!!!!",
	"Hmm.....Alguem est? acordado ??!!!",
        "Ningu?m diz nada ??? J? ? de manh?.....",
	}

s.idle.evening = {
	"T? na hora de ir beber umas Cervejolas , n?o ??!?",
	"Hum hum... isto t? muito calmo para estas horas....que se passa ppl??!",
	"A estas horas n?o deviam tar a dormir....ACORDEM ppl !!!",
	}

s.idle.eveninganswers = {
	"EU PAGO a 1? RODADA ....depois s?o voc?s !!!!",
	"Estou s? preocupado.....? isso.",
	"Mas...o que se passa...??? Devem estar a sacar algo muito importante.",
	}
---trigs end ---

function Main()
	talk = true
	--frmHub:RegBot(bot.name, 1, bot.desc, bot.email)
	bot = bot.name
	w = { ["quiet"] = false,["morn"] = false,["even"] = false,["silence"]=false, }
	SetTimer(Interval*60000)
	StartTimer()
end

function ParseCommands(user, data, pm_start)
	local findstr = (pm_start or "").."%b<>%s+[!#?+](%S+)"
	local _,_, cmd = string.find ( data, findstr )
	if cmd then
tCmd={
["calado"]=function()
		Talk(false)
		SendToAll(bot, "away")
		StopTimer()
		w.silence =true
end,
	["fala"]=function()
		Talk(true)
		SetWait(false,false,false)
		w.silence =false
		StartTimer()
		SendToAll(bot, "Back")
		
		end,
}
		if tCmd[cmd] then
			return "cmd",tCmd[cmd]()
		else
			return cmd
		end
	end
end

function Talk(b)
	if b then talk = b end
	return talk
end

function ToArrival(user, data)
	if (string.sub(data, 1, string.len(bot)+5 ) == "$To: "..bot ) then
		if user.bOperator then
			if ParseCommands(user, string.sub(data,1, -2), "%$") then
				return 1
			end
		end
	end
end

-- Main Chat events --
function ChatArrival(user, data)
	if  user.bOperator and ParseCommands( user, string.sub(data,1, -2))=="cmd" then return 1 end
	local _,_,msg = string.find( data, "%b<>%s*(.*)|")
	local talked = nil
	msg = string.lower(msg)
	for trig, replace in s.trigs do
		if ( w.silence == false) then
			if string.find( msg, trig ) then
				if trig ==string.lower(bot) then
					talked = Produce( s.idle.BotResponces , "%[USER%]", user.sName)	
				else
					talked = (Produce( replace, "%[USER%]", user.sName))
				end	
			end
		end
	end
	
	-- Restart the timer each time someone is talking on the main chat, if bot is allowed to talk --
	if not(w.silence) then
		if Talk() and not(w.silence) then
			StopTimer()
			StartTimer()
			if w.quiet then
				talked=Produce( s.idle.answers, "%[USER%]", user.sName)
				SetWait(false)	
			elseif 	(w.morn) then
				talked=Produce( s.idle.morninganswers, "%[USER%]", user.sName)
				SetWait(false,false)
			elseif w.even then 
				talked=Produce( s.idle.eveninganswers, "%[USER%]", user.sName)
				SetWait(false,false,false)
			end			
		end

		if talked and not(w.silence) and not ParseCommands( user, string.sub(data,1, -2)) then
			SendToAll( user.sName, msg)
			SendToAll( bot, talked )
			return 1
		end
	end
end


function OnTimer()
	local h, trig = tonumber(os.date("%H")), nil
	-- Idle trigs, for the morning, and the evening :o) --
	if h == 7 then
		SendToAll( bot, Produce(s.idle.morning) )
		SetWait(false,true,false)
		StartTimer()
		trig = true
	elseif h == 19 then
		SendToAll( bot, Produce(s.idle.evening) )
		SetWait(false,false,true)
		StartTimer()
		trig = true
	end

	-- Others idle trigs --
	if not trig then
		SendToAll( bot, Produce(s.idle.questions))
		SetWait(true)
	end
end

function Produce( val, what, with )
	if what then
		if type(val) == "table" then
			return string.gsub( val[math.random(1,table.getn(val))], what, with )
		end
		return string.gsub( val, what, with )
	end
	return val[math.random(1,table.getn(val))]
end

function SetWait( q, m, e )
	w.quiet = q --quiet
	w.morn  = m --morning
	w.even  = e --evening
end--------------------------------------------------------------------------------


done!
Ignorance is Bliss.

Loading

thanks dessamator for your time

it works fine now

your great... :]


best regards


Loading

Loading

hi
is a litle problem

don't show the botname in the user list

but the script works fine

best regards

Loading

Dessamator

change this :

--frmHub:RegBot(bot.name, 1, bot.desc, bot.email)


to this
frmHub:RegBot(bot.name, 1, bot.desc, bot.email)
Ignorance is Bliss.

Loading

tanks man
works fine
 ;)

Dessamator

Ignorance is Bliss.

Loading

hi

tanks for your hel hith the script but i find a litle bug

when i run the command !calado ( shut up the bot )

the triggers stop but the questions and the awnshers dont't stop can you fix to stop the timer ?

the script don't give me any error messages in ptokax just don't stop the timer


Best Regards

Loading

Dessamator

Fixed , post edited.
Ignorance is Bliss.

Loading

tanks man
i will test it

best regards

Loading

Loading

thanks man

it works in perfect conditions


 ;)


best regards


 Loading

Dessamator

Ignorance is Bliss.

SMF spam blocked by CleanTalk