PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Genius on 05 May, 2005, 22:13:12

Title: Convert lua4 to lua5
Post by: Genius on 05 May, 2005, 22:13:12
Hi evryone

I need convert this script Please
Sory about my inglish



--------------------------

-- 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 of VidFamne with lot of help of Piglja
-- Added Timer by piglja - 20.03.03

botname = "TrickerBot"
trigs = {
      lol="Yeah, that was funny [USER]. Haha.",
      bye="See ya [USER]",
      ptokax="Oh Yeah, PtokaX ;)",
      fuck="Watch IT [USER]! One more line of code and i could kick your ass!",
      ["shut up"]="Make me!"
   }


       lol={
  "Yeah, 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!"
                                        }
      
      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!"
                                  }
      shut={
     "Make me!",
     "Ooh! I'm wounded!",
     "I'll shut up when I damn well please",
     "blah blah blah!",
     "Why should I?"
                            }
      
             

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<> ([ -z]*)")

      -- look in the table
      for key, value in trigs do
                        if( strfind( strlower(msg), key) ) then
            if (key=="lol") then
            answer = lol[random(1,getn(lol))]
            SetTimer(500)
            StartTimer()
            break
            end
            if (key=="bye") then
            answer = bye[random(1,getn(lol))]
            SetTimer(500)
            StartTimer()
            break
            end
            if (key=="fuck") then
            answer = fuck[random(1,getn(lol))]
            SetTimer(500)
            StartTimer()
            break
            end
            if (key=="shut up") then
            answer = shut[random(1,getn(lol))]
            SetTimer(500)
            StartTimer()
            break
            else
            answer, x = gsub(value, "%b[]", curUser.sName)
            SetTimer(500)
            StartTimer()
         end
      end
   end
end
end


function OnTimer()
SendToAll(botname, answer )
StopTimer()
end

[][] Genius
Title:
Post by: jiten on 05 May, 2005, 22:15:34
Search the forum for "sensi", "janinha" and "trickerbot".
You'll find Lua 5 versions of those.

Cheers
Title:
Post by: Genius on 05 May, 2005, 22:28:56
Tank You :)
Title:
Post by: jiten on 06 May, 2005, 12:53:35
anytime :]