random responses from a trigbot
 

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

random responses from a trigbot

Started by kaotkbliss, 11 August, 2004, 10:48:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kaotkbliss

My script for my trigbot is something like this:

trigs = {

["trig"]="response",
["another trig"]="another response",
}

etc etc. what I would like is for some of the triggers to have multiple responses, 1 chosen randomly (such as when someone types the bots name 1 of 5 or so responses is randomly displayed.)

Herodes

#1
I made this a while ago ...
try to see if you can make it work as it is not tested with the particular table provided ...
In the proper version there is a separate file that contains over 1500 lines ... :)))

in this one try a sentence with the word ' hunt ' ..
--- Absurd Talker v 1
--- by Herodes 
-------------------------------------------------------------------
--- an advanced version of the triggerbot idea by Ptaczek
--- U need the 'everythin.tbl' file to be in the same dir with this file to run error-free... (hopefully found in the same .rar)
--- This can randomly answer and randomly replace signified words in the strings in a random way.
--- You'll see when u try ... hopefully
---
--- currently if it has a user sends 2 or more triggers in one chat line it triggs for both ...
--- and also there has to be a way to make it a bit easier to put values in the tables...
--- 1 more thing is that we need it to be fail safe ... :(  
--- (if word-to-be-replaced- isnt a array in the big table it should have an error ... )
---
--- pls be more than free to take it further  ---
---------------------------------------------------------------------
					---ADviCE ---
--- It is better for complicated stuff to find a way to break the process down to pieces and to confirm avery step as u develop it ...
--- Also sometimes it helps to start from the end... It all depends on the type of the action....
---------------------------------------------------------------------
Bot = "BigTalker"

all = { 
	["hunt"]  = { 
		"I used to hunt s with  in the .", 
		"Have you been hunting with ?", 
		"Are there s in  forest ?" },
	["forest"] = { 
		"Green Break", 
		" Tropical Ice",
		"Geek Valley"},
	["name"] = { 
		"Herodes", 
		"Nightlitch", 
		"plop", 
		"Typhoon", 
		"Tezlo", 
		"kepp", 
		"kaotkbliss" },
	["animal"] = {
		"horse",
		"cow", 
		"bird",
		"hawk",
		"crane",
		"tiger"
		"lion",
		"rhino"},
	}
		

function DataArrival(user, data)
	if( strsub(data, 1, 1) == "<" ) then
		data = strsub(data, 1, strlen(data)-1 ) 
		s,e,msg = strfind(data, "%b<>%s+(.*)")
		for trig , ans in all do
			if ( strfind( strlower(msg), trig) ) then
				local replace = ans[random(1, getn(ans) )] --- Do( replace )
				if strfind(replace, "<" ) then
					s,e,instr = strfind(replace, "<(.*)>") --- Do(instr)
					replans = all[instr][random(1, getn(all[instr]) )] --- Do(replans)
				local fini = gsub(ans[random(1, getn(ans) )], "%b<>", all[instr][random(1, getn(all[instr]) )] )
				Do(fini)
				else Do(replace)
				end
			end
		end
	end
end

function Do(msg)
if msg then
	SendToAll(Bot, msg)
elseif msg == nil then 
	SendToOps(Bot, "is nill")
else
	SendToOps(Bot, "not there ".. tostring(msg))
end
end

Troubadour

----- Try this

botname = "Triggerino"

trigs = {
                hehe={
     "BWahaha, [CURUSER] das lache,  Hahahaha.",
     "Huh! [CURUSER]  waar lach je om?",
     "Als jij lacht, gaat heel mijn beeldscherm heen en weer!",
     "hehehehe",
     "hohohohoh"
                                 },

         haha={
     "BWahaha, [CURUSER] das lache,  Hahahaha.",
     "Huh! [CURUSER]  waar lach je om?",
     "Als jij lacht, gaat heel mijn beeldscherm heen en weer!",
     "hehehehe",
     "hohohohoh"
                                 },
                                   
         lmao={
     "BWahaha, [CURUSER] das lache,  Hahahaha.",
     "Huh! [CURUSER]  waar lach je om?",
     "Als jij lacht, gaat heel mijn beeldscherm heen en weer!",
     "hehehehe",
     "hohohohoh"
                                 },

         bye={
       "Ajuu, [CURUSER]",
       "Bye, [CURUSER]   .....*sniff*",
      "Hey,  [CURUSER] waarom ga je weg, ach moet je ook zelf weten. Tot sinas!",
      "*Snif* we zullen je missen, [CURUSER]!",
      "<----*zwaait met zijn armen*"
                                 },

         cya={
       "Ajuu, [CURUSER]",
       "Bye, [CURUSER]   .....*sniff*",
      "Hey,  [CURUSER] waarom ga je weg, ach moet je ook zelf weten. Tot sinas!",
      "*Snif* we zullen je missen, [CURUSER]!",
      "<----*zwaait met zijn armen*"
                                  },

         ["cu"]={
       "Ajuu, [CURUSER]",
       "Bye, [CURUSER]   .....*sniff*",
      "Hey,  [CURUSER] waarom ga je weg, ach moet je ook zelf weten. Tot sinas!",
      "*Snif* we zullen je missen, [CURUSER]!",
      "<----*zwaait met zijn armen*"
                               },
      
         fuck={
      "Denk eraan [CURUSER]!! Hier zitten ook kinderen, volgende keer word je verwijderd door ons!"
                               },

         fucker={
      "Denk eraan [CURUSER]!! Hier zitten ook kinderen, volgende keer word je verwijderd door ons!"
                               },

         ["hallo"]={
        "Hallo [CURUSER]",
        "Hoi  [CURUSER]",
        "Hoe gaat ie [CURUSER]",
        "Hi [CURUSER]",
        "Hey [CURUSER], alles kits?"
                             },

         hello={
        "Hallo [CURUSER]",
        "Hoi  [CURUSER]",
        "Hoe gaat ie [CURUSER]",
        "Hi [CURUSER]",
        "Hey [CURUSER], alles kits?"
                             },

         hey={
        "Hallo [CURUSER]",
        "Hoi  [CURUSER]",
        "Hoe gaat ie [CURUSER]",
        "Hi [CURUSER]",
        "Hey [CURUSER], alles kits?"
                             },

         dronken={
   "ikke DronKen? -*- hik -*-",
   "pftftt doe mij er nog maar eentje   pfffttttttt",
   "Zoveel heb ik niet gehad...",
   "Ik ben niet dronken!!",
   "Hooguit aangeschoten.....",
   "pfftt!",
   "oohhh koppie zeer",
   "*BURP*",
   "*HICK*"
                               },

         ["bot"]={
   "Direct Connect bots zijn niks aan...",
   "Wie? Ikke? Dacht ut niet...",
   "Niet liegen, ik lees met jullie mee!",
   "Ik? HAHA",
   "en zeker ook nog blond!"
                                  },

         drug={
   "drugz?",
   "illegale substantie?",
   "sniiiiiifffffff",
   "is dat niet legaal in Amsterdam?",
   "das voor mij niet te betalen",
   "*snif* ahh!"
                                },                    

         pils={
   "gulp, gulp, gulp",
   "hik!",
   "Krijg er dorst van...",
   "Geef die fles maar door!",
   "*burp*",
   "of een cola rum gaat er ook wel in!"
                                 },

         sorry={
        "ok",
        "tuurlijk",
        "ja, dat zal wel!",
        "ok"
                             },

         wassup={
        "ben aan het eten",
        "ik eet pizza :)",
        "ben aan het buikdansen",
        "hacking microsoft.com",
        "kijk maar op de homepage bij de webcam"
                           },
                 
         ["ben jij"]={
   "maakt het wat uit dan ?",
   "hoezo?",
   "tuurlijk niet, doe niet zo raar",
   "misschien",
   "beroepsgeheim",
   "jij dan?"
                               },

         yep={
   "jazeker",
   "yep",
   "100%",
   "tuurlijk!",
   "daar kun je gif op innemen",
   "dat kan ik bevestigen!",
   "correct",
   "zekers"
                              },
                 
   }


function Main()
frmHub:RegBot(botname)
end

function DataArrival(curUser, data)

       
   if( strsub(data, 1, 1) == "<" ) then
      -- get the msg only using regular expression
      s,e,msg = strfind(data, "%b<>%s+(.+)")
                                       
      -- look in the table
      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
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

kaotkbliss

thanks Troubadour, it worked... thanks :)

pat

Can any help me to get this script to work in DCDM++

BottledHate

#5
QuoteOriginally posted by pat
Can any help me to get this script to work in DCDM++

sure!

trigs = { 
hehe={ 
"BWahaha, [CURUSER] das lache, Hahahaha.", 
"Huh! [CURUSER] waar lach je om?", 
"Als jij lacht, gaat heel mijn beeldscherm heen en weer!", 
"hehehehe", 
"hohohohoh" 
}, 

haha={ 
"BWahaha, [CURUSER] das lache, Hahahaha.", 
"Huh! [CURUSER] waar lach je om?", 
"Als jij lacht, gaat heel mijn beeldscherm heen en weer!", 
"hehehehe", 
"hohohohoh" 
}, 

lmao={ 
"BWahaha, [CURUSER] das lache, Hahahaha.", 
"Huh! [CURUSER] waar lach je om?", 
"Als jij lacht, gaat heel mijn beeldscherm heen en weer!", 
"hehehehe", 
"hohohohoh" 
}, 

bye={ 
"Ajuu, [CURUSER]", 
"Bye, [CURUSER] .....*sniff*", 
"Hey, [CURUSER] waarom ga je weg, ach moet je ook zelf weten. Tot sinas!", 
"*Snif* we zullen je missen, [CURUSER]!", 
"<----*zwaait met zijn armen*" 
}, 

cya={ 
"Ajuu, [CURUSER]", 
"Bye, [CURUSER] .....*sniff*", 
"Hey, [CURUSER] waarom ga je weg, ach moet je ook zelf weten. Tot sinas!", 
"*Snif* we zullen je missen, [CURUSER]!", 
"<----*zwaait met zijn armen*" 
}, 

["cu"]={ 
"Ajuu, [CURUSER]", 
"Bye, [CURUSER] .....*sniff*", 
"Hey, [CURUSER] waarom ga je weg, ach moet je ook zelf weten. Tot sinas!", 
"*Snif* we zullen je missen, [CURUSER]!", 
"<----*zwaait met zijn armen*" 
}, 

fuck={ 
"Denk eraan [CURUSER]!! Hier zitten ook kinderen, volgende keer word je verwijderd door ons!" 
}, 

fucker={ 
"Denk eraan [CURUSER]!! Hier zitten ook kinderen, volgende keer word je verwijderd door ons!" 
}, 

["hallo"]={ 
"Hallo [CURUSER]", 
"Hoi [CURUSER]", 
"Hoe gaat ie [CURUSER]", 
"Hi [CURUSER]", 
"Hey [CURUSER], alles kits?" 
}, 

hello={ 
"Hallo [CURUSER]", 
"Hoi [CURUSER]", 
"Hoe gaat ie [CURUSER]", 
"Hi [CURUSER]", 
"Hey [CURUSER], alles kits?" 
}, 

hey={ 
"Hallo [CURUSER]", 
"Hoi [CURUSER]", 
"Hoe gaat ie [CURUSER]", 
"Hi [CURUSER]", 
"Hey [CURUSER], alles kits?" 
}, 

dronken={ 
"ikke DronKen? -*- hik -*-", 
"pftftt doe mij er nog maar eentje pfffttttttt", 
"Zoveel heb ik niet gehad...", 
"Ik ben niet dronken!!", 
"Hooguit aangeschoten.....", 
"pfftt!", 
"oohhh koppie zeer", 
"*BURP*", 
"*HICK*" 
}, 

["bot"]={ 
"Direct Connect bots zijn niks aan...", 
"Wie? Ikke? Dacht ut niet...", 
"Niet liegen, ik lees met jullie mee!", 
"Ik? HAHA", 
"en zeker ook nog blond!" 
}, 

drug={ 
"drugz?", 
"illegale substantie?", 
"sniiiiiifffffff", 
"is dat niet legaal in Amsterdam?", 
"das voor mij niet te betalen", 
"*snif* ahh!" 
}, 

pils={ 
"gulp, gulp, gulp", 
"hik!", 
"Krijg er dorst van...", 
"Geef die fles maar door!", 
"*burp*", 
"of een cola rum gaat er ook wel in!" 
}, 

sorry={ 
"ok", 
"tuurlijk", 
"ja, dat zal wel!", 
"ok" 
}, 

wassup={ 
"ben aan het eten", 
"ik eet pizza :)", 
"ben aan het buikdansen", 
"hacking microsoft.com", 
"kijk maar op de homepage bij de webcam" 
}, 

["ben jij"]={ 
"maakt het wat uit dan ?", 
"hoezo?", 
"tuurlijk niet, doe niet zo raar", 
"misschien", 
"beroepsgeheim", 
"jij dan?" 
}, 

yep={ 
"jazeker", 
"yep", 
"100%", 
"tuurlijk!", 
"daar kun je gif op innemen", 
"dat kan ik bevestigen!", 
"correct", 
"zekers" 
}, 
} 

shutUP = 1 
dcpp:setListener( "chat", "listenfortrigs",
   function( hub, user, text )
      if string.sub(text, 1,6) == "+quiet" then   -- +quiet
         DC():SendHubMessage( hub:getId(), "<"..hub:getOwnNick().."> OK! i'll stfu now.|")
         shutUP = 0
      elseif string.sub(text, 1,6) == "+talk" then -- +talk
         DC():SendHubMessage( hub:getId(), "<"..hub:getOwnNick().."> w0000t, back in action!|")
         shutUP = 1
      else
         if shutUP == 1 then
            bleh(hub,user,text)
         end
      end
   end
)
sTrig = {}
function bleh(h,u,t)
   for k, v in trigs do
      if string.find(string.lower(t), k) then
         sTrig[os.time() + math.random(5)] = {[1]=h, [2] = string.gsub(trigs[k][math.random(1,table.getn(v))], "%b[]", u:getNick())}
         return
      end
   end
end

--//for DCDM++ => v0.035
function dcpp.OnTimer()
   for k,v in sTrig do
      if k < os.time() then
         DC():SendHubMessage( v[1]:getId(), "<"..v[1]:getOwnNick().."> "..v[2].."|")
         sTrig[k] = nil
      end
   end
end

--//for BCDC =< .4032
--dcpp:setListener( "timer", "trigbot",
--   function()
--      for k,v in sTrig do
--         if k < os.time() then
--          DC():SendHubMessage( v[1]:getId(), "<"..v[1]:getOwnNick().."> "..v[2].."|")
--          sTrig[k] = nil
--         end
--      end
--   end
--)

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

pat


pat

the script works fine thanx

how to add this to the script

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

BottledHate

QuoteOriginally posted by pat
the script works fine thanx

how to add this to the script

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


you can't block the commands from being seen by all like u can a hub script using 'return 1'

but, i made the changes u requested :) edited in my post above.

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

pat


BottledHate

QuoteOriginally posted by pat
thanx again


np... glad i could help!

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

pat

hello again the script  are very fun =)

but then any type in main the bot answer in 1sec

can it be fixed some timer for the bot to talk ?
like 2-3 sec before he answer

sorry for my bad eng hope you understand

thanx Pat

BottledHate

QuoteOriginally posted by pat
hello again the script  are very fun =)

but then any type in main the bot answer in 1sec

can it be fixed some timer for the bot to talk ?
like 2-3 sec before he answer

sorry for my bad eng hope you understand

thanx Pat

edited above... random time for reply between 1 and 5 seconds.

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

pat


SMF spam blocked by CleanTalk