PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Light on 02 August, 2005, 15:35:17

Title: Talkbot ....
Post by: Light on 02 August, 2005, 15:35:17
can some one convert this to lua 5..?



botname = "Bot"

trigall=1

trigs = {
             tra lja lja={"topolja"}
}

function Main()
frmHub:RegBot(botname)
end

function DataArrival(curUser, data)

status=strsub(data,1,strlen(data)-1)
-- parse the command
s,e,cmd = strfind( status, "%b<>%s+(%S+)" )

if (cmd=="!molchi") then
trigall=0
SendToAll(botname, " Hmf, Okidoki I will be quiet :(( ")
return 1
elseif (cmd=="!nemolchi") then
trigall=1
SendToAll(botname, " Okay, I will talk to you again :-)")
return 1
end

       
   if( strsub(data, 1, 1) == "<" ) then
      -- get the msg only using regular expression
      s,e,msg = strfind(data, "%b<>([%a ]+)")                                        
      -- look in the table
                if trigall==1 then
      for key, value in trigs do
                for key2, value2 in value do
                     
   if( strfind( strlower(msg), key) ) then
                 else break  
   end

        if( strfind( strlower(msg), "!me") ) then
                  t="**"..curUser.sName
                  data=gsub (msg, "!me", t, 1 )
   end

      SendToAll( data ) -- send the original data
                   
            SetTimer(8000)
                  StartTimer()
      answer, x = gsub(value[random(1,getn(value))], "%b[]", curUser.sName)

   return 1; -- tell the hub we have processed the data
   end
   end  
   end
end

function OnTimer()
   SendToAll( botname, answer ) -- send bot's answer
   StopTimer()
end
end


ths..)
Title:
Post by: Dessamator on 02 August, 2005, 17:20:24
it has already been done, search the forum
Title:
Post by: Light on 02 August, 2005, 17:45:02
yes, i found 2 bots but it's others then thet...
Title:
Post by: Madman on 02 August, 2005, 17:53:02
http://board.univ-angers.fr/thread.php?threadid=4628&boardid=12&sid=e7541ef6d0649d6b625c76b7a1e6ab22

This one then....
Title:
Post by: Light on 02 August, 2005, 19:57:49
thanks)
Title:
Post by: Light on 02 August, 2005, 20:05:26
thet bot wery fast write answers..
Title:
Post by: Dessamator on 02 August, 2005, 21:42:34
there are many versions of that, try sensi, or some other bot