Random FML Script

By Trev on Jul 04, 2009

Simple FML Script.

Disclaimer:
The parser used to retrieve data from is property of RuneScript. I do not own the parser or the bot.
Their parser. My script.

(09:18:00 PM) (@Trev) !fml
(09:18:02 PM) —› (Notice:) -W|R|I|S|T- (Random FML™) Today, my boyfriend broke up with me. He said I was way too good at sex so I must have lied about not having much experience, and he "wouldn't be with someone who is hiding something." WTF? FML

Alias c1 return $+($chr(3),01,$1-)
Alias c2 return $+($chr(3),02,$1-)
Alias lg return $+($c1($chr(40)),$c2($1),$c1($chr(153)),$c1($chr(41)))
On $*:Text:/^[!.@]FML/Si:#: { 
  sockopen FML. rscript.org 80 
  set %fml.temp $iif($mid($1,1,1) == $chr(64),msg #,.notice $nick)
}
On *:SOCKOPEN:FML.: {
  sockwrite -n $sockname GET /lookup.php?type=fml HTTP/1.1 
  sockwrite -n $sockname Host: rscript.org
  sockwrite -n $sockname $crlf 
}
On *:SOCKREAD:FML.: {
  if ($sockerr) { halt }
  Else {
    var %fml 
    sockread %fml
    if (Text:* iswm %fml) {
      tokenize 32 %fml
      set %fml.text $cc2($2-) 
      %fml.temp $lg(Random FML) %fml.text
      unset %fml.*
      sockclose FML.
    }
  }
}

Comments

Sign in to comment.
Donovan   -  May 07, 2011

Does anyone know how to modify this script so that it is triggered by !fml just like this one and not a /command

;;; Aliases needed for colouring. Changing colour by changing "$Chr(3),12,$Chr(2)" to "Chr(3),,$Chr(2)" $h is the main colour, $hh is the secondary colour.
alias h { return $+($chr(3),12,$chr(2),$chr(2),$1-,$chr(3),$chr(2),$chr(2)) }
alias hh { return $+($chr(3),14,$chr(2),$chr(2),$1-,$chr(3),$chr(2),$chr(2)) }
Alias Tags { Return $+($hh([),$h($1-),$hh(]) $hh(—),$h(>),) }
;;;

alias FML {
if ($Sock(FML)) { SockClose FML }
Set %FMLOut $iif($1 = -s, Say, Echo -a)
Sockopen FML rscript.org 80
}
On :SockOpen:FML: {
Sockwrite -nt FML GET /lookup.php?type=fml
SockWrite -nt FML Host: rscript.org
SockWrite -nt FML $crlf
}
on
:SockRead:FML: {
if ($SockErr) { SockClose FML | SockOpen FML rscript.org 80 }
Var %FML
SockRead %FML
if ($Regex(%FML,ID:)) { Set %FMLID $GetTok(%FML,2-,32) }
if ($Regex(%FML,Cate:)) { Set %FMLCate $GetTok(%FML,2-,32) }
if ($Regex(%FML,Text:)) { Set %FMLText $hh($GetTok(%FML,2-,32)) }
if ($Regex(%FML,Agree:)) { Set %FMLAggree $Bytes($GetTok(%FML,2-,32),bd) }
if ($Regex(%FML,Deserved:)) { Set %FMLDisaggree $Bytes($GetTok(%FML,2-,32),bd) }
if ($Regex(%FML,Comments:)) { Set %FMLComments $Bytes($GetTok(%FML,2-,32),bd) }
if ($Regex(%FML,END)) { SockClose FML }
if (!$Sock(FML)) {
%FMLOut $Tags(FML) $hh(FML:) $h(%FMLText)
Echo -a $Tags(FML) $hh(Information:) $hh(Agreed:) $h(%FMLAggree) $hh($(|)) $hh(Deserved) $h(%FMLDisaggree) $hh($(|)) $hh(Comments:) $h(%FMLComments)
Echo -a $Tags(FML) $hh(Link:) $h($+(,http://www.fmylife.com,/,%FMLCate,/,%FMLID,/,))
Unset %FML*
}
}

SandmanXP  -  Apr 29, 2016

replace line 10 with this and all works again

if $regex(%fml,/"fmllink">(.*?)) {

Sign in to comment

b0sse   -  May 05, 2011

Jethro_: Seems their webmaster havent even noticed it. Or they just didnt care. Still dead :(
Oh well. Nothing to do.
Guess our channel have to be without a working fml script then, since all the other scripts either doesnt work, or have that stupid "Net avenir" shit at the beginning :/

 Respond  
Jethro   -  May 03, 2011

b0sse that webpage has gone bad. This is the error:> Fatal error: Call to undefined function fml() in C:\Web\RScript\Web\lookup.php on line 160try again later then and see if it's been fixed by their webmaster.

 Respond  
b0sse   -  May 03, 2011

The fml script stopped working since yesterday.
I guess its cause the adress "http://www.rscript.org/lookup.php?type=fml" ain't up and running anymore?!

 Respond  
b0sse   -  May 01, 2011

@Jethro_: Oh, my bad. I'm still n00b when it comes to sockets. Thanks.
Works perfectly ^^

 Respond  
Shadow Wolf   -  Apr 29, 2011

the fml didn't work for me so i looked at the th script and i add www. to the fml script :
On $:Text:/^([!.@])FML$/Si:#:{
if ($sock(FML.)) sockclose $v1
sockopen FML. www.rscript.org 80
sockmark FML. $iif($regml(1) = @,.msg #,.notice $nick)~$&
$+($chr(3),1,$chr(40),$chr(3),2,Random FML™,$chr(3),1,$chr(41))
}
On
:SOCKOPEN:FML.:{
sockwrite -n $sockname GET /lookup.php?type=fml HTTP/1.1
sockwrite -n $sockname Host: rscript.org $+ $str($crlf,2)
}
On :SOCKREAD:FML.:{
if (!$sockerr) {
var %fml | sockread %fml
if (Text:
iswm %fml) {
$gettok($sock(FML.).mark,1,126) $&
$replace($v2,Text:,$gettok($sock(FML.).mark,2,126))
sockclose FML.
}
}
}

 Respond  
Jethro   -  Apr 29, 2011

b0sse, that website's source code is different from the original one. Here is the working modification:

on $*:text:/^([!.@])TH$/Si:#:{
  if (!%pro) { inc -u4 %pro | if ($sock(TH.)) sockclose $v1
    sockopen TH. www.thathigh.com 80
    sockmark TH. $iif($regml(1) = !,msg #,notice $nick)~$&
      $+($chr(3),1,$chr(40),$chr(3),2,Random ThatHigh™,$chr(3),1,$chr(41))
  }
}
On *:SOCKOPEN:TH.:{
  if (!$sockerr) {
    sockwrite -n $sockname GET /random/ HTTP/1.1
    sockwrite -n $sockname Host: $sock(TH.).addr $+ $str($crlf,2)
  }
}
On *:SOCKREAD:TH.:{
  if (!$sockerr) {
    var %TH | sockread %TH | if (storylink isin %TH) {
      tokenize 62 $remove($v2,<a class=" $+ $v1 $+ " href="//",</a)
      $gettok($sock(TH.).mark,1,126) $* | sockclose $sockname
    }
  }
}
 Respond  
b0sse   -  Apr 29, 2011

thanks, Jethro_
your version works great.
I changed it so that the !fml is the msg one, and the @fml and .fml are the notices ones though.

by the way, I tried to modify your code to work with thathigh.com, but couldnt get it to work. Can you help me out? I just changed all the FML to TH, and added the adress to thathigh.com and the /random etc.

On $*:Text:/^([!.@])TH$/Si:#:{
  if ($sock(TH.)) sockclose $v1 
  sockopen TH. thathigh.com 80 
  sockmark TH. $iif($regml(1) = !,.msg #,.notice $nick)~$&
    $+($chr(3),1,$chr(40),$chr(3),2,ThatHigh,$chr(3),1,$chr(41))
}
On *:SOCKOPEN:TH.:{
  sockwrite -n $sockname GET /random HTTP/1.1 
  sockwrite -n $sockname Host: thathigh.com $+ $str($crlf,2)
}
On *:SOCKREAD:TH.:{
  if (!$sockerr) {
    var %th | sockread %th
    if (Text:* iswm %th) {
      $gettok($sock(TH.).mark,1,126) $&
        $replace($v2,Text:,$gettok($sock(TH.).mark,2,126))
      sockclose TH.
    }
  }
}
 Respond  
Jethro   -  Apr 21, 2011

b0sse, to send it as a message, use the command:

@fml

The !fml and .fml commands are for notices.

 Respond  
b0sse   -  Apr 21, 2011

why .notice?
cant you make it so it msg's to channel for everyone to see?

 Respond  
Cold_Fussion   -  Jan 10, 2011

Np man... lol i never try make code short... i code to make it work.. no matter how it may look... if it works, its a script... on here i have seen people redo other peoples code in such a manner u have to really look at it to understand what it does now... but im not like that... i follow my protocols... im not a sheep :D

 Respond  
Trev   -  Jan 10, 2011

Oh i thought you were trying to be like all the other insecure idiots on this website striving to satisfy their self fulfillment of outdoing others by shortening the number of bytes in their scripts. My mistake.

 Respond  
Cold_Fussion   -  Jan 09, 2011

Trev i do like your script alot.... i wasnt being nasty... but ya i did use 99.9% of it... im only saying the output layout in the channel i made different... but ok take it as u like. 10/10 for you and a noddy badge :D

 Respond  
Jethro   -  Jan 06, 2011

I don't see why the aliases are needed in the first place. My example above functions in the same manner as Trev's without them.

 Respond  
sunslayer   -  Jan 06, 2011

http://www.hawkee.com/snippet/6377/#c58744 he most likely forgot to re-add after an update

 Respond  
napa182   -  Jan 06, 2011

Trev in ur code you used $lg(Random FML) only thing is you don't have that alias ur alias is called logo

 Respond  
Jethro   -  Jan 06, 2011

Trev, there's no need to rise the tension between your code and cold_fusion's. On the other hand, though, you should feel proud that he takes 99% of your code and makes a %1 change to it. At the most, he fancies your script.

 Respond  
Trev   -  Jan 06, 2011

Cold_Fussion, you're not understanding me. Everything is matched byte by byte of code. You obviously have a mild case of down syndrome.

 Respond  
Jethro   -  Dec 15, 2010

Trev's script could have been improved quite a bit without global vars and aliases:

On $*:Text:/^([!.@])FML$/Si:#:{
  if ($sock(FML.)) sockclose $v1 
  sockopen FML. rscript.org 80 
  sockmark FML. $iif($regml(1) = @,.msg #,.notice $nick)~$&
    $+($chr(3),1,$chr(40),$chr(3),2,Random FML™,$chr(3),1,$chr(41))
}
On *:SOCKOPEN:FML.:{
  sockwrite -n $sockname GET /lookup.php?type=fml HTTP/1.1 
  sockwrite -n $sockname Host: rscript.org $+ $str($crlf,2)
}
On *:SOCKREAD:FML.:{
  if (!$sockerr) {
    var %fml | sockread %fml
    if (Text:* iswm %fml) {
      $gettok($sock(FML.).mark,1,126) $&
        $replace($v2,Text:,$gettok($sock(FML.).mark,2,126))
      sockclose FML.
    }
  }
}

Though a trigger protection is recommended.

 Respond  
Cold_Fussion   -  Dec 15, 2010

yeah but my layout looks better.... no offence..... but ya :D kthnxbye

 Respond  
Trev   -  Nov 27, 2010

Cold_Fussion, I don't know if you realized that "your own little spin" on my script happens to be the EXACT same.

 Respond  
Pkxpkz   -  Feb 16, 2010

Working nice, i like it, thanks

 Respond  
Cold_Fussion   -  Dec 23, 2009
Alias cc1 return $+($chr(3),10,$1-)
Alias cc2 return $+($chr(3),10,$1-)
Alias lg return ~4 $1 ~
On $*:TEXT:/^[!.@]fml/Si:#: { 
  sockopen FML. rscript.org 80 
  set %fml.temp $iif($mid($1,1,1) == $chr(64),msg #,msg #)
}
On *:SOCKOPEN:FML.: {
  sockwrite -n $sockname GET /lookup.php?type=fml HTTP/1.1 
  sockwrite -n $sockname Host: rscript.org
  sockwrite -n $sockname $crlf 
}
On *:SOCKREAD:FML.: {
  if ($sockerr) { halt }
  Else {
    var %fml 
    sockread %fml
    if (Text:* iswm %fml) {
      tokenize 32 %fml
      set %fml.text $2-
      %fml.temp $lg(Fkuc My Life) %fml.text
      unset %fml.*
      sockclose FML.
    }
  }
}

just my own little spin on it... :D

 Respond  
Purplebeard   -  Nov 25, 2009

if you change all the fml's to mlia's would it work for MLIA?

 Respond  
Ghost-writer   -  Sep 21, 2009

can i l33ch it?

 Respond  
Spanky   -  Sep 05, 2009

change the sockclose fml to
sockclose fml.

or do what was said earlier

mountaindew
Code:
if ($sock(FML.)) sockclose $v1

 Respond  
Purplebeard   -  Aug 03, 2009

g

 Respond  
Trev   -  Jul 14, 2009

DragonHeart.

To change the color of the outputs, using the alias I provided you simply need to change the number within the alias

I.E.

Alias cc1 return $+($chr(3),01,$1-)
Alias cc2 return $+($chr(3),02,$1-)
Alias lg return $+($cc1($chr(40)),$cc2($1 $+ $chr(153)),$cc1($chr(41)))

$chr(3),01 <- Change that number

 Respond  
DragonHeart   -  Jul 12, 2009

great script... one question, how would I change the color of the output?

 Respond  
guest598594   -  Jul 06, 2009
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.