This, quite simply, pulls a random fact from www.randomfunfacts.com and displays it to the active channel. Load this into your remotes and type /fact to make it work.
Go uselessness!
alias fact {
if ($sock(fact)) { sockclose fact }
sockopen fact www.randomfunfacts.com 80
}
on *:sockopen:fact: {
if ($sockerr) {
echo -a * There was a problem connecting to the website. Please try again.
sockclose fact
}
else {
sockwrite -n $sockname GET / HTTP/1.0
sockwrite -n $sockname Host: www.randomfunfacts.com $+ $crlf $+ $crlf
}
}
on *:sockread:fact: {
if ($sockerr) {
echo -a * There was a problem retrieving data from the website. Please try again.
sockclose fact
}
else {
sockread %fakt
if (<font face="Verdana" size="4"><strong><i> isin $remove(%fakt,$chr(9))) {
set %fact $left($htmlfree(%fakt),-6)
}
}
}
on *:sockclose:fact: {
if (%fact) { msg $active %fact }
unset %fakt %fact
}
alias htmlfree { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
NaX Said:
Is there a way to make a "msg" command? Like:
/msg fact
or
!fact
Random fact :D ? trigger for ur self is /fact for others @fact ``` alias fact { if (!%f) { inc -u3 %f if ($sock(facts)) sockclose facts sockopen facts www.randomfunfacts.com 80 sockmark facts msg # [You're Random Fact] } } on $*:text:/^@fact$/iS:#:fact on *:sockopen:facts: { sockwrite -n facts GET / HTTP/1.1 sockwrite -n facts Host: $+($sock(facts).addr,$str($crlf,2)) } on *:sockread:facts: { var %facts | sockread %facts if ($regex(%facts,/(.+)<\/i>/)) { $sock(facts).mark $regml(1) sockclose facts } } ```You do not happen to use a very, very old version of mIRC, do you? Also, some cracked mIRC may be defective. The only legit place to download mirc is straight from www.mirc.com
Anyway, I don't know why it fails for you while it works for me perfectly:> <@Jethro> 'Stewardesses' is the longest word that is typed with only the left hand.
<@Jethro> Humans blink over 10,000,000 times a year!
if (%fact) { msg $active %fact }
change to:
if (%fact) { msg #YOUR_CHANNEL %fact }
Put this in your aliases:
alias timerfact { .timerfact 0 $1 fact }
and type /timerfact NUMBER_OF_SECONDS_INTERVAL to start it.
alias factstop { timerfact off }
will turn it off.
This of course only works for a single server. If you're on two, just let me know and I can think of something else for ya.
Ok works so im happy and i know YOU made it.A few suggestions ,maybe have a bot mode !trigger and add protections so i dont have to comment on that;p,also maybe a timer mode to send random facts to a channel or series of channels(if allowd by the chan owners of course),Some colors,also make it so it won't tell the same fact back to back - can use a simple var for that.Small dialog should sufice for these upgrades and gib it soem flare.Nice work over all tho socket works fine.