Markus
2009-11-17 15:23:01
Probably already millions of these floating around, but I had to make my own of course x)
Gets the Grand Exchange price through the website.
Gets the Grand Exchange price through the website.
function GetGEPrice(id : integer) : integer;
var
s, s2 : string;
hoi : Extended;
begin
s := GetPage('http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj='+inttostr(id));
s2 := trim(Between('<b>Market price:</b>', #10, s));
if pos('m', s2) <> 0 then
begin
Delete(s2, length(s2), 1);
hoi := StrToFloat(s2);
hoi := hoi * 1000000;
result := floor(hoi);
exit;
end;
if pos('k', s2) <> 0 then
begin
Delete(s2, length(s2), 1);
hoi := StrToFloat(s2);
hoi := hoi * 1000;
result := floor(hoi);
exit;
end;
result := StrToInt(GetNumbers(s2));
end;