SRL Archive - RS3 Utility Scripts

Random Fact Generator


kanah

2011-10-23 09:15:36

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

2011-10-23 09:34:20

"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

2011-10-23 11:53:38

Pretty neat! Thanks for posting this. :) Rep+

Tickyy

2011-10-23 12:45:57

This is what I've got…

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


i luffs yeww

2011-10-23 14:30:32

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

2011-10-24 22:54:38

ReGeX! :)

Kosova

2011-12-28 17:26:47

Lol

hoopla

2012-03-19 23:45:25

Very interesting! WOuld love to see more antis like this in includes for Simba…

stuartroad

2012-04-04 02:11:07

From: hoopla
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

2012-04-04 08:10:17

I like it! I pretty much know all of these though… because I has no lyfes