SRL Archive - Research & Development Lounge

Emptiest World


mixster

2008-04-12 16:44:35

After getting annoyed with using Prisoner's random world procedure (not because of the procedure itself) returning fairly full worlds. With that in mind, I remember seeing a function previously that returned the least populated world, thus I decided to make a function that did the same thing. Now, I have had a look around (tried a search, but it came up with pretty much every script thread and quite a lot of help ones too) and couldn't find it, so it could be the exact same code or it could be completely different, either way all I know is it works :) So here it is

function EmptiestWorld(members, prefix: Boolean): string;
var
website: string;
begin
case members of
False: website := GetPage('http://www.runescape.com/slj.ws?lores.x=1&plugin=0&order=MPLAW');
True: website := GetPage('http://www.runescape.com/slj.ws?lores.x=1&plugin=0&order=mPLAW');
end;
Delete(website, 1, Pos('function e(w,m,s,a,dt,h,p,l) ', website) + 50);
case prefix of
False: Result := Between(' e(', ',', website);
True:
begin
Delete(website, 1, Pos('",', website) + 3);
Result := Between(',"', '",', website);
end;
end;
end;
members: true for members and false for free world
prefix: true to return a prefix and false for a world number (depending on if you want to use it with SmartSetup or SmartSetupEx).

Enjoy! (and if you want to criticise, I have a handy report link in my sig) :)

faster789

2008-04-12 19:27:20

awsum!!..rep+ this can come handy!

drizzt

2008-04-13 16:13:20

this is really cool, but maybe a nice thing you could do is somehow get a random like 1 - 10 emptiest worlds?

mixster

2008-04-13 16:23:05


function EmptiestWorld(members: Boolean): string;
var
i: Integer;
website: string;
worlds: array of string;
begin
case members of
False: website := GetPage('http://www.runescape.com/slj.ws?lores.x=1&plugin=0&order=MPLAW');
True: website := GetPage('http://www.runescape.com/slj.ws?lores.x=1&plugin=0&order=mPLAW');
end;
Delete(website, 1, Pos('function e(w,m,s,a,dt,h,p,l) ', website) + 50);
while GetArrayLength(worlds) < 10 do
begin
SetArrayLength(worlds, GetArrayLength(worlds) + 1);
Delete(website, 1, Pos('",', website) + 3);
worlds[GetArrayLength(worlds) - 1] := Between(',"', '",', website);
Delete(website, 1, Pos('",', website) + 3);
end;
Result := worlds[Random(10)];
end;
That should work Drizzt, though I thought I might as well take out the world number part as it's much more reliable to use the world prefix anyway and it takes too much effort to code the same thing twice ;)

Brain

2008-04-13 16:46:05

well this looks pretty good…and I have you rep +, not because of this code, but because you rick rolled me…thanks…

drizzt

2008-04-13 16:58:58

From: Brain
well this looks pretty good…and I have you rep +, not because of this code, but because you rick rolled me…thanks…


thats why you look at the links before you click them :p RickRoll/Rickroll.php should give off some warning signs

Brain

2008-04-13 17:44:19

Yeah I suppose so, but a good rick roll always makes me laugh a little :p

mixster

2008-04-13 18:17:22

I would've gone for a more complex rick roll link so people who did check it out would still go on it, but I'm lazy and I reckon people would complain too much :) Anyway, I've gotten 5 people rep me for this in just over a day, which is probably the highest rep to time ratio I've had in a long time and I practically lived in the help section when I first started getting into Scar, which makes this very weird… Ahwell, thanks for the rep anyway :)

EvilChicken!

2008-04-14 04:52:03

Ogod. You own.

I can use tihs in my skript?
w´hithh credit åffcorse.

Lee Lok Hin

2008-04-14 05:26:09

Nice! Would this count toward negative for a srl-member application, because I did not make it myself? Anyway, nice function.

Btw, how about Report Me Here!!!

And you rickroll seems to be down. =/

Torrent of Flame

2008-04-14 05:35:18

Nah his RickRoll worked for me.

I dotn get the RickRolled though? And I hate you for making me spend 5 minutes trying to click the "X" :P

mixster

2008-04-14 20:24:13

I hate you for trying to report me.
Anyway, @EvilChickin, go for it, I don't mind if you use it :)
@leelokhin, it won't count negatively unless you claim ownership of it and get found out. Just make sure you read a couple of tuts about applying for members before you do so you can increae your chance of getting in ;)