PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: BoyKind on 31 July, 2006, 16:15:55

Title: trigger
Post by: BoyKind on 31 July, 2006, 16:15:55
Hello! I have a script for a trigger bot, this is the code: -- TrickerBot.lua, created by Ptaczek Dec-24,2002
-- Just see how to implement the NMDC TriggerBot in LUA :)
-- Converted to Lua5.1 By Toobster??
-- As requested By Aragorn

botname = frmHub:GetHubBotName()
trigs = {
hallo=" Hallo [USER]. ",
bye= "GoodBye [USER]. ",
}


function Main()
frmHub:RegBot(botname)
end

function ChatArrival(user, data)
if( string.sub(data, 1, 1) == "<" ) then
-- get the msg only using regular expression
s,e,msg = string.find(data, "%b<> ([%w ]*)")

-- look in the table
for key, value in pairs(trigs) do
if( string.find( string.lower(msg), key) ) then
answer, x = string.gsub(value, "%b[]", user.sName)
SendToAll( data)
SendToAll(botname, answer)
return 1
end
end
end
end
Could someone please modify it so when a user types " lol " the bot triggers something different ? 5 different sentences ... when I type " lol " my first time the bot triggers "Yeah, [USER] that was funny,  Hahahaha." and when I type " lol " my second time the bot triggers "Hmm, ok that was funny, I think :)" and so on ... I want these messages
Quote"Yeah, [USER] that was funny,  Hahahaha.",
        "Hmm, ok that was funny, I think :)",
             "[USER] is laughing like a JACK-ASS !!!",
        "what! [USER]  why are you laughing?",
        "You shake when you laugh, like a bowl full of jelly",
        "hilarious!",
        "hehehehe",
        "hohohohoh",
             "Glad you can see the funny side"
Thank you
Title: Re: trigger
Post by: BoyKind on 31 July, 2006, 22:50:57
nobody ? :(
Title: Re: trigger
Post by: speedX on 25 August, 2006, 08:02:21
hey can any one tel me wat a trigger bot does???
Title: Re: trigger
Post by: Psycho_Chihuahua on 25 August, 2006, 10:00:45
a triggerbot replies to certain words with a predefined answer or routine

using the above example...

a User types:  hallo
the bot replies:   Hallo <User> (ex. Hallo Psycho_Chihuahua)