Widget
2010-02-15 16:51:32
RSBot now injects their hooks on the fly using a list on the internet, so this downloads and parses it
Edit: Works on Simba now, <3 ray
I think J_Pizzle and whoever else are working pretty hard, and this should make updating hooks a piece of cake if someone makes a list of what hook goes with what :)
Edit: Compiles on Simba, GetPage function still broken though
Edit: Works on Simba now, <3 ray
program new;
function Explode(str, del: string): TStringArray;
(* Missing in Simba *)
var
i, l, dL: Integer;
begin
i := 0;
l := -1;
SetLength(Result, 0);
if (str = '') then
Exit;
dL := Length(del) - 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 + dL);
until false
Result[l] := Copy(str, 1, Length(str));
end;
function GetLetters(s: string): string;
(* Missing in Simba *)
var
i: integer;
begin
for i := 1 to Length(s) do
if (Ord(s[i]) >= Ord('A')) and (Ord(s[i]) <= Ord('Z')) or
(Ord(s[i]) >= Ord('a')) and (Ord(s[i]) <= Ord('z')) then
Result := Result + s[i];
end;
var
i, line: integer;
page: string;
arraything, outputlines: array of string;
begin
ClearDebug;
page := GetPage('http://rsbot.svn.sourceforge.net/svnroot/rsbot/data/info.dat');
arraything := Explode(page, #0);
Writeln('length: '+IntToStr(Length(arraything)));
for i := 1 to High(arraything)-1 do
begin
// Writeln('i: '+inttostr(i)+', line: '+inttostr(line));
// Missing in Simba: StartsWith
if (Pos('Lorg', arraything[i]) = 1) or (Pos('Ljava', arraything[i]) = 1) or (Pos('[', arraything[i]) = 1) then Continue;
if Length(arraything[i]) > 2 then
begin;
Inc(line);
SetArrayLength(outputlines, Line + 1);
outputlines[line] := GetLetters(arraything[i]) + ' = ';
end
else
begin
// Missing in Simba: EndsWith
if outputlines[line][Length(outputlines[line])] = ' ' then
outputlines[line] := outputlines[line] + arraything[i]
else
outputlines[line] := outputlines[line] + '.' + arraything[i];
end;
end;
for i := 0 to High(outputlines) do
Writeln(outputlines[i]);
end.I think J_Pizzle and whoever else are working pretty hard, and this should make updating hooks a piece of cake if someone makes a list of what hook goes with what :)
Edit: Compiles on Simba, GetPage function still broken though