Is this possible? Help me!
 

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

Is this possible? Help me!

Started by JH:The:king, 13 February, 2004, 23:23:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JH:The:king

I found this great bot but i wanna make it yet better. But the problem is, that i dont know much about lua scripting... so maybe you gonna help me...

I can't find the original TrickerBot.lua...

I need one action more to this script. It comes here:
Multiple anwers for a known trig...
i dont know is it possible but i have ask u...

Please answer me

----------------------------------------------------
-- code:

-- Thks to Ptaczek for his TrickerBot.lua
-- Thks to Skrollster, for the random synthax (http://lua.bcs-solutions.de/thread.php?threadid=291&boardid=15&sid=d4de5272887ab85292a4078fa73ba6be)
-- Thks to MatrixX for some help, too... (http://lua.bcs-solutions.de/thread.php?threadid=3&boardid=7&sid=6541fa822c277b66330f5bc1f409f4cc&page=2)
-- And thks to the others, for their help... ;o)
----------------------------------------------------------------
-- seNsi: the 'clever' Bot :p
-- Description:
-- Each 20 min, Bot is talking alone, with random questions...
-- If someone speaks again on main chat, there is a 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)
----------------------------------------------------------------

Bot = "Wiseguy"


trigs = {
bye="See ya [USER]",
["fine u"]="I am lame... ",  
["need some"]="Hum... maybe pray for it...",
["loool"]="Yeah, [USER] ! It was really funny...",
["its fine"]="good...",
["take care"]="U 2... :o)"
}

idlequestions = {
"Anybody here?",
"I.am Boored",  
"All are sleeping ?!",
"Haaaaaaaaloooooooooo !!! ",
"Don't leave me alone.... :'(",
}

idleanswers = {
"Aaaahh, dear [USER]... i was feeling quite alone.... :o)",
"Yessss,...[USER] happy to hear U again,, :))",
"Sorry to disturb u, [USER], but i was quite upset... :s ",
"Thks, [USER]... i thought something was wrong with ur keyboard...",
"OOhhh, [USER]... i'm not alone at this universe... :))"
}

idlemorninganswers = {
"Wow... [USER]... ur night was certainly short.... :p",
"Yeahh !!! GOOOOOD MORNIIIIIIIIIING [USER] !",
"So, [USER],...coffee for me please, yep... :o)"
}

idlemorning = {
"Driiiiiiing... Time to Wake Uuuuuuuuuuup !! :D",
"GOOOOOD MORNIIIIIIIIIING HUBSTERRRRRRRRRRRRRS !!!!!!!",
"Hmm.....Someone is awake ??!!"
}

idleevening = {
"Time to have a drink, no ? :o)",
"Hum hum... place is really quiet, at this time... :'(",
"At this time, u shouldn't sleep... :-("
}

idleeveninganswers = {
"Well, at least... Some of us are still alive,... cool :D",
"I was upset,... that's all... :(",
"It's time...If u offer me a drink... i couldn't say no.... :p"
}

sec = 1000
min = 60 * sec
hour = 60 * min

index = nil

function Main()
quiet = "false"
talk = "allow"
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
SetTimer(30*min)
StartTimer()
frmHub:RegBot(botname)
end

function DataArrival(user, data)

-- Pm events --

if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (user.bOperator) then

if (cmd=="!quiet") then
quiet = "true"
talk = "notallow"
StopTimer()
user:SendPM(botname,"Ok,...I'll be quiet now... :s")
end

if (cmd=="!talk") then
talk = "allow"
quiet = "false"
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
StartTimer()
user:SendPM(botname, "Ahh... i'm back :)")
end
end
end
end

-- Main Chat events --

if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)

s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
s,e,mess = strfind(data, "%b<> ([%w ]*)")

-- Trigs Answers --

for key, value in trigs do

-- Answer to mess command if bot is allowed to speak --

if mess or cmd and talk == "allow" then

-- Answer to the trig, with 1 trig response, if bot wasn't quiet since a while --

if WaitingForAnswerAfterQuiet == "false" then
if( strfind( strlower(mess), key) ) or ( strfind( strlower(cmd), key) ) then
answer, x = gsub(value, "%b[]", user.sName)
SendToAll(Bot, answer )
break
end
end
end

end

-- Restart the timer each time someone is talking on the main chat, if bot is allowed to talk --


if mess or cmd then
if talk == "allow" then

if iscommand(cmd) or iscommand(mess) then
else
StopTimer()
StartTimer()
end
end
end

-- Quiet the bot (ops command) --

if (cmd=="!quiet") then
if user.bOperator then
quiet = "true"
talk = "notallow"
SendToAll(Bot, "Ok,...I'll be quiet now... :s")
StopTimer()
else

-- Answer if a user try to use the command !quiet and if it is allowed to talk - then, check if the bot was quiet or not before --

if talk == "allow" and WaitingForAnswerAfterQuiet == "false" then
SendToAll(Bot, "hum...hum...")
end
end
end

-- Allow the bot to talk (ops command) --

if (cmd=="!talk") then
if user.bOperator then
talk = "allow"
quiet = "false"
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
StartTimer()
SendToAll(Bot, "Ahh... i'm back :)")
else

-- Answer if a user try to use the command !talk and if it is allowed to talk - then, check if the bot was quiet or not before --

if talk == "allow" and WaitingForAnswerAfterQuiet == "false" then
SendToAll(Bot, "hum...")
end
end
end

-- Receiving entries on the main chat --

if cmd or mess then
if talk == "allow" then

-- Morning Answer --
if WaitingForAnswerMorning == "true" then

-- Ignore the line commands begining with '+'/'!'/'#'/'?'. Bot won't replye - nicest, i think... :o) --

if iscommand(cmd) or iscommand(mess) then
else

-- Answer to chat entries --
index = random(1,getn(idlemorninganswers))
answer, x = gsub(idlemorninganswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
end
end

-- Evening Answer --
if WaitingForAnswerEvening == "true" then

-- Ignore the line commands begining with '+'/'!'/'#'/'?'. Bot won't replye - nicest, i think... :o) --

if iscommand(cmd) or iscommand(mess) then
else

-- Answer to chat entries --
index = random(1,getn(idleeveninganswers))
answer, x = gsub(idleeveninganswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
end
end

-- Answer after the bot was too quiet --

if WaitingForAnswerAfterQuiet == "true" then

-- Ignore the line commands begining with '+'/'!'/'#'/'?'. Bot won't replye - nicest, i think... :o) --

if iscommand(cmd) or iscommand(mess) then
else

-- Answer to chat entries --
index = random(1,getn(idleanswers))
answer, x = gsub(idleanswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
end
end
end
end
end

end

function OnTimer()
time()
trig = "notdone"

-- Idle trigs, for the morning, and the evening :o) --

if H=="07" then
index = random(1,getn(idlemorning))
SendToAll(Bot, idlemorning[index])
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "true"
WaitingForAnswerEvening = "false"
StartTimer()
trig = "done"
end

if H=="19" then
index = random(1,getn(idleevening))
SendToAll(Bot, idleevening[index])
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "true"
StartTimer()
trig = "done"
end

-- Others idle trigs --

if trig == "notdone" then
index = random(1,getn(idlequestions))
SendToAll(Bot, idlequestions[index])
WaitingForAnswerAfterQuiet = "true"
end
end

-- Get Time --

function time()
S = date("%S")
H = date("%H")
M = date("%M")
D = date("%d")
MM = date("%m")
Y = date("%y")
return H
end

function iscommand(str)
return strsub(str, 1, 1) == "!" or strsub(str, 1, 1) == "?" or strsub(str, 1, 1) == "+" or strsub(str, 1, 1) == "#"
end
------------------------------------------------------------------------

Troubadour

to use triggers with random answers use it like this.

trigs = {
                hehe={
     "BWahaha, [CURUSER] das lache,  Hahahaha.",
     "Huh! [CURUSER]  waar lach je om?",
     "Als jij lacht, gaat heel mijn beeldscherm heen en weer!",
     "hehehehe",
     "hohohohoh"
                                 },

         haha={
     "BWahaha, [CURUSER] das lache,  Hahahaha.",
     "Huh! [CURUSER]  waar lach je om?",
     "Als jij lacht, gaat heel mijn beeldscherm heen en weer!",
     "hehehehe",
     "hohohohoh"
                                 },
                                   
         lmao={
     "BWahaha, [CURUSER] das lache,  Hahahaha.",
     "Huh! [CURUSER]  waar lach je om?",
     "Als jij lacht, gaat heel mijn beeldscherm heen en weer!",
     "hehehehe",
     "hohohohoh"
                                 }, }


Good luck

-Troubadour-
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

JH:The:king

Thanks for your help, i hope it works!

JH:The:king

#3
i can't get it to work. maybe i'm too stupid for this but...
now it doesn't say anything anymore

Costalfs

Where can I get this bot with triggers? It's almost impossible to find it anywhere. Specially for a newbie like me ;) Does anybody have a link for it?
Thanks

Costalfs

ops. :) Forget it. Just found the thing. Thanks anyway :)
Cya

SMF spam blocked by CleanTalk