Random MLIA

By knoeki on Jan 04, 2010

After many requests from people, I finally decided to stop being lazy and spend about 10 minutes to cook up this; an MLIA script.

For those of you that have no idea what MLIA is; it's kind of like FML which is kind of like grouphug.us which is kind of like god knows what else like it came before that. The main difference is that it's about how average people's lifes supposedly are (although I'd prefer to say "awesome" ;_)).. for more info, http://mylifeisaverage.com

Just load it into your bots remotes, or your own, whatever you wish, and have fun ;_) you'll get a random MLIA every time someone types !mlia

The code isn't anything impressive, nor does it need to be. If you're one of those people that gets sexually excited about incredibly short yet unreadable code, this isn't for you ;_) it works fine, it's not HORRIBLY slow, and that's all that matters to me.

;; random MLIA script, (C) Knoeki 2010
;; All rights and/or wrongs reserved.

on *:TEXT:!mlia:#: {
    if (%mlia.flood. [ $+ [ $nick ] ] == $null) {
        set -u20 %mlia.flood. [ $+ [ $nick ] ]
        mlia $chan
    }
}

alias mlia {
    set %mlia.count 1
    set %mlia.get 1
    set %mlia.chan $1
    sockopen mlia mylifeisaverage.com 80
}

on *:SOCKOPEN:mlia: {
    sockwrite -n $sockname GET $+(/,%mlia.get) HTTP/1.1
    sockwrite -n $sockname Host: mylifeisaverage.com
    sockwrite -n $sockname Connection: keep-alive
    sockwrite -n $sockname $crlf
}

on *:SOCKREAD:mlia: {
    sockread %mlia.raw
    if (%mlia.send == 1) {
        msg %mlia.chan %mlia.raw
        sockclose $sockname
        unset %mlia.*
    }
    if (%mlia.count == 2) {
        if (<div class="sc"> isin %mlia.raw) {
            inc %mlia.count.post
            if (%mlia.count.post == %mlia.rand.post) {
                set %mlia.send 1
            }
        }
    }
    else {
        if (<li class="jump "> isin %mlia.raw) {
            var %mlia.pages.total $remove($gettok(%mlia.raw, 3, 59), </li>)
            sockclose $sockname
            set %mlia.rand.page $rand(1, %mlia.pages.total)
            set %mlia.rand.post $rand(1, 10)
            set %mlia.count 2
            set %mlia.get %mlia.rand.page
            sockopen mlia mylifeisaverage.com 80
        }
    }
}

Comments

Sign in to comment.
Spanky   -  Jan 12, 2010

LMAO,

iv got mlia, fml mlit tfln i want to get them all :x >_> they are good if bored or if you need a quick "lol"

 Respond  
napa182   -  Jan 12, 2010

lol this one cracked me up notice they put FML at the end

<&Sick0> Over the past couple of weeks I've been taking notice of how much people are talking about Twilight. It seems where ever I turn there's someone talking and/or obsessing about it. I can't seem to get away from this crap. MLIT. FML.

 Respond  
Spanky   -  Jan 12, 2010

thanks and okay il try it out

 Respond  
napa182   -  Jan 12, 2010

Spanky Said:

PSSST someone do a my life is twilight one :D

@Spanky heres a fast mock up.
edited: to replace the " and & crap

on $*:text:/^@mlit$/iS:#: { 
  if (!%f) {
    inc -u4 %f
    if ($sock(twilight)) sockclose twilight 
    sockopen twilight www.mylifeistwilight.com 80 
    sockmark twilight msg #
  }
}
on *:sockopen:twilight: {
  sockwrite -nt $sockname GET /random HTTP/1.1 
  sockwrite -nt $sockname Host: $+($sock(twilight).addr,$str($crlf,2)) 
}
on *:sockread:twilight: {
  var %twilight | sockread %twilight
  if ($regex(%twilight,/\t{1}<a href=.+"fmllink">(.+)<\/a>/)) {
    $sock(twilight).mark $replace($regml(1),&quot;,",&amp;,&) 
    sockclose twilight 
  }
}
 Respond  
Spanky   -  Jan 12, 2010

PSSST someone do a my life is twilight one :D

 Respond  
knoeki   -  Jan 05, 2010

Updated it, out of 10 tries, it worked 10 times ;_)

 Respond  
knoeki   -  Jan 04, 2010

weird, seems to work always for me. I'll give it another look in the morning, meanwhile, more info is welcome if you have it :_)

 Respond  
napa182   -  Jan 04, 2010

the script dont work so good for me..
it's errors out 4 times out of 5 trys.
maybe work on that

<~napa182> !mlia
<&Sick0> Life is pretty normal today.
<~napa182> !mlia
<&Sick0>

Best Today
<~napa182> !mlia
<&Sick0> Life is pretty normal today.
<~napa182> !mlia
<&Sick0> Today I discovered you can make sims 'play' in a bath tub. They act like a pirate. Best discovery of my life. MLIA
<~napa182> !mlia
<&Sick0> Best Today

you can do it like this as well

on $*:text:/^!mlia$/iS:#: {
  if (!$hget(mlia,c)) {
    if ($sock(mlia)) .sockclose mlia
    sockopen mlia mylifeisaverage.com 80
    sockmark mlia $r(1,3) $+(/,$r(2,1000)) msg #
  }
}
on *:sockopen:mlia: { 
  sockwrite -nt mlia GET $gettok($sock(mlia).mark,2,32) HTTP/1.1 
  sockwrite -nt mlia Host: $+($sock(mlia).addr,$str($crlf,2)) 
}
on *:sockread:mlia: {
  var %mlia | sockread %mlia
  if ($regex(%mlia,/(Today.+MLIA)/)) { 
    hinc -mu4 mlia c  
    if ($hget(mlia,c) = $gettok($sock(mlia).mark,1,32)) { 
      $gettok($sock(mlia).mark,3-,32) $regml(1)
      sockclose mlia
    }
  }
}
 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.