Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Random FML for eggdrop

Recommended Posts

  • Administrators

Returns a random quote from fmylife.com

Usage:
 

  • Copy this code and paste to a new file in wordpad or w/e *not notepad*
  • Save with a unique filename with the extension .tcl
  • Copy/Upload the .tcl file to your eggdrops scripts directory.
  • Add a line like this to your eggdrop.conf -: 
    Code
     
    1
    source scripts/fml.tcl
     
     
     


Rehash or restart the eggdrop.
(In the Party Line) Type .chanset #ChannelName +fml
+/- fml as needed.

That's it. The script will respond to !fml in channels with the +fml flag.
See the top of the script to change the logo or text color.

 

 

 

 ##############################################################################################
##  ##     fml.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help          ##  ##
##############################################################################################
## To use this script you must set channel flag +fml (ie .chanset #chan +fml)               ##
##############################################################################################
##############################################################################################
##  ##                             Start Setup.                                         ##  ##
##############################################################################################
## Change fml_cmdchar to the character you want to use.                                     ##
set fml_cmdchar "!"
proc fml {nick host hand chan args} {
  if {[lsearch -exact [channel info $chan] +fml] != -1} {
## Change the characters between the "" below to change the logo shown with each result.    ##
    set fmllogo "\002\00301,11-FML-\002\003"
## Change the format codes between the "" below to change the color/state of the text.      ##
    set textf "\0034"
##############################################################################################
##  ##                           End Setup.                                              ## ##
############################################################################################## 
    set fmlsite "www.fmylife.com"
    set fmlurl "/random"
    if {[catch {set fmlSock [socket -async $fmlsite 80]} sockerr]} {
      putserv "PRIVMSG $chan :$fmlsite $fmlurl $sockerr error"
      return 0
      } else {
      puts $fmlSock "GET $fmlurl HTTP/1.0"
      puts $fmlSock "Host: $fmlsite"
      puts $fmlSock ""
      flush $fmlSock
      while {![eof $fmlSock]} {
        set fmlvar " [gets $fmlSock] "
  if {[regexp {(Today.*?)FML<\/a>} $fmlvar match fmlresult]} {
          putserv "PRIVMSG $chan :${textf}[fmldehex [fmlstrip $fmlresult]] ${fmllogo}"
    close $fmlSock
    return 0
  }
      }
      close $fmlSock
      return 0
    }
  }
}
proc fmlstrip {string} {
  regsub -all {<[^<>]+>} $string "" string
  return $string
}
proc fmldehex {string} {
  regsub -all {[\[\]]} $string "" string
  set string [subst [regsub -nocase -all {\([0-9]{2});} $string {[format %c \1]}]]
  return [string map {" \"} $string]
}
bind pub - [string trimleft $fml_cmdchar]fml fml
setudef flag fml
putlog "\002*Loaded* \002\00301,11-FML-\002\003 \002Random by Ford_Lawnmower irc.GeekShed.net #Script-Help"
Link to comment
Share on other sites



×
×
  • Create New...