SRL Archive - Research & Development Lounge

World list parser


mixster

2008-10-18 12:53:34

program RSWorldParser;
type
world = record
num, pla: Integer;
pre, fla, loc, act: string;
loo, qui, pvp, mem: Boolean;
end;
var
worldList: array of world;
str: string;
tsa, tsb: TStringArray;
w: Integer;
dlgSave: TSaveDialog;

function Explode(str, del: string): TStringArray;
var
i, l: Integer;
begin
i := 0;
l := -1;
repeat
Inc(l);
SetLength(Result, l + 1);
i := Pos(del, str);
if i <= 0 then
Break;
Result[l] := Copy(str, 1, i - 1);
Delete(str, 1, i + Length(del) - 1);
until false
Result[l] := Copy(str, 1, Length(str));
end;

begin
dlgSave := TSaveDialog.Create(nil);
dlgSave.Filter := 'ini files|*.ini';
if not dlgSave.Execute then
TerminateScript;
str := GetPage('http://www.runescape.com/slu.ws?order=WMPLA');
Delete(str, 1, Pos('<a href="?order=MWPLA">', str));
Delete(str, 1, Pos('<tr', str) + 3);
tsa := Explode(str, '<tr');
SetLength(worldList, High(tsa) + 1);
for w := 0 to High(tsa) do
with worldList[w] do
begin
tsb := Explode(tsa[w], '<td');
if High(tsb) <= 7 then
begin
Writeln('Skipping world ' + IntToStr(w + 1) + ' because explosion didn''t return enough values');
Continue;
end;
pla := StrToIntDef(Copy(tsb[2], 2, Pos(' Players', tsb[2]) - 2), 2000);
fla := Between('"', '"', tsb[3]);
case Uppercase(fla) of
'US': loc := 'United States';
'UK': loc := 'UK';
'NL': loc := 'Netherlands';
'CA': Loc := 'Canada';
'AU': Loc := 'Australia';
'SE': Loc := 'Sweden';
'FI': Loc := 'Finland';
'NO': Loc := 'Norway';
end;
pre := Between('http://', '.runescape', tsb[1]);
if pre = '' then
pre := Replace(Lowercase(Between('>' + #10, #10 + #10, tsb[1])), ' ', '');
num := StrToIntDef(Replace(pre, 'world', ''), -1);
if num = -1 then
Writeln(tsb[1] + ' || ' + pre);
act := Between('>', '<', tsb[4]);
loo := Between('title="', '"', tsb[5]) = 'Y';
qui := Between('title="', '"', tsb[6]) = 'Y';
pvp := Between('title="', '"', tsb[7]) = 'Y';
mem := Between('>', '<', tsb[8]) = 'Members';
end;
WriteINI('Worlds', 'Count', IntToStr(High(worldList) + 1), dlgSave.FileName);
WriteINI('Worlds', 'High', IntToStr(worldList[High(worldList)].num), dlgSave.FileName);
for w := 0 to High(worldList) do
with worldList[w] do
begin
if mem then
str := 'Members'
else
str := 'Free';
WriteINI('World' + IntToStr(num), 'Prefix', pre, dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'Activity', act, dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'Type', str, dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'Flag', fla + 'Flag', dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'Location', loc, dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'Lootshare', BoolToStr(loo), dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'Quickchat', BoolToStr(qui), dlgSave.FileName);
WriteINI('World' + IntToStr(num), 'PvP', BoolToStr(pvp), dlgSave.FileName);
end;
end.

Parses the unsigned world list to the designated INI file. I've added other things to the world list that it collects such as whether or not it is a lootshare world.

Updated it to work - Jagex changed it very slightly to throw off prefix collecting which threw off everything else :)

Hugolord

2008-10-18 14:16:45

This thread is full of fail, here's your one reply.
Jks, thanks for this.

Freddy1990

2008-10-18 14:40:09

I'll go update FAWG, didn't realize there was still a page displaying all servers, lol, to think I almost released the sauce :p

Shuttleu

2008-10-18 14:43:27

yay ty freddy
much appriceated :)

~shut

mixster

2008-10-18 15:22:16

From: Freddy1990
I'll go update FAWG, didn't realize there was still a page displaying all servers, lol, to think I almost released the sauce :p

Was quite hard to find - stumbled upon it when looking the page sauce for the actual webpage as hidden text :)

From: Shuttleu
yay ty freddy
much appriceated :)

~shut

Thanks for staying on topic

GoF

2008-10-18 15:23:06

hmm. Nice. But saw this earlier on IRC too.

From: Shuttleu
yay ty freddy
much appriceated :)

~shut


Mind pulling your head out of his ass for a while?

Freddy1990

2008-10-18 15:55:23

From: GoF
Mind pulling your head out of his ass for a while?


Yea, it's quite uncomfortable… :p I updated FAWG, btw, nice script ;)

simen236

2008-10-18 16:55:50

Nice job. You too Freddy for updating FAWG.

Nava2

2008-10-19 17:56:39

Mixster, mind if I use this in my RandomWorld function? :)

mixster

2008-10-19 18:18:00

SmartWorld procedure is a RandomWorld procedure, except it's better since it chooses from 10 emptiest worlds and allows specific selection :)
Feel free to modify it though if you feel my awesome scripting isn't good enough ;)

Nava2

2008-10-21 06:34:58

From: mixster
SmartWorld procedure is a RandomWorld procedure, except it's better since it chooses from 10 emptiest worlds and allows specific selection :)
Feel free to modify it though if you feel my awesome scripting isn't good enough ;)

*Insert Sexual Innuendo here* YOU!

I will look more into it :P

mixster

2008-11-02 17:17:26

With Freddy's latest update to FAWG, I felt I should go through and double check mine worked nicely. It did, except for 2 things: Explode worked slightly incorrectly, but as it was scripted around it, it didn't matter (though I fixed it anyway:)) and some activities had class=d> before them, because RS can't keep their standards right and randomly included that some worlds (World 160 and 161 for example), though I think it may be randomly done, but has been fixed so it works nicely all the time now (I think, haven't found any others).

Also, (as edit says on first post), FAWG's recent update has kind of stopped it working too well, mainly as Freddy has parsed them incorrectly assigning world numbers to the random worlds (world 1 has a location of world169.runescape.com, for example). Similarly, mine still has more accurate information for the various fields. The two are no longer directly compatible as Freddy has used 1/0 instead of True/False for QuickChat/PvP/LootShare.

I decided to remove url from the output list to try to shorten it slightly as I don't think it was ever used. I may also remove flag and/or location to get it shorter as I don't know of anyone or script that actually uses that information.

Lastly, I would like to know if anyone uses any of the other outputs from FAWG, as I may make a similar parser that creates the world list FAWG uses, thus enabling it to generate more accurate read outs as Freddy seems to be a bit slow with updates to FAWG, so will enable people who prefer to use FAWG able to still make the format they love, else will make specific parsers that generate the files for the appropriate format.

Yakman

2008-11-18 11:34:47

nice script

[-jesus-]

2008-11-18 11:35:21

From: Yakman
nice script


mhm!

Nava2

2008-11-25 15:10:19

Just so you are aware, I linked this in my SMART Fixes post. :)

Its kinda necessary ;)

We run u.s.

2008-11-25 16:02:54

Mixmaster, you've talked much about FAWG and about this script, but tell me where to implement it please? What file/ folder maybe?

Baked0420

2008-11-27 12:50:21

omg I'm so confused with this stuff, I knew I would be when trying to fix smart, why I havent bothered to till now. is this to update the worlds.ini, because that's what I thought at first but I don't know now, because I tried and I still got the error abotu the world prefix. I'm sorry to sound nooby, but can someone P.M. their worlds.ini folder or send me a thread where someone has it attatched or something.

EDIT: the first script in this post I thought was updating my worlds.ini folder but I still got the error and the 3rd script I don't know what it was trying to do but it'd only let me chose Ln folders I think if i remeber correctly, and I just ran the second script and I have no clue what it's purpose was either it was just writing worlds in the debug box each time I ran it. I'll try reading this post better instead of scimming it and see if I can figure this out.

EDIT2: nevermind I found a post with the worlds.ini file, I still don't know what these do, but I don't think I really need them anymore, but thanks anyway, if I could of figured out how to use them I'm sure they would of helped lol (laughing at my stupidity).

jumbosped

2008-12-05 22:04:59

Hey, this seems like a very helpful script because i am getting the world problem, but let me get this right, i should use the latest RSWorldParser script you have up and save it in my FAWG folder and then open FAWG, turn off update automatically and choose ini file parser and say parse output?

Freddy1990

2008-12-12 14:46:05

From: mixster
With Freddy's latest update to FAWG, I felt I should go through and double check mine worked nicely. It did, except for 2 things: Explode worked slightly incorrectly, but as it was scripted around it, it didn't matter (though I fixed it anyway:)) and some activities had class=d> before them, because RS can't keep their standards right and randomly included that some worlds (World 160 and 161 for example), though I think it may be randomly done, but has been fixed so it works nicely all the time now (I think, haven't found any others).

Also, (as edit says on first post), FAWG's recent update has kind of stopped it working too well, mainly as Freddy has parsed them incorrectly assigning world numbers to the random worlds (world 1 has a location of world169.runescape.com, for example). Similarly, mine still has more accurate information for the various fields. The two are no longer directly compatible as Freddy has used 1/0 instead of True/False for QuickChat/PvP/LootShare.

I decided to remove url from the output list to try to shorten it slightly as I don't think it was ever used. I may also remove flag and/or location to get it shorter as I don't know of anyone or script that actually uses that information.

Lastly, I would like to know if anyone uses any of the other outputs from FAWG, as I may make a similar parser that creates the world list FAWG uses, thus enabling it to generate more accurate read outs as Freddy seems to be a bit slow with updates to FAWG, so will enable people who prefer to use FAWG able to still make the format they love, else will make specific parsers that generate the files for the appropriate format.


I'm currently working on FAWG, but until it's finished you might as well get a Worlds.ini file from FAWG-Online which is still in development stage, but the parser itself is complete and such, write a bit of code to pour it into an ini file: http://freddy1990.com/fawg-online.php
(EDIT: yea I noticed it still has a couple of small bugs, but I'll tweak those once I get home)
EDIT2: Tehre, that's fixed, it was showing french and german worlds as well

magixboy

2008-12-13 02:13:26

Once it opened SMART, it logged me in and says that im not a member.

How can i fixed this? I dun understand about world.ini..
CAn u explain to me step by step

Freddy1990

2008-12-16 15:39:23

From: magixboy
Once it opened SMART, it logged me in and says that im not a member.

How can i fixed this? I dun understand about world.ini..
CAn u explain to me step by step


That's mean that you're not a member…

From: mixster
The two are no longer directly compatible as Freddy has used 1/0 instead of True/False for QuickChat/PvP/LootShare.


It is changeable in the script…

magixboy

2008-12-17 07:38:35

From: Freddy1990
That's mean that you're not a member…


I know.. im not 1.. How can i change to use free users?!

Freddy1990

2008-12-18 07:42:44

From: magixboy
I know.. im not 1.. How can i change to use free users?!


That'll depend on the script…