Ada trigger bot help
 

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.

AMediaMan

Hi everyone been awhile i know :)

so lets get things going hahaha, i need help with the Ada trigger bot. Here is the script

-- 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

botname = "Funboy"

trigall=1

trigs = {
              
			["lol"]={
  	"Yeah, [CURUSER] that was funny,  Hahahaha.",
  	"Hmm, ok that was funny, I think :)",
  	"what! [CURUSER]  why are you laughing?",
  	"You shake when you laugh, like a bowl full of jelly",
  	"hilarious!",
  	"hehehehe",
  	"hohohohoh"  
                              	},

			hehe={
  	"Yeah, [CURUSER] that was funny,  Hahahaha.",
  	"Hmm, ok that was funny, I think :)",
  	"what! [CURUSER]  why are you laughing?",
  	"You shake when you laugh, like a bowl full of jelly",
  	"hilarious!",
  	"hehehehe",
  	"hohohohoh"
                              	},

			haha={
  	"Yeah, [CURUSER] that was funny,  Hahahaha.",
  	"Hmm, ok that was funny, I think :)",
  	"what! [CURUSER]  why are you laughing?",
  	"You shake when you laugh, like a bowl full of jelly",
  	"hilarious!",
  	"hehehehe",
  	"hohohohoh"
                              	},
                              
			rofl={
  	"Yeah, [CURUSER] that was funny,  Hahahaha.",
  	"Hmm, ok that was funny, I think :)",
  	"what! [CURUSER]  why are you laughing?",
  	"You shake when you laugh, like a bowl full of jelly",
  	"hilarious!",
  	"hehehehe",
  	"hohohohoh"
                              	},
                              
			lmao={
 	"Yeah, [CURUSER] that was funny,  Hahahaha.",
 	"Hmm, ok that was funny, I think :)",
  	"what! [CURUSER]  why are you laughing?",
  	"You shake when you laugh, like a bowl full of jelly",
  	"hilarious!",
  	"hehehehe",
  	"hohohohoh"
                              	},

			bye={
    	"See ya, [CURUSER]",
    	"Bye, [CURUSER]   .....*sniff*",
   	"Hey,  [CURUSER] get your ass back here. Hehe just kidding, if U have to go U have to go, Bye",
   	"*Snif* we will miss you, [CURUSER]!",
   	"*Waves bye*",
   	"Leaving already?!",
    	"Got better things to do, huh?",
    	"Go on...leave!"
                              	},

			cya={
    	"See ya, [CURUSER]",
    	"Bye, [CURUSER]   .....*sniff*",
    	"Hey,  [CURUSER] get your ass back here. Hehe just kidding, if U have to go U have to go, Bye",
    	"*snif* we will miss you, [CURUSER]!",
   	"*waves bye*",
    	"Leaving already?!",
    	"Got better things to do, huh?",
    	"Go on...leave!"
                               	},

			["cu"]={
    	"See ya, [CURUSER]",
   	"Bye, [CURUSER]   .....*sniff*",
    	"Hey,  [CURUSER] get your ass back here. Hehe just kidding, if U have to go U have to go, Bye",
    	"*Snif* we will miss you, [CURUSER]!",
    	"*Waves bye*",
    	"Leaving already?!",
    	"Got better things to do, huh?",
    	"Go on...leave!"
                            	},
		
			fuck={
   	"Watch IT [CURUSER]!! One more line of code and i could kick your ass!",
    	"I hate it when you talk like that!",
    	"Don't ever insult me again",
    	"That's not a very nice way to talk !",
    	"Keep it up and I will kick you!",
    	"Say that again and I am going to clobber you!"
                            	},

			fucker={
   	"Watch IT [CURUSER]!! One more line of code and i could kick your ass!",
   	"I hate it when you talk like that!",
   	"Don't ever insult me again",
   	"That's not a very nice way to talk !",
    	"Keep it up and I will kick you!",
    	"Say that again and I am going to clobber you!"
                            	},

			["shut up"]={
     	"Make me!",
     	"Ooh! I'm wounded!",
     	"I'll shut up when I damn well please",
     	"blah blah blah!",
     	"Why should I?"
                            	},

			stfu={
     	"Make me!",
     	"Ooh! I'm wounded!",
     	"I'll shut up when I damn well please",
     	"blah blah blah!",
     	"Why should I?"
                            	},

			["hi"]={
     	"Hello [CURUSER]",
     	"Hey  [CURUSER]",
     	"Wassup [CURUSER]",
     	"Hi [CURUSER]",
     	"Hey [CURUSER], what's going on?",
     	"Howdy [CURUSER]!",
     	"Greetings,  [CURUSER]",
     	"[CURUSER], do I know you?"
                       		},

			hello={
     	"Hello [CURUSER]",
     	"Hey  [CURUSER]",
     	"Wassup [CURUSER]",
     	"Hi [CURUSER]",
     	"Hey [CURUSER], what's going on?",
     	"Howdy [CURUSER]!",
     	"Greetings,  [CURUSER]",
     	"[CURUSER], do I know you?"
                       		},

			hey={
     	"Hello [CURUSER]",
     	"Hey  [CURUSER]",
     	"Wassup [CURUSER]",
     	"Hi [CURUSER]",
     	"Hey [CURUSER], what's going on?",
     	"Howdy [CURUSER]!",
     	"Greetings,  [CURUSER]",
     	"[CURUSER], do I know you?"
                       		},

			drunk={
	"me dRunk? -*- hik -*-",
	"pftftt paff the boffle bartender   pfffttttttt",
	"I just drank a little...",
	"I am not drunk!!",
	"I am  not dddddddddddddrunk.....",
	"drunk?",
	"pfftt!",
	"pour me another",
	"*spew*",
	"oohhh my head",
	"I think I'm gonna hurl",
	"*BLAH*",
	"*BURP*",
	"me not drunk *HICK*"
                            	},

			["bot"]={
	"Bots suck!",
	"Direct Connect bots are lame...",
	"A bot?",
	"Me? I don't think so...",
	"Don't lie!",
	"piece of shit! I 've been found out! -NOT-",
	"I am quite human...",
	"bite me!",
	"eat shit!  I am not a bot!",
	"a bot?",
	"What the shit is a bot?",
	"You don't think my name is 'Bot' do you?",
	"Are you trying to say that I am a machine?",
	"ME? HAHA",
	"I am a real person!",
	"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!",
	"I assure you I am just as real as you!",
	"I know you are, but what am I?",
	"am not!",
	"<- - - real live person",
	"Kill the bots!",
	"WHO is a bot???",
	"a bot? where?",
	"a bot? here?",
	"I doubt if there are any bots here!",
	"Where do you get such a crazy idea!",
	"I am NOT a bot",
	"I am all too real, sorry!",
	"I am a fleshy human being!",
	"Do you make it a habit of accusing others, [CURUSER]?"
                               	},

			drug={
	"drugz?",
	"illegal substances?",
	"narcotics?",
	"sniiiiiifffffff",
	"Me drugs? never!",
	"who is selling drugs?",
	"aren't drugs legal in Amsterdam?",
	"drugs are too expensive",
	"drugs are too dangerous",
	"drugs inhibit my abily ot tiiiippe.",
	"purple haze, all around my brain...",
	"go to drugs R us",
	"drugs are bad",
	"just say no!",
	"just say maybe!",
	"just say how much!",
	"I buy my crack from the mexicans!",
	"I hear that the telephone company is a big doper!",
	"I think all the drugs are smuggled in from the planet 'Uranus'",
	"whehhwewe! pretty elephants!",
	"*snif* ahh!"
                             	},                     

			drink={
	"gulp, gulp, gulp",
	"*takes big drink*",
	"Bartender! pour me another!",
	"hik!",
	"I am thirsty...",
	"pass the bottle",
	"*takes a shot*",
	"I need another cool one",
	"this bud's for me! *gulp*",
	"I can drink 16 six packs!",
	"All American beer sucks!",
	"Dutch beer is GEWD!",
	"aye... I'll drink any man under the table!",
	"*reaches for another beer*",
	"*burp*",
	"I need some more budweiser",
	"somebody pour me a big glass of Guinness Stout.",
	"anyone ever try a wild turkey?",
	"I love beer!",
	"I love vodka!",
	"I took 14 shots of mad dog once!",
	"itth myth speetthch slurrererrred????",
	"I think alll mi beer is iampring mi typppin abillty?!?",
	"someone get me a beer!",
	"beer is awesome!",
	"humans can not live by beer alone! But I'd like to try!",
	"I think you should stop drinking"
                              	},

			sorry={
     	"don't worry about it",
     	"that's ok ",
     	"ok",
     	"that's allright",
     	"fine",
     	"as long as your sorry...",
     	"allright",
     	"I feel you didn't really mean that...",
     	"you don't sound sincere",
     	"are you really sorry?",
     	"forget it",
     	"no sweat",
     	"ok"
                          	},

			wassup={
     	"hunting crocodiles",
     	"nothing at the moment",
     	"eating",
     	"eating pizza :)",
     	"changing the tires on my dodge",
     	"juggling chainsaws",
     	"drinking beer",
     	"smoking up a storm",
     	"belly-dancing",
     	"hacking microsoft.com",
     	"trying to keep awake!",
     	"watching television",
     	"I am doing homework",
     	"what do you think!",
     	"building a spice rack",
     	"taking a shower",
     	"drinking myself to death",
     	"drinking myself to oblivian",
     	"making origami swans",
     	"feeding my ducks",
     	"learning latin",
     	"programming",
     	"play the basoon",
     	"program in Assembly",
     	"program in C++"
                        	},
                 
			["are you"]={ 
	"does it matter if I am ?",
	"what difference does it make whether or not I am",
	"of course not, don't be silly",
	"Whether I'm or not is my secret",
	"why do you want to know?",
	"why are you so nosy?",
	"perhaps I am ",
	"none of your business",
	"I think you are ",
	"does it matter if I am or not?",
	"why do you ask?",
	"I might be",
	"No, I am not ",
	"of course",
	"never have been",
	"why, are you?"
                            	},

			bitch={
	"Who are you calling a bitch??",
	"Oh, I'm upset",
	"VidFamne is a bitch!",
	"K?lle is always trying to make me his bitch",
	"I can be a bitch!",
	"Hey [CURUSER], that is no way to talk!",
	"Do you think foul language impresses me?",
	"A bitch is a female dog"
                              	},
                    
			yeah={
	"yes",
	"yep",
	"uh huh",
	"100%",
	"bang on!",
	"you bet",
	"uh-hu",
	"yes",
	"of course!",
	"you-betcha",
	"affirmative",
	"10-4 good buddy!",
	"correct",
	"yeah",
	"that's right!",
	"you got it!",
	"sure",
	"precisely right",
	"that sounds right",
	"exactly!",
	"you know it!",
	"yeppers"
                           	},
                                     
			slot={
	"Yeah i gotta slot for ya",
     	"As if you need another one of those",
     	"Pull your finger out of your ass and youd have a free one",
     	"A slot...a slot omg not again"        
                           	}     		
	           
	}


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=="+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

       

AMediaMan

#1
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


Now for my question lol

the script works great without a problem but what i would like is........ for one of the triggers it uses to say a random user not the user who typed it .You know what i mean right lol
i dont want [CURUSER] maybe [RANDOMUSER] so it will pick anyone from the user list at random

I hope this is possible I thank you all ahead of time cause i know this might be a challenge for some one hahaha thnx again.

AMediaMan



PS sorry if this has been asked i have looked everywhere to no avail >:o)

bastya_elvtars

please post it as code, i cannot fix it this way.
Everything could have been anything else and it would have just as much meaning.

AMediaMan

im not sure how sorry


i copied and pasted it here and thats how it came out



AMediaMan

bastya_elvtars

#4
-- your code here

thats all :)

looks better, engages less space and makes scripters' life easier :P

its used starting with [CODE , ending with [/code
between these your code should be placed
just add the pair of that bracket: ] to the end of the words [code and [/code
Everything could have been anything else and it would have just as much meaning.

AMediaMan

ok i give up

ive posted several scripts before and never had a problem lol maybe im just tired tonite.



AMediaMan

??????Hawk??????

hi m8  ...


edit your post and but the code switches..


[CODE ]

Your script here
...
......
.....
...

[/CODE ]




dont put a space after  CODE

bastya_elvtars

#7
yea, i wrote the same but this can be understood better.
Everything could have been anything else and it would have just as much meaning.

AMediaMan

Thnx ??????Hawk??????
 
that helped and i did edit my posts ;) The above script is mostly the triggers so here is the actual main part of the script .
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=="+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 

       
	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

BottledHate

#9
sure...

cleaned up the bot a lil as well....

but add [RNDUSER] into the trig table where u want...

the random name is generated form a list of online users. the list is made from people joining the hub. so at first the list may be small.

CODE REMOVED

edit: changed more stuff. made it so the !me command can be used with any punctuation prefix. also fixed the strlower that was slowing down the script.

-BH

edit: code removed.. grab the code from three posts down.... :D
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

#10
Wow cool BottledHate, i did notice the script was kinda slow, I just didnt think much of it.


Im gonna test it here soon, but its time for work. I will post my response later. Thnx again BottledHate for all the help.




AMediaMan


EDIT -       hahaha ok i had to try it lol but here is an error i get ...Syntax Error: bad argument #1 to `random' (interval is empty)... dont really have time to check it out.

BottledHate

yep.... thats cause the list of random names is empty
 when the script is first run... as i mentioned, names are
added to the list of random users as users join the
hub... and their name is removed when they leave.

once u start the script, if you reconnect to your with
your client before trying to use the trigbot, you will not
get that error.  Currently there is no other method i'm
aware of to make a list of ONLINE users.  The list could
initially be populated with the hub's reg'd names, but
those would be offline and online users...

anyone else know a good reliable method to make a list
 of online users??


-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

Ok i will work with it and see lol get back to ya soon.


Thnx, AMediaMan

BottledHate

#13
added:
+random response time 2 - 6 seconds...
+can respond to more than 1 trig (previously.. if you used a trig, and someone else did right after you but before the bots post.. it would be for their trig, not yours.)
+added another line to help populate the random users list faster.


botname = "Funboy"
trigall=1
function Main()
   frmHub:RegBot(botname)
end

onlineUsers = {}
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
         for key, value in trigs do
            if(strfind(msg, key) ) then
               SendToAll( data )
               SetTimer(1000)
               StartTimer()
               answer = gsub(trigs[key][random(1,getn(value))], "%[CURUSER%]", curUser.sName)
               answer = gsub(answer, "(%[RNDUSER%])", randomName())
               if sTrig == nil then sTrig = {} end
               sTrig[clock() + random(1,6)] = {[1] = answer}
               return 1
            end
         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

edit: only had the data arrival posted at first...
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

Ok BottledHate im getting this error now


Syntax Error: expected;
  last token read: `end' at line 488 in file `H:\Pirates Hub\scripts\funboy.lua'


Any ideas ?  :))

AMediaMan

BottledHate

hmmmmmm i'm not getting that error.

what version of ptokax are you running?



-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

Im using TD 4.99




AMediaMan

BottledHate

i'm running the same.. and i still don't get that error...

that error is usually caused when an extra 'end' is there
 that doesn't need to be.  have you added, or\removed
anything?


-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

bastya_elvtars

QuoteOriginally posted by BottledHate
i'm running the same.. and i still don't get that error...

that error is usually caused when an extra 'end' is there
 that doesn't need to be.  have you added, or\removed
anything?


-BH

he must have, since above script is definitely error-free
Everything could have been anything else and it would have just as much meaning.

BottledHate

QuoteOriginally posted by bastya_elvtars
QuoteOriginally posted by BottledHate
i'm running the same.. and i still don't get that error...

that error is usually caused when an extra 'end' is there
 that doesn't need to be.  have you added, or\removed
anything?


-BH

he must have, since above script is definitely error-free


thanks for the double check bastya!


-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

#20
Nope didnt add anything.

i might have copied it wrong or something.
i will try again :)


AMediaMan





EDIT :  Ok that must have been the problem cause it seems to work fine now :) thnx for all the help

BottledHate

ok.. good to hear :D  let me know if you have any other changes or whatever you would like done :)


-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

AMediaMan

Hey BottledHate not to complain any but the bot seems rather slow with its responses. Not sure if it has anything to do with my other scripts or not but I just wanted let you know. By slow im talking like maybe 10 or 15 secs. Before if i remember correctly it was much faster. Just some input for ya lol, other than that it seems to work great thnx again for letting me trouble you hahahaha.




AMediaMan

BottledHate

interesting.. it responds within 1 - 6 seconds for me...

i wonder what the problem is... can anyone else test this out and see if they have a similar problem?

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

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

SMF spam blocked by CleanTalk