Author Topic: Random Chuck Norris Jokes Script  (Read 3705 times)

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Random Chuck Norris Jokes Script
« on: June 07, 2008, 12:33:03 PM »
Hello!

I Made A Random Chuck Norris Jokes Script Based On Dark`Star's Quote Script.

How To Use:

To Display A Random Joke, Type : !chuck

To Get Info About A Specific Chuck Joke Added: Type !chuck <category> <Chuck Number> (This number being the order that the joke was added in that category.

Adding A Joke: Because this script uses Dark`Star's system for adding quotes, they can be added in the same way. Type: !addchuck <category> #<Insert CHuck Joke Here>.

Finally, The Script, Enjoy:

Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)

if Instr(lcase(Message),"!chuck") then
if Instr(lcase(Message),"!chuckinfo") then
else
  if left(lcase(message),6) = "!chuck" then
    if lcase(Message) = "!chuck" then
      rndnum = Int(Rnd * GetIniFile("chuck.ini","control","chucks","0")) + 1
      chuck = GetIniFile("chuck.ini","master","" & rndnum & "","NA")
      title = "CNScript"
    end if
    if len(message) > 7 then
      if Instr(lcase(Message),"#") then
        temp1 = Mid(lcase(Message),8)
        temp2 = instr(lcase(Message),"#")
        if temp2 > 0 then
          num = Mid(Message,temp2+1)
          tmp = instr(lcase(temp1),"#")
          tempvar = Mid(Message,8,tmp - 2)
          temp3 = GetIniFile("chuck.ini","" & tempvar & "","" & num & "","NA")
          chuck = GetIniFile("chuck.ini","master","" & temp3 & "","NA")
          temptitle = GetIniFile("chuck.ini","control","" & tempvar & "","0")
          title = "" & tempvar & " (" & num & " of " & temptitle & ")"
        end if
      else
      rndnum = Int(Rnd * GetIniFile("chuck.ini","control","" & Mid(lcase(Message),8) & "","0")) + 1
      temp1 = GetIniFile("chuck.ini","" & Mid(lcase(Message),8) & "","" & rndnum & "","NA")
      chuck = GetIniFile("chuck.ini","master","" & temp1 & "","NA")
      title = Mid(Lcase(Message),8)
      end if
    end if
    if quote = "NA" then
      SendCommand "/msg " & Channel & " No Entry Found.", ServerNumber
    else
      SendCommand "/msg " & Channel & " " & title & ": " & chuck & "", ServerNumber
    end if
  end if
end if
end if

if Instr(lcase(Message),"!chuckinfo") then
  if left(lcase(message),10) = "!chuckinfo" then
    if len(message) > 11 then
      if Instr(lcase(Message),"#") then
        temp1 = Mid(lcase(Message),12)
        temp2 = instr(lcase(Message),"#")
        if temp2 > 0 then
          num = Mid(Message,temp2+1)
          tmp = instr(lcase(temp1),"#")
          tempvar = Mid(Message,12,tmp - 2)
          info = GetIniFile("chuckinfo.ini","" & tempvar & "","" & num & "","No Information Available")
        end if
      else
        info = "Third Paramiter Not Specified, Syntax: !chuckinfo <category> #<number>"
      end if
    else
      if lcase(Message) = "!chuckinfo" then
        info = "This will retrieve information about a chuck. Syntax: !chuckinfo <category> #<number>"
      end if
    end if
    SendCommand "/msg " & Channel & " " & info & "", ServerNumber
  end if
end if

if Instr(lcase(Message),"!addchuck") then
  if left(lcase(message),9) = "!addchuck" then
    if len(message) > 10 then
      if Instr(lcase(Message),"#") then
         temp1 = Mid(lcase(Message),11)
         temp2 = instr(lcase(Message),"#")
        chuck = Mid(Message,temp2+1)
         tmp = instr(lcase(temp1),"#")
        category = Mid(Message,11,tmp - 2)
        control = GetIniFile("chuck.ini","control","" & category & "","0") + 1
        chucks = GetIniFile("chuck.ini","control","chucks","0") + 1
        master = GetIniFile("chuck.ini","control","chucks","0") + 1
         ttime = GetIdentifier("$time",ServerNumber)
         tdate = GetIdentifier("$date",ServerNumber)
         tserver = GetIdentifier("$network",ServerNumber)
        info = "This Chuck Submitted By: " & Nickname & " On: " & Channel & ", " & tserver & " At: " & ttime & ", " & tdate & "."
   if len(chuck) > 1 then
        WriteIniFile "chuckinfo.ini","" & category & "","" & control & "","" & info & ""
        WriteIniFile "chuck.ini","control","" & category & "","" & control & ""
        WriteIniFile "chuck.ini","" & category & "","" & control & "","" & master & ""
        WriteIniFile "chuck.ini","master","" & master & "","" & chuck & ""
        WriteIniFile "chuck.ini","control","chucks","" & chucks & ""
        SendCommand "/notice " & Nickname & " Chuck has been filed as: " & category & " #" & control & ".", ServerNumber
   else
        SendCommand "/notice " & Nickname & " No Chuck Specified.", ServerNumber
end if
      end if
    else
      if lcase(Message) = "!addchuck" then
        SendCommand "/notice " & Nickname & " Syntax: !addchuck <category> #<chuck>", ServerNumber
        SendCommand "/notice " & Nickname & " Do Not Include a space between the pound sign and <chuck>.", ServerNumber
      end if
    end if
  end if
end if

End Sub



~ Sam
~ Visit my website at http://www.TheCellist42.com

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: Random Chuck Norris Jokes Script
« Reply #1 on: June 13, 2008, 08:23:34 PM »
Ok.. I Have An Updated Version Of The Script.

UPDATE: To Add Chuck Jokes, You Can Now Type: !addchuck chuck #<Joke Here>

(i.e. !addchuck chuck #Chuck Norris does not sleep - he waits.)

The Updated Script:
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)

if Instr(lcase(Message),"!chuck") then
if Instr(lcase(Message),"!chuckinfo") then
else
  if left(lcase(message),6) = "!chuck" then
    if lcase(Message) = "!chuck" then
      rndnum = Int(Rnd * GetIniFile("chuck.ini","control","chucks","0")) + 1
      chuck = GetIniFile("chuck.ini","master","" & rndnum & "","NA")
    end if
    if len(message) > 7 then
      if Instr(lcase(Message),"#") then
        temp1 = Mid(lcase(Message),8)
        temp2 = instr(lcase(Message),"#")
        if temp2 > 0 then
          num = Mid(Message,temp2+1)
          tmp = instr(lcase(temp1),"#")
          tempvar = Mid(Message,8,tmp - 2)
          temp3 = GetIniFile("chuck.ini","" & tempvar & "","" & num & "","NA")
          chuck = GetIniFile("chuck.ini","master","" & temp3 & "","NA")
          temptitle = GetIniFile("chuck.ini","control","" & tempvar & "","0")
          title = "" & tempvar & " (" & num & " of " & temptitle & ")"
        end if
      else
      rndnum = Int(Rnd * GetIniFile("chuck.ini","control","" & Mid(lcase(Message),8) & "","0")) + 1
      temp1 = GetIniFile("chuck.ini","" & Mid(lcase(Message),8) & "","" & rndnum & "","NA")
      chuck = GetIniFile("chuck.ini","master","" & temp1 & "","NA")
      title = Mid(Lcase(Message),8)
      end if
    end if
    if quote = "NA" then
      SendCommand "/msg " & Channel & " No Entry Found.", ServerNumber
    else
      SendCommand "/msg " & Channel & " " & chuck & "", ServerNumber
    end if
  end if
end if
end if

if Instr(lcase(Message),"!chuckinfo") then
  if left(lcase(message),10) = "!chuckinfo" then
    if len(message) > 11 then
      if Instr(lcase(Message),"#") then
        temp1 = Mid(lcase(Message),12)
        temp2 = instr(lcase(Message),"#")
        if temp2 > 0 then
          num = Mid(Message,temp2+1)
          tmp = instr(lcase(temp1),"#")
          tempvar = Mid(Message,12,tmp - 2)
          info = GetIniFile("chuckinfo.ini","" & tempvar & "","" & num & "","No Information Available")
        end if
      else
        info = "Third Paramiter Not Specified, Syntax: !chuckinfo chuck #<number>"
      end if
    else
      if lcase(Message) = "!chuckinfo" then
        info = "This will retrieve information about a chuck. Syntax: !chuckinfo chuck #<number>"
      end if
    end if
    SendCommand "/msg " & Channel & " " & info & "", ServerNumber
  end if
end if

if Instr(lcase(Message),"!addchuck") then
  if left(lcase(message),9) = "!addchuck" then
    if len(message) > 10 then
      if Instr(lcase(Message),"#") then
         temp1 = Mid(lcase(Message),11)
         temp2 = instr(lcase(Message),"#")
        chuck = Mid(Message,temp2+1)
         tmp = instr(lcase(temp1),"#")
        category = Mid(Message,11,tmp - 2)
        control = GetIniFile("chuck.ini","control","" & category & "","0") + 1
        chucks = GetIniFile("chuck.ini","control","chucks","0") + 1
        master = GetIniFile("chuck.ini","control","chucks","0") + 1
         ttime = GetIdentifier("$time",ServerNumber)
         tdate = GetIdentifier("$date",ServerNumber)
         tserver = GetIdentifier("$network",ServerNumber)
        info = "This Chuck Submitted By: " & Nickname & " On: " & Channel & ", " & tserver & " At: " & ttime & ", " & tdate & "."
   if len(chuck) > 1 then
        WriteIniFile "chuckinfo.ini","" & category & "","" & control & "","" & info & ""
        WriteIniFile "chuck.ini","control","" & category & "","" & control & ""
        WriteIniFile "chuck.ini","" & category & "","" & control & "","" & master & ""
        WriteIniFile "chuck.ini","master","" & master & "","" & chuck & ""
        WriteIniFile "chuck.ini","control","chucks","" & chucks & ""
        SendCommand "/notice " & Nickname & " Chuck has been filed as: " & category & " #" & control & ".", ServerNumber
   else
        SendCommand "/notice " & Nickname & " No Chuck Specified.", ServerNumber
end if
      end if
    else
      if lcase(Message) = "!addchuck" then
        SendCommand "/notice " & Nickname & " Syntax: !addchuck chuck #<chuck>", ServerNumber
        SendCommand "/notice " & Nickname & " Do Not Include a space between the pound sign and <chuck>.", ServerNumber
      end if
    end if
  end if
end if

End Sub

-Sam
~ Sam
~ Visit my website at http://www.TheCellist42.com