PDA

View Full Version : Getting member status from the script.



CynicRus
08-15-2013, 06:54 AM
Hey. Very simple implementation of the GetMemberStatus function, and so slowly now:)

program new;

function GetMemberStatus(Name: string):boolean;
var
info,addr: string;
i,j: integer;
begin
addr:= 'http://services.runescape.com/m=adventurers-log/display_player_profile.ws?searchName=';
info:=GetPage(addr+name);
j:=PosEx('<span class="G0">',info,16000);
if (J <> 0) then
begin
i:=PosEx('Non-member Account',info,J);
if I<>0 then
result:=false
else
result:=true;
end
else
begin
WriteLn('Error: We dont have info!');
Result:=false;
exit;
end;
end;

begin
writeLn(ToStr(GetMemberStatus('CynicRus')));
writeLn(ToStr(GetMemberStatus('Jake')));
end.

Output:

Compiled successfully in 15 ms.
False
True
Successfully executed.

YoHoJo
08-15-2013, 07:13 AM
Pretty neat mean, you are always making some creative stuff! :)

masterBB
08-15-2013, 09:08 AM
Nice function! Shortened it a bit and made the standards like that kaitnieks thread because I think some newer scripters could use this:


program new;

function GetMemberStatus(Name: string):boolean;
var
info, addr: string;
spanPos: integer;
begin
Result := false;
addr := 'http://services.runescape.com/m=adventurers-log/display_player_profile.ws?searchName=';
info := GetPage(addr + name);
spanPos := PosEx('<span class="G0">', info, 16000);
if (spanPos <> 0) then
result := PosEx('Non-member Account', info, spanPos) = 0
else
WriteLn('Error: We dont have info!');
end;

begin
writeLn(ToStr(GetMemberStatus('CynicRus')));
writeLn(ToStr(GetMemberStatus('Jake')));
end.

riwu
08-15-2013, 11:42 AM
Simpler version ;)
http://villavu.com/forum/showthread.php?t=105250&p=1260190#post1260190

Ian
08-15-2013, 01:55 PM
Nice! Now even if a user accidentally put that they were members the script can correct them and avoid wasting time logging into a members world :)