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
}
}
}
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),",",&,&)
sockclose twilight
}
}
the script dont work so good for me..
it's errors out 4 times out of 5 trys.
maybe work on that
<~napa182> !mlia
Best Today
<&Sick0> Life is pretty normal today.
<~napa182> !mlia
<&Sick0>
<~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
}
}
}