Ada trigger bot help - Page 2
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Ada trigger bot help

Started by AMediaMan, 12 September, 2004, 00:55:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BottledHate

QuoteOriginally posted by AMediaMan
Hey Mutor, thats all set thnx. The script works fine for me as well it just seems very slow.


BottledHate, i am curently running it alone with absolutly nothing else and there really wasnt any improvement, still seems slow. I am still using TD 4 not sure if that has anything to do with it >:o)



AMediaMan

would it be possible for you to zip up the script and put it somewhere i can get at it??? so i can test more with exactly what u have running....

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

Hey BottledHate heres a request  :D , Can this bot be made so it is more word for word ? What i mean is one of the triggers is Hi and if some one types the word think which includes the word hi, lol the bot responds still. It would be nice if it didnt do that. Not sure this is possible. But it would be much nicer  :]



Thnx, AMediaMan

BottledHate

this can be done... i'll work on it tonight.. :D


-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

TY BottledHate  :))






AMediaMan

BottledHate

well shit... it's a bit late now, and i sent more time than i thought i would on that word replace script... which is ok! because it will ultimatly help with your request for this one... :D  i'll try and have it done by tomorrow night.


-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

Hahahahaha no problem BottledHate. No rush at all over here, take your time and when your done your done lol.








AMediaMan

BottledHate

ok.. here it is...

added the abilty to make trigs absolute. by putting a "*" in front of the trig (see sample table) nothing else can be around it....

--//sample table
trigs = {
   ["*hi"]={
      "Hello [CURUSER]",
      "Hey  [CURUSER]",
      "Wassup [CURUSER]",
      "Hi [CURUSER]",
      "Hey [CURUSER], what's going on? [RNDUSER] was looking for you...",  --//RNDUSER
      "Howdy [CURUSER]!",
      "Greetings,  [CURUSER]",
      "[CURUSER], do I know you?"
   },
   ["hello"]={
      "Hello [CURUSER]",
      "Hey  [CURUSER]",
      "Wassup [CURUSER]",
      "Hi [CURUSER]",
      "Hey [CURUSER], what's going on? [RNDUSER] was looking for you, and it didn't sound good.",  --//RNDUSER
      "Howdy [CURUSER]!",
      "Greetings,  [CURUSER]",
      "[CURUSER], do I know you?"
   },
}


--//edit this junk
botname = "Funboy" --//set the reply name
OneRandomName ="BottledHate" --//put a random name here.. (anything) to populate the random table, and avoid errors.

--//ok stop,
-----------------------
function Main()
   frmHub:RegBot(botname)
end
trigall=1   
onlineUsers = {[OneRandomName] = 1}
sAnswer={}
sTrig = nil
function NewUserConnected(user)
   onlineUsers[user.sName] = 1
end
function OpConnected(user)
   onlineUsers[user.sName] = 1
end
function UserDisconnected(user)
   onlineUsers[user.sName] = nil
end
function OpDisconnected(user)
   onlineUsers[user.sName] = nil
end
function randomName()
   local n = 0
   for k,v in onlineUsers do n=n+1 end
   n = random( n ) 
   for k,v in onlineUsers do
      if n == 1 then
         k = k or ""
         return k 
      end
      n = n - 1
   end
end
function DataArrival(curUser, data)
   if( strsub(data, 1, 1) == "<" ) then
      status=strsub(data,1,strlen(data)-1) 
      if not onlineUsers[curUser.sName] then onlineUsers[curUser.sName] = 1 end --//trying to populate the random list faster.
      -- parse the command 
      s,e,cmd = strfind( status, "%b<>%s+(%S+)" ) 
      if (cmd=="+quiet") then 
         trigall=0 
         SendToAll(botname, " Hmf, Okidoki I will be quiet :(( ") 
         return 1
      elseif (cmd=="+talk") then 
         trigall=1 
         SendToAll(botname, " Okay, I will talk to you again :-)") 
         return 1
      end 
      -- get the msg only using regular expression
      s,e,msg = strfind(status, "%b<>%s+(.+)")                                        
      -- look in the table
      if strfind(msg, "^%pme .+") then
         t="**"..curUser.sName
         data=gsub (msg, "%pme", t, 1 )
         SendToAll( data )
         return 1
      end
      msg = strlower(msg)
      if trigall==1 then
         findTriggers(msg, curUser)
      end
   end
end
function findTriggers(d,u)
   for key, value in trigs do
      if strsub(key,1,1) == "*" then
         trigFound = nil
         x = gsub(key,"*","")
         local m = gsub(d,"(%S+)",
         function (w)
            if w == x then trigFound =  1 end
         end)
         if trigFound then
            SetTimer(1000)
            StartTimer()
            answer = gsub(trigs[key][random(1,getn(value))], "%[CURUSER%]", u.sName)
            answer = gsub(answer, "(%[RNDUSER%])", randomName())
            if sTrig == nil then sTrig = {} end
            sTrig[clock() + random(1,6)] = {[1] = answer}            
            break
         end
      else
         if(strfind(msg, key) ) then
            SetTimer(1000)
            StartTimer()
            answer = gsub(trigs[key][random(1,getn(value))], "%[CURUSER%]", u.sName)
            answer = gsub(answer, "(%[RNDUSER%])", randomName())
            if sTrig == nil then sTrig = {} end
            sTrig[clock() + random(1,6)] = {[1] = answer}
            break
         end
      end
   end
end
function OnTimer()
   if sTrig ~= nil then
      for k,v in sTrig do
         if k < clock() then
            SendToAll( botname, v[1])
            sTrig[k] = nil
         end
     end
      if sTrig == nil then StopTimer() end 
  end
end

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

#32
Nicely done  :))  Much better to work with thank you much.






Thnx Again, AMediaMan

BottledHate

QuoteOriginally posted by AMediaMan
Nicely done  :))  Much better to work with thank you much.


Thnx Again, AMediaMan

happy i could help. :) as always, if you have any other requests, don't hesitate to ask.. :D

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

ok ok lol how about this BottledHate.
can you make it so that the bot doesnt use the CURUSER as a RANDUSER ?

(example)say i type thats cool..........
and the bot says Hey RNDUSER, CURUSER thinks he is cool....
can you make it so the bot doesnt use my name for both the RNDUSER and the CURUSER ? That way the response doesnt look like this ..........Hey AMediaMan, AMediaMan thinks he is cool.

Just another thought  :D  



Thnx, AMediaMan

SMF spam blocked by CleanTalk