need a hand with bots answering when someone talks to it

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

jasonrhl
Posts: 5
Joined: 2004-04-12 23:23

need a hand with bots answering when someone talks to it

Post by jasonrhl » 2004-04-12 23:30

Code: Select all

--//UserHelperBot Concept by �V×JÜÑK�é, with lots of help from RabbidWombat who helped keep the concats out and all the scopedness under control!!Please leave All his explanations in script if sharing it out so that newbies can learn.

botname = "-Radio Announcer"

trigs = {-- Edit this line Senwa

["+mostreq"]="   Adelaide 20002 most requested  ",


["+radio"]="   Ask Senny what is playing  ",

["+radiohelp"]=" FORTUNE FADED HUB RADIO a WINAMP radio station , DJ, SenWa Say Wa $$  www.winamp.com                                                                                 CTRL L, put (address) in the address wait, then you hear it ",                           
 
["+2dc"]="that is because of a bug in ne modus dc that happens when you close dc. it stays running in the background on your pc, still connected to hub. then when you open a new client it renames you and logs you in with a number added to your nick. to fix this, press control alt delete ONCE and wait a second. the list of running apps will appear showing two instances of direct connect. then choose direct connect and click END TASK"} tUsers = { n = 0 };

function Main()
frmHub:RegBot(botname);
SetTimer(1800);
StartTimer();
end

function NewUserConnected(curUser)
curUser:SendPM(botname, "Hello Im the user help bot. The following commands are available to you - +dchelp If you need help getting DC to work. Type +iphelp If you need help seeing your own ip address. Type +vidhelp If you need help getting a movie file to play or convert format. Type +findhelp If you need help finding a certain file on dc. Type +hubhelp If you need help running hub software. Type +2dc If there are two dc's running in hub with your nick having a number added to one of them. Type commands into main chat. bot reply can only be seen by you.")
end
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
-- get the msg only using regular expression
local s,e,msg = strfind(data, "%b<>%s+([^|%s]+)");
-- modified search pattern so it only gets the first word
-- this way msg will be nil on regular conversation which will
-- limit the number of time Lua checks the table
-- since it appears that you are using this trigger method as
-- a help bot, you don't need the nested for loops
if(msg and trigs[msg]) then
SendToAll( data ) -- send the original data
StartTimer();
-- You also don't need gsub because you do not use any [ ]
tinsert(tUsers, { curUser.sName, trigs[msg] });
-- What if several users send the message with 1.8 seconds?
return 1; -- tell the hub we have processed the data
end
end
end
function OnTimer()
local userMsg = tremove(tUsers);
while(userMsg) do
SendToNick(userMsg[1], "<"..botname.."> "..userMsg[2]);
userMsg = tremove(tUsers);
end
StopTimer();
end



hope some one can help. I want to edit what it says to people but it doesnt work at the moment :(
thanks for every who has ever helped

jasonrhl
Posts: 5
Joined: 2004-04-12 23:23

for those interested this one works :D

Post by jasonrhl » 2004-04-16 04:15

Code: Select all

-- TrickerBot by Ptaczek 
-- Random syntax by Skrollster
-- Based on SeNsI Bot by Guibs(if I understood correct)
-- Modifyed a bit(as always lame) by piglja - 14/03/03
--small edit to make his own jasonrhl 14-04-04

--- you can edit botname

Bot = "chatter [bot]"

--- you can edit triggers

trigs = {

goodnight="Sleep Well [USER]",
setup="[USER] Download or run Winamp www.winamp.com. press Ctrl+L and put  in the address field hit ok and listen to our funky bootleg beats",
kazaa="why the hell are u talking about that stupid prog [USER], you ******* ******",
porn="there is no porn aloud in here [USER], just remember that other rules you will find with !reghow !!!",
radio="Tune into FortuneFaded radio --- address--- ",
cya="  Cya!  ",
bye="See you soon, Dj Senwa rockin da house ",



---- only edit here if you know what you are doing lol

}

idlequestions = {
}

idleanswers = {
}

sec = 1000
min = 60 * sec
hour = 60 * min
index = nil
function Main()
a = 0
SetTimer(0*min)
StartTimer()
end

function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
-- get the msg only using regular expression
data=strsub(data,1,strlen(data)-1)
-- parse the command
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
s,e,mess = strfind(data, "%b<> ([%w ]*)")
local nick = user.sName
if (cmd=="+go") then
if user.bOperator then
a = 3
SendToAll(nick,"+go")
SendToAll(Bot, "I Shall Now go get some new Games !!!.")
StopTimer()
return 1
else
if a == 1 or a == 2 then
SendToAll(Bot, "rolling...hum...hum...")
a = 0
end
end
end
if (cmd=="+talk") then
if user.bOperator then
a = 2
SendToAll(nick,"+talk")
SendToAll(Bot, "Why Do You call me from the shop?")
return 1
else
if a == 1 or a == 2 then
SendToAll(Bot, "hum...here now ....wasup ?")
a = 0
end
end
end
-- look in the table
for key, value in trigs do
if mess and a == 0 or a == 2 then
if( strfind( strlower(mess), key) ) then
answer, x = gsub(value, "%b[]", user.sName)
SendToAll(nick,""..mess.."")
SendToAll(Bot, answer )
return 1
end
end
end
if cmd and a == 1 then
if (cmd=="+go") or (cmd=="+talk") then
else
index = random(1,getn(idleanswers))
answer, x = gsub(idleanswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
a = 0
end
else
if a == 2 then
StartTimer()
end
end
end
end

function OnTimer()
index = random(1,getn(idlequestions))
SendToAll(Bot, idlequestions[index])
a=1
end
thanks for every who has ever helped

Todi
Forum Moderator
Posts: 699
Joined: 2003-03-04 17:16

Post by Todi » 2004-04-16 05:03

Please use the

Code: Select all

[code][/code]

tag when posting scripts. Was there an actual question anywhere?

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 07:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2004-04-16 05:11

I canged them for him now.

jasonrhl
Posts: 5
Joined: 2004-04-12 23:23

Post by jasonrhl » 2004-04-16 05:44

Oh sorry. I understands now.

The question was why dont the first posted bot not work.

But then I found another that worked and thought people may like that.

If you want to delete the whole post do so. Im happy now

BTW how do I delete my own posts?
thanks for every who has ever helped

Who is online

Users browsing this forum: Google [Bot] and 0 guests