Random fact

Platform:  mIRC
Published  Oct 06, 2008
Updated  Oct 06, 2008
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,) }

Comments

Sign in to comment.
Jethro   -  Jun 09, 2011
From my own experience, the body heat can melt the chocolate bar too. :P
 Respond  
irchainscriptz   -  Jun 09, 2011
Had to love the Fact I first started with LOL

Quote

[11:07:17] <~Chain> The microwave was invented after a researcher walked by a radar tube and a chocolate bar melted in his pocket.
 Respond  
Person   -  Jun 09, 2011
LOL@ go uselessness
Really good script , ive used it a few times to break the ice or change the subject of a convo,and it worked nicely.
I like it :D
 Respond  
UK-Sw1ft   -  Apr 07, 2010
iv allways used 6.16, thats what i had when before i quit for 2 years, so i went back to it when i come back lol
 Respond  
napa182   -  Apr 01, 2010
lol im still using 6.31 smh
 Respond  
Jethro   -  Apr 01, 2010
Is there a valid reason for you to stop from upgrading to 6.35? The version you have is literally 5 years old.
 Respond  
UK-Sw1ft   -  Apr 01, 2010
jethro, my bot is 6.16, and its nothing todo with the mIRC itself, thats perfectly ok.
 Respond  
NaX   -  Mar 31, 2010
Oh okey ^_^
 Respond  
napa182   -  Mar 30, 2010
NaX Said:

Quote

Is there a way to make a "msg" command? Like:

/msg <bot> fact

or

!fact
<Bot> Random fact

:D ?


trigger for ur self is /fact for others @fact

Code

 
 Respond  
NaX   -  Mar 30, 2010
Is there a way to make a "msg" command? Like:

/msg <bot> fact

or

!fact
<Bot> Random fact

:D ?
 Respond  
Jethro   -  Mar 30, 2010
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:

Quote

<@Jethro> 'Stewardesses' is the longest word that is typed with only the left hand.
<@Jethro> Humans blink over 10,000,000 times a year!
 Respond  
UK-Sw1ft   -  Mar 30, 2010
it is turned on because i put it on my bot, but still, nothing :/
 Respond  
Jethro   -  Mar 29, 2010
UK-Sw1ft, it's working for me. Make sure your remote is turned on by entering

Quote

/remote on
Or better yet, place this script in a new remote.
 Respond  
UK-Sw1ft   -  Mar 29, 2010
dosnt work for me :/, i type /fact and it dosnt do anything at all
 Respond  
^Neptune   -  Nov 11, 2008

Code

 

change to:

Code

 


Put this in your aliases:

Code

 

and type /timerfact NUMBER_OF_SECONDS_INTERVAL to start it.

Code

 

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.
 Respond  
postman   -  Nov 04, 2008
How would I add a timer to this script so that it will say a random fact in a designated channel every x minutes?
 Respond  
EL   -  Oct 07, 2008
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.
 Respond  
^Neptune   -  Oct 07, 2008

Quote

Nice htmlfree alias. Code that all by yourself?


I've had that for like.. forever. Not sure where I got it in the first place. Everyone has one anyways. :P
 Respond  
EL   -  Oct 06, 2008
Rofl.
 Respond  
napalm`   -  Oct 06, 2008
Nice htmlfree alias. Code that all by yourself?
 Respond  
^Neptune   -  Oct 06, 2008
Updated:

Includes socket error checking and added in the $htmlfree alias. Can't believe I forgot to put that in.
 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.