-- JokeBot .lua by Cloud -- Some more content by [ANCIENT]Klismo :P -- Edited by Phatty for -mr-bill- -- Double timer by klownietklowniet [30-09-2003] -- ReAdded on command by phatty -- On/Off switch by phatty botname = "JokeBot" Botstatus=0 sec = 1000 min = 60 * sec hour = 60 * min TimeSpanInMinutes = 1 QuestionTimeInSec = 5 Command = "+Joke" Command2 = "+shush" Command3 = "+tell" which = "q" -- start with a question jokes = { "How can you tell if a blonde has been using the computer?", "Why is it okay for blondes to catch cold?", "Did you hear about the blonde who tried to blow up her husband's car?", } answers = { "The joystick is wet.", "They don't have to worry about blowing their brains out.", "She burned her lips on the tailpipe.", } function Main() frmHub:RegBot(botname) SetTimer(TimeSpanInMinutes*min) StartTimer() end function OnTimer() if Botstatus==1 then return 1 else if which == "q" then local number = random(1,getn(jokes)) local Joke = jokes[number] SendToAll(botname, Joke) which = tostring(number) SetTimer(QuestionTimeInSec*sec) else local Answer = answers[tonumber(which)] SendToAll(botname, Answer) which = "q" SetTimer(TimeSpanInMinutes*min) end end end function DataArrival(user, data) if (strsub(data, 1, 1) == "<") or ( strsub(data, 1, 4) == "$To:" ) then data = strsub(data,1,strlen(data)-1) if (strfind(strlower(data), strlower(Command))) then OnTimer() elseif (strfind(strlower(data), strlower(Command2))) then SendToAll(botname, "Joke bot is switched off") Botstatus=1 return 1 elseif (strfind(strlower(data), strlower(Command3))) then SendToAll(botname, "Joke bot is switched on") Botstatus=0 return 1 end end end