PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: patamon90 on 27 November, 2004, 17:28:32

Title: Auto chat bot.
Post by: patamon90 on 27 November, 2004, 17:28:32
Hello, I want this script( or bot ;) ):
--Random Chat 1.0
--by Mutor The Ugly  10/20/04
--Request by patamon90
--
--Sends random messages to main on timer.
--
--User Settings-------------------------------------------------------------------------------------
Bot = frmHub:GetHubBotName() -- Name for bot, pulled from the hub
Mins = 60 -- Interval [in minutes] between announcements.
CommOn = "+rant" -- Start the script.
CommOff = "+hush" -- Stop the script.
StartOn = "1" -- Start script on or off  ["1"=on "0"=off].
--
--
--What Should this bot say in main chat?
Echoes = {
"Help I've fallen and I...   ...hey nice carpet.",
"Don't forget to register your self to the hub, then evil persons wont take your name =P.\r\n Just write +regme  here in main, and it's done! should be your own password, don't tell it to someone!",
"Hey! Do you wanna add this hub to your favorite hubs and join it everytime you start your Direct Connect client?\r\n Just write /fav or /favorite here in main!",
"Yeah, this hubs really rocks hard!",
"Hey, tell your friends to come here, and then we will be bigger, better and You will get more search hits.",
"Search for games before you ask for them, and if you have searched,\r\n Go into other hubs and search, you will find the game some time..",
"Try this cool command: +network\r\n It will let you see our other cool hubs in Network Gaming Heaven.",
"Do you got a Gaming hub and want to join Network Gaming Heaven?\r\n Then speak to [RooT]Shadow and he will decide it with our other operators!",
"You got any cool script that you want the best hub in the world want to use?\r\n Just send a cute little PM to [RooT]Shadow and he will try the script in da hub!",
"You see a scammer in this hub? Then just report him! (Send a PM to [RooT]Shadow and he will help you)",
"Have you looked at our cool homepage? If you haven't you've done a big mistake =)\r\n Well, here is the adress anyway =)  http://xb-heaven.no-ip.info/  take a quick watch anyway. =)",
}
--End User Settings----------------------------------------------------------------------------------

function Main()
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
end

function DataArrival(user, data)
s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
if (cmd==CommOn) and user.bOperator then
user:SendData(Bot,"\r\n\r\n\t--<< [ Random Chat Started ] >>--   Timer Settings = "..Mins.." minutes. \r\n\tType '"..CommOff.."' to stop script.\r\n\r\n")
StartTimer()
return 1
elseif (cmd==CommOff) and user.bOperator then
StopTimer()  
user:SendData(Bot,"\r\n\r\n\t--<< [ Random Chat Stopped ] >>--   Script has been stopped. Type '"..CommOn.."' to start script.\r\n\r\n")
return 1
end
end

function OnTimer()
local RandomChat = Echoes[random(1, getn(Echoes))]
SendToAll(Bot,"\r\n\r\n\t"..RandomChat.."\r\n")
end


To say anything when it has been quiet in the hub for one hour. Example:
Quote[14:10] well, then I have to go, bye bye all =)
[15:10] blablabla.. this is an auto text when the hub is dead =P
[15:23] I'm back.. and nobody cares =D
[16:23] me again =)  speak you fools =D

Thanks and I hope this is able to fix =)
Title:
Post by: patamon90 on 01 December, 2004, 13:30:52
please.. anyone?