PDA

View Full Version : [Utility] Random Fact Generator



kanah
10-23-2011, 01:15 PM
Do you need something to write out in your scripts while your character is doing something?

Do you need entertainment while your bot is running? Try this function: GetRandomFact.

GetRandomFact grabs a random fact from the web and places it in a string for you! Writeln it or paint it on smart, the posibilities endless.


function GetRandomFact: string;
//This function returns a random fact from
// the website 'http://randomfactgenerator.net/'
// Author: kanah
// Special thanks to Euphemism for the idea
var
SearchString0, SearchString1, Text: string;
begin
//Search strings are used to mark the begining and end of useful info
SearchString0 := '<div id="facts">';
SearchString1 := '<br/><br/>';

//Text is loaded with the raw html text from the website
Text := GetPage('http://randomfactgenerator.net/');

//Text is now broken down from the entire html page into the random fact
Text := Between(SearchString0,SearchString1,Text);

//Now trim to remove spaces and get rid of the "<div>" text
Trim(Text);
delete(Text,1,pos('>',Text));
Result := Text;
end;

did you know?
Europe is the only continent without a desert.

euphemism
10-23-2011, 01:34 PM
"In 1976 an LA secretary named Jannene Swift officially married a 50 pound rock in a ceremony witnessed by more than 20 people."

The function turned out really nice!

Flight
10-23-2011, 03:53 PM
Pretty neat! Thanks for posting this. :) Rep+

Tickyy
10-23-2011, 04:45 PM
This is what I've got...

" The smallest human penis ever recorded was just 5/8 of an inch long! "

http://2.bp.blogspot.com/-s7k9GEpgwSo/TaSHXVae_YI/AAAAAAAAA6Y/OoKM9uZskjw/s1600/huh.jpeg

i luffs yeww
10-23-2011, 06:30 PM
Not gonna tell you how exactly, but you could get all three facts relatively easily. ;) Hint: they are all within " data-text=' " (no spaces), and " ' ". :)

Nava2
10-25-2011, 02:54 AM
ReGeX! :)

Kosova
12-28-2011, 10:26 PM
Lol

hoopla
03-20-2012, 03:45 AM
Very interesting! WOuld love to see more antis like this in includes for Simba...

stuartroad
04-04-2012, 06:11 AM
Very interesting! WOuld love to see more antis like this in includes for Simba...

but then again, thousands of people running around quoting random things? not suss :|

Joe
04-04-2012, 12:10 PM
I like it! I pretty much know all of these though... because I has no lyfes