PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: [NL]ZeroX on 06 March, 2004, 13:12:17

Title: need help whit a "tricker bot"
Post by: [NL]ZeroX on 06 March, 2004, 13:12:17
im now configuring my second version of fishbot (a copy of the fishbot off quakenet)

first one was just edited an other trigger bot script

and it gives some bugs

- when some1 say a litte part of the trigger, the bot gives already the answer like: "mo" the bot gives answer of "moo?"  or when some1 says "dag" the bot gives answer to the commands "ag"


- when some1 gives a command witch has a part of another command in it, it gives the answer of the other command like: "fish go moo" you get the answer of the command "moo?" or when you give the command "fishbot owns" you get the answer of "fishbot"


so now i need help with this bot.

the mention is that fishbot answers the on the exact string



-- TrickerBot2.lua, created by Ptaczek Dec-24, 2002
-- Just see how to implement the NMDC TriggerBot in LUA :)
-- changes
-- Feb-24, 2003, v2.0 Modification for DataArrival return value.
-- Tiny changes by VidFamne with lot of help by Piglja
-- VidFamne added Pigljas time-function, and some more trigs
-- A bug-fix by VidFamne, hopefully. And added some more triggs ;)
-- A new bug-fix ( for the "!me-command" ) by VidFamne, added ( 09.04.2003 ).
-- Added MatrixX On/Off function. Just type +quiet in mainchat to stop the Bot,
-- and +talk to start the Bot again. By VidFamne ( 05.05.2003 )
-- Bug-fix by [AF]Mike
-- created fishbot of it (11.02.2004)

botname = "fishbot"

trigall=1

trigs = {
             

["badger badger badger badger badger badger badger badger badger badger badger badger"]={
  "mushroom mushroom!"  
                              },

["snake"]={
  "Ah snake a snake! Snake, a snake! Ooooh, it's a snake!"  
                              },

["carrots handbags cheese"]={
  "toilets russians planets hamsters weddings poets stalin KUALA LUMPUR! pygmies budgies KUALA LUMPUR!"  
                              },

["sledgehammer"]={
  "sledgehammers go quack!"  
                              },

["Any sentence with vinegar and aftershock in it"]={
  "Ah, a true connoisseur!"  
                              },

["herring"]={
  "herring(n): Useful device for chopping down tall trees. Also moos (see fish)."  
                              },

["hampster"]={
  "[USER]: There is no 'p' in hamster you retard.."  
                              },

["fishbot owns"]={
  "Aye, I do."  
                              },

["vinegar"]={
  "Nope, too sober for vinegar. Try later."  
                              },

["martian"]={
  "Don't run! We are your friends!"  
                              },

["just then, he fell into the sea"]={
  "Ooops!"  
                              },

["aftershock"]={
  "mmmm, Aftershock."  
                              },

["why are you here?"]={
  "Same reason. I love candy."  
                              },

["spoon"]={
  "There is no spoon."  
                              },

["bounce"]={
  "moo"  
                              },

["crack"]={
  "Doh, there goes another bench!"  
                              },

["you can't just pick people at random!"]={
  " can do anything I like, [USER], I'm eccentric! Rrarrrrrgh! Go!"  
                              },

["wertle"]={
  "moo"  
                              },

["flibble"]={
  "plop"  
                              },

["www.outwar.com"]={
  "would you please GO AWAY with that outwar rubbish!"  
                              },

["fishbot created splidge"]={
  "omg no! Think I could show my face around here if I was responsible for THAT?"  
                              },

["strokes fishbot"]={
  "m00s loudly at [USER]."  
                              },

["now there's more than one of them?"]={
  "A lot more."  
                              },

["I want everything"]={
  "Would that include a bullet from this gun?"  
                              },

["we are getting aggravated."]={
  "Yes, we are."  
                              },

["how old are you, fishbot?"]={
  "is older than time itself."  
                              },

["atlantis"]={
  "Beware the underwater headquarters of the trout and their bass henchmen. From there they plan their attacks on other continents."  
                              },

["oh god"]={
  "fishbot will suffice."  
                              },

["what is the matrix?"]={
  "No-one can be told what the matrix is. You have to see it for yourself."  
                              },

["what do you need?"]={
  "Guns. Lots of guns."  
                              },

["I know Kungfu"]={
  "Show me."  
                              },

["cake"]={
  "fish"  
                              },

["trout go moo"]={
  "Aye, that's cos they're fish."  
                              },

["Kangaroo"]={
  "The kangaroo is a four winged stinging insect."  
                              },

["sea bass"]={
  "Beware of the mutant sea bass and their laser cannons!"  
                              },

["trout"]={
  "Trout are freshwater fish and have underwater weapons"  
                              },

["where are we?"]={
  "Last time I looked, we were in Gamers United - AiR & ZeroX backyard"  
                              },

["where do you want to go today?"]={
  "anywhere but redmond :(."  
                              },

["fish go moo"]={
  "notes that [USER] is truly enlightened."  
                              },

["cows go moo"]={
  "[USER]: only when they are impersonating fish."  
                              },

["fish go blubb"]={
  "[USER] LIES! Fish don't go blubb! fish go m00!"  
                              },

["you know who else "]={
  "[USER]: YA MUM!."  
                              },

["If there's one thing I know for sure, it's that fish don't m00."]={
  "[USER]: HERETIC! UNBELIEVER!."  
                              },

["fishbot: Muahahaha. Ph33r the dark side. :)"]={
  "[USER]: You smell :P."  
                              },

["ammuu?"]={
  "[USER]: fish go m00 oh yes they do!."  
                              },

["fish"]={
  "[USER]: fish go m00!"  
                              },

["moo?"]={
  "To moo, or not to moo, that is the question. Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fish..."  
                              },

["ag"]={
  "Ag, ag ag ag ag ag AG AG AG!"  
                              },

["fishbot"]={
  "Yes?"  
                              }

}


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=="fish.off") then
trigall=0
SendToAll(botname, " Hmf, Okidoki I will be quiet :(( ")
return 1
elseif (cmd=="fish.on") 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(1800)
                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

Title:
Post by: nErBoS on 06 March, 2004, 17:37:48
Hi,

If i understand your doubt is how to had more phrase to the bot react ???

If yes in the table trigs had...

["the phares you want to react"]={
     "the awnswer of the bot."

Best regards, nErBoS