--Random Chat 1.0b
--by Mutor The Ugly 10/20/04
--Request by patamon90
--
--Sends random messages to main on timer.
--
--This version allows for custom botname
--
--Converted to lua 5 By Madman 03/03/05
--Added some text's
--User Settings-------------------------------------------------------------------------------------
Bot = "Chatter" -- Name for bot
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.",
"24 hours in a day ... 24 beers in a case ... coincidence?",
"Multitasking : Screwing up several things at once.",
"The reason talk is cheap is that supply exceeds demand.",
"Support bacteria - they're the only culture some people have.",
"BE ALERT! ...The world needs more lerts.",
"Shin: a device for finding furniture in the dark",
"Nothing is fool-proof to a sufficiently talented fool.",
"If ignorance is bliss, you must be orgasmic.",
"Stealth means never having to say you're sorry.",
"Subliminal Message: Send Mutor all your money...",
"Woohoo!",
"Some time passed by",
"Look I'm flying",
"I'm never on time",
"I am Bored",
"Is everybody sleeping?!",
"Haaaaaaaaloooooooooo !!! ",
"I rock!!!",
"Wow... look at all the pink cows",
"Can computers swim?",
"Ahhh! A flying Mongo!",
"I'm gonna start a company called MicroHard, and specialize on doing buggy programs...",
"I am a real person!",
"HeHe HaHa HoHo HiHi",
"Bots suck!",
"I am not a bot, I am a real human!",
"I may be dumb, but I am not a bot!",
"I may be really confused, but I am no robot!",
"Kill the bots!",
"sniiiiiifffffff",
"Whehhwewe! pretty elephants!",
"Swedish is just a synonym for Weird",
"Unfortunately, no one can be....told what The FunScript is...you have to see it for yourself.",
"'' Buckle your seatbelt Dorothy, because Kansas is about to go bye-bye. ''",
"Welcome...to the real world.",
"Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.",
"Go0d spjeling is neded, it maeks the tjexs more raedalbe",
"Yeeehhaaaaa!!",
"I'm gonna start a company called MicroHard, and specialize on doing buggy programs...Wait... MicroSoft is allready doing that..."
}
--End User Settings----------------------------------------------------------------------------------
function Main()
frmHub:RegBot(Bot)
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
end
function ChatArrival(user, data)
s,e,cmd = string.find(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[math.random(1, table.getn(Echoes))]
SendToAll(Bot,"\r\n\r\n\t"..RandomChat.."\r\n")
end
Hi, Im getting An Error on Line 21 ......
Echoes = {
Could You Tell Me What Im Doing Wong.....??
Thanx In Advance
Kool Script
QuoteOriginally posted by m?r?h3??
Hi, Im getting An Error on Line 21 ......
Echoes = {
Could You Tell Me What Im Doing Wong.....??
Thanx In Advance
Kool Script
nope... not untill u show me the error... i dont get any erro at all....
Great script :) i was wondering if u can make it so it picks out random users names and uses them in some sentences.. so it random chats to random users :P can u do this? I think the users like to see their name in the sentences :P be grateful if u can ;)
oh this scripts works perfect for me :D :D
thx :P
Give this a try...
After restarting script, you need to reconnet...
else you will get an error about random inteval is empty..
hmm... bord cant handle some ascii signs... changed your nick to normal leters... ;)
--Random Chat 1.0b
--by Mutor The Ugly 10/20/04
--Request by patamon90
--
--Sends random messages to main on timer.
--
--This version allows for custom botname
--
--Converted to lua 5 By Madman 03/03/05
--Added some text's
-- Added Random name, request by HellsLittleAngel
-- RandName function copyed from StabBot by ?ottledHat?
--User Settings-------------------------------------------------------------------------------------
Bot = "Chatter" -- Name for bot
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?
-- How to use the random function:
-- "Some text [random] some text",
Echoes = {
"Help I've fallen and I... ...hey nice carpet.",
"24 hours in a day ... 24 beers in a case ... coincidence?",
"Multitasking : Screwing up several things at once.",
"The reason talk is cheap is that supply exceeds demand.",
"Support bacteria - they're the only culture some people have.",
"BE ALERT! ...The world needs more lerts.",
"Shin: a device for finding furniture in the dark",
"Nothing is fool-proof to a sufficiently talented fool.",
"If ignorance is bliss, you must be orgasmic.",
"Stealth means never having to say you're sorry.",
"Subliminal Message: Send Mutor all your money...",
"Woohoo!",
"Some time passed by",
"Look I'm flying",
"I'm never on time",
"I am Bored",
"Is everybody sleeping?!",
"Haaaaaaaaloooooooooo !!! ",
"I rock!!!",
"Wow... look at all the pink cows",
"Can computers swim?",
"Ahhh! A flying Mongo!",
"I'm gonna start a company called MicroHard, and specialize on doing buggy programs...",
"I am a real person!",
"HeHe HaHa HoHo HiHi",
"Bots suck!",
"I am not a bot, I am a real human!",
"I may be dumb, but I am not a bot!",
"I may be really confused, but I am no robot!",
"Kill the bots!",
"sniiiiiifffffff",
"Whehhwewe! pretty elephants!",
"Swedish is just a synonym for Weird",
"Unfortunately, no one can be....told what The FunScript is...you have to see it for yourself.",
"'' Buckle your seatbelt Dorothy, because Kansas is about to go bye-bye. ''",
"Welcome...to the real world.",
"Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.",
"Go0d spjeling is neded, it maeks the tjexs more raedalbe",
"Yeeehhaaaaa!!",
"I'm gonna start a company called MicroHard, and specialize on doing buggy programs...Wait... MicroSoft is allready doing that...",
}
--End User Settings----------------------------------------------------------------------------------
function Main()
frmHub:RegBot(Bot)
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
oUsers = {}
oUsers[Bot] = 1
for nr,Nick in frmHub:GetOnlineUsers() do
oUsers[Nick.sName] = 1
end
end
function ChatArrival(user, data)
s,e,cmd = string.find(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 = string.gsub(Echoes[math.random(1, table.getn(Echoes))], "%[random%]", randmName())
SendToAll(Bot,"\r\n\r\n\t"..RandomChat.."\r\n")
end
function OpConnected(user)
oUsers[user.sName] = 1
end
NewUserConnected = OpConnected
function OpDisconnected(user)
oUsers[user.sName] = nil
end
UserDisconnected = OpDisconnected
function randmName()
local n = 0
for k,v in oUsers do n=n+1 end
n = math.random( n )
for k,v in oUsers do
if n == 1 then
return k
end
n = n - 1
end
end
Thank you Yes its working ok but i dont see any users names in the sentences..Id like it to say these sentences to random users.. :P
this error
HUB\scripts\random chat and names.lua:102: attempt to index global `user' (a nil value)
a little example of wot i mean
if the bot says this "If ignorance is bliss, you must be orgasmic"
i want it to say "If ignorance is bliss [username] you must be orgasmic.. :P :P
change
function OpDisconnected(curUser)
oUsers[user.sName] = nil
end
tofunction OpDisconnected(user)
oUsers[user.sName] = nil
end
That fixes the error...
as for the username...
i didnt write any msg...you have to add the your self...
for example
"If ignorance is bliss, you must be orgasmic",
could be changed to
"If ignorance is bliss [random], you must be orgasmic",
and you will get what you want... =)
Ok i'll go make some sentences and see how i get on :P :P thank u MaD ;)
Ok i did wot u said this is my sentence
" I've come across decomposed bodies that are less offensive than you are [random].",
and i have this error
HUB\scripts\random chat and names TEST.lua:72: bad argument #1 to `random' (interval is empty)
Did i do it wrong?:p
you dindnt reconnect after restart.. i'll figer out a way to avoid that error...
okey... got it....
function Main()
frmHub:RegBot(Bot)
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
oUsers = {}
[color=red] oUsers[Bot] = 1[/color]
end
Just ad the red line.. and it MUST be after the oUsers = {} line...
I updated the script i posted...
Thank u for makin time to help me out Greatly appreciated :] :] :]
and i await in the wings while u *figure* :P :P :P
He he he he its using the bot name look:-
<']['- ??r?> It's hard to get the big picture ']['- ??r? when i have such a small screen.
<']['- ??r?> i've only got one nerve left ']['- ??r?, and you're getting on it.
When i did it the way u told me to *The reconnect after* it only uses my nick...
[14:44:14]
text TheOne text TheOne
[14:44:15]
text TheOne text TheOne
[14:44:16]
text TheOne text TheOne
[14:44:17]
text Madman text Madman
[14:44:18]
text TheOne text TheOne
[14:44:19]
text Madman text Madman
[14:44:20]
text TheOne text TheOne
[14:44:21]
text Madman text Madman
[14:44:22]
text Chatter text Chatter
[14:44:23]
text TheOne text TheOne
[14:44:24]
text Chatter text Chatter
Only yours? I get the bot's nick and the thoose who reconnects after...
Hehe... got an idea.... =) why reconnet....
When ptokax kan get all online users for us
Edited my script above...
The new main function looks like this...
function Main()
frmHub:RegBot(Bot)
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
oUsers = {}
oUsers[Bot] = 1
for nr,Nick in frmHub:GetOnlineUsers() do
oUsers[Nick.sName] = 1
end
end
Thank u so much for that YES its working perfectly..i changed the sentences to insults
<']['- ??r?> Hey! [NO]Rankor, your as useless as rubber lips on a woodpecker..... :P :P
i think the users will hate me now MUAHAHAHAHAHA
And keep learning ;)
Great =)
last question :P wot should i change the timer to its a little too fast :P :P
1 hour is to fast?
Mins = 60-- Interval [in minutes] between announcements.
change it to 120 then.. 2 hours...
Yeah it was running really fast but its ok now
Thanks a million ;)
xxx
I got another question about the random chat bot :P Ive been trying to set it up just with random words to see if it will trigger another bot but i had no luck :( so now i have been trying it with 2 tricker bots but still no luck i just dont think i know how :( can it be done? and can i have some help on this plz if its not too much trouble :P :P
Thx
Im sure i would if i knew how im still learning, well trying to anyway :)) but thank u Mutor for ur reply :P
OK here goes i'll try to explain best i can.. I have changed ur random chat bot sayings to Single words so that it may trigger the other bot to a conversation and id like the 2 tricker bots to talk to each other (well thats my plan LOL) I know it works when i link 2 hubs together (thru the link) cause ive tried it but i cant get it to trigger in the hub. Ur bot is the trigger, then i have 2 tricker bots heres an example of the tricker bot i want to use..
--LUA 5 conversion
botname = "?K???kl?"
trigall=1
trigs = {
["knuckles u ok"]={
"yeah im great apart from the weather hows it where u are?",
"yeah nice and sunny hunny no rain"
},
["on"]={
"Woooooooooohoooooo someone turned us on EXCELLENT so how ya doin chuckles u ok?",
"Yesssssssss we're switched on LETS CAUSE RIOTS chuckles u ok mate?"
},
["cuppa"]={
"Yum i think i'll go make a cuppa too",
"MMmm make me one plz :p",
" I could just do with a cuppa OK WHOS MAKING IT [CURUSER]"
},
["thank u"]={
"ur welcome Hunni",
"Anytime babe"
},
["thank you"]={
"ur welcome Hunni",
"Anytime babe"
},
fun={
"WOOHOOO funs my middle name HAHAHHAHAHHAHHA",
"dont ya just love lots a fun [CURUSER]",
"Yeah FUN sounds good got anything planned? :)"
},
["shut it"]={
"Make me!",
"Ooh! [CURUSER] I'm wounded!",
"I'll shut up when I damn well please",
"And that will be rite!!!!",
"Oh Piss Off and stop bugging me..",
"blah blah blah!",
"Why should I?"
},
weather={
"weather has been great here for now :)",
"weathers not so good today [CURUSER] :( ",
"Oh [CURUSER] its chuckin it down here!! ",
"well i havent seen the sun yet heres hoping eh..:)) "
},
}
function ChatArrival(curUser, data)
status=string.sub(data,1,string.len(data)-1)
-- parse the command
s,e,cmd = string.find( status, "%b<>%s+(%S+)" )
if (cmd=="+quiet") then
trigall=0
SendToAll(botname, " Hmf, Ok ok i'll shut up then.. :(( ")
return 1
elseif (cmd=="+talk") then
trigall=1
SendToAll(botname, " Okay, I will talk to you again :-)")
return 1
end
s,e,msg = string.find(data, "%b<>%s+(.+)")
if trigall==1 then
for key, value in trigs do
for key2, value2 in value do
if( string.find( string.lower(msg), key) ) then
else break
end
if( string.find( string.lower(msg), "!me") ) then
t="**"..curUser.sName
data=string.gsub (msg, "!me", t, 1 )
end
SendToAll( data )
SetTimer(1800)
StartTimer()
answer, x = string.gsub(value[math.random(1,table.getn(value))], "%b[]", curUser.sName)
return 1;
end
end
end
end
function OnTimer()
SendToAll( botname, answer )
StopTimer()
end
in ur script i made the random words and questions so they would trigger this bot in turn will trigger another and they would chat. i want Ur random chat bot to start the chat if it says "on". I hope you can understand wot i mean 1 bot is knuckles the other is chuckles loool and ur bot starts them chatting
heres hoping :p
Why is it that I get a linebreak after the bot's name before the sentence? Like this:
[09:39]
Hvem sitter inne i vaskemaskinen og alltid stjeler den ene sokken...?
I would like it to say the sentence on the same line the nick are...
Sorry, for newbie question, but thats what I am... New....
EDIT: I figured it out :)
Trond