SRL Archive - OSR Help

adding a login procedure + checking if logged in to my first script?


L2Program

2010-02-25 13:33:53

heres my script if anyone can help i would appreciate it, then i can use it in future scripts!

[PHP]program Pickpocketing;
{.include SRL/SRL.scar}

const
GuardColor= 689068;//colour of the guard

var
pickpocketbmp : Integer;

var x,y: Integer;

procedure LoadBmps;
begin

pickpocketbmp := BitmapFromString(195, 15, 'beNrtmFGOgzAMRHO7X' +
'qC/e/9jsFWpoqzH44whEVQblA8IjjH1w57m+Sil/Dwfr7E1xz4jjg' +
'NLrvK8baWOGQHXR7C7ZSvlfbeeDByiz92MGbfzqSANSK/LbPrqwkk' +
'giZ67Ye8p3o95LNWn0Ax+IvicDwcp9okx+IyVNEsIUrYU3AokZtxS' +
'VF98Tsw+SG0GxaTPAMm8ONYfdKIWOg6SCNV3gTSpo+kgpZI+A6Qoq' +
'kJBUvh0Wxv7eFFKsZ7IRJc+n/Ica7yaX9RI7aV7S5k081mQXN0SyJ' +
'XAXgfJFEnm5BhISJGb2Xqwhe0l8zDPM751m1+jkdpb7rlrbxqlATU' +
'FEtMtrk3Onutql6KBIGEiWMvDUoD4sUYZn5/33O04XXiwyLiAMRl/' +
'DKS4Urn6KloLR5eisSAF2iNONzaaUSCxFuZWqlEgMTwQlfiuChIAw' +
'wQws1czzim6A0is0ZwHSWmCijJPtTO9ag0DySsdbt6Zffbvv6jYZ4' +
'AUS+JWULG60RVjXc/oHIuVsiGJvSmej1FxLbt7fazIdP+LufYJkIL' +
'lf+e74CFIwdaK7bD4LcA5qxvMg+7ZFQDoId5FORZSvAfFQqIs8V/V' +
'jUF5nJhxJp/srEyRAemqLaB/NSZthF4e7QJpjVHILZDWuC1IX1fD1' +
'zg1fgH81TAR');
end;

procedure PickPocket;
begin
if FindColorTolerance(x, y, GuardColor, MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);//Use mouse for Runescape
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(3000+random(100));
end else Exit;
end;

begin
SetupSRL;
LoadBmps;
repeat
PickPocket;
until(false);
end.[/PHP]

NCDS

2010-02-25 13:40:11

All you need is a DeclarePlayers procedure like this:

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := ''; // 3-4 LOWERCASE letters from your username.
Active := True; // True = use this player.

SetArrayLength(PlayerReport, HowManyPlayers);
SetPlayerNameTPAs;
end;
end;

And then in the MainLoop, just put 'LoginPlayer;' where you want to log in.

Then put' if not LoggedIn then Exit;' wherever you want to check.

L2Program

2010-02-25 13:42:19

Cheers

1 error?

[PHP]program Pickpocketing;
{.include SRL/SRL.scar}

const
GuardColor= 689068;//colour of the guard

var
pickpocketbmp : Integer;

var x,y: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := 'name';
Pass := 'pass';
Nick := 'nam'; // 3-4 LOWERCASE letters from your username.
Active := True; // True = use this player.

SetArrayLength(PlayerReport, HowManyPlayers);
SetPlayerNameTPAs;
end;
end;

procedure LoadBmps;
begin

pickpocketbmp := BitmapFromString(195, 15, 'beNrtmFGOgzAMRHO7X' +
'qC/e/9jsFWpoqzH44whEVQblA8IjjH1w57m+Sil/Dwfr7E1xz4jjg' +
'NLrvK8baWOGQHXR7C7ZSvlfbeeDByiz92MGbfzqSANSK/LbPrqwkk' +
'giZ67Ye8p3o95LNWn0Ax+IvicDwcp9okx+IyVNEsIUrYU3AokZtxS' +
'VF98Tsw+SG0GxaTPAMm8ONYfdKIWOg6SCNV3gTSpo+kgpZI+A6Qoq' +
'kJBUvh0Wxv7eFFKsZ7IRJc+n/Ica7yaX9RI7aV7S5k081mQXN0SyJ' +
'XAXgfJFEnm5BhISJGb2Xqwhe0l8zDPM751m1+jkdpb7rlrbxqlATU' +
'FEtMtrk3Onutql6KBIGEiWMvDUoD4sUYZn5/33O04XXiwyLiAMRl/' +
'DKS4Urn6KloLR5eisSAF2iNONzaaUSCxFuZWqlEgMTwQlfiuChIAw' +
'wQws1czzim6A0is0ZwHSWmCijJPtTO9ag0DySsdbt6Zffbvv6jYZ4' +
'AUS+JWULG60RVjXc/oHIuVsiGJvSmej1FxLbt7fazIdP+LufYJkIL' +
'lf+e74CFIwdaK7bD4LcA5qxvMg+7ZFQDoId5FORZSvAfFQqIs8V/V' +
'jUF5nJhxJp/srEyRAemqLaB/NSZthF4e7QJpjVHILZDWuC1IX1fD1' +
'zg1fgH81TAR');
end;

procedure PickPocket;
LoginPlayer;
Wait(3000+random(100));
begin
if FindColorTolerance(x, y, GuardColor, MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);//Use mouse for Runescape
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(3000+random(100));
if not LoggedIn then Exit;
end else Exit;
end;

begin
SetupSRL;
LoadBmps;
repeat
PickPocket;
until(false);
end.[/PHP]

Error is:

[PHP]Line 25: [Error] (21807:16): Unknown identifier 'PlayerReport' in script C:\Users\Lewis\Desktop\scarprerelease\Scripts\Pickpocketvgaurdsv2.scar
[/PHP]

caused

2010-02-25 13:59:56

I don't see that "PlayerReports" does anything important for your script.

try to comment it out, and see what happens ;)


//SetArrayLength(PlayerReport, HowManyPlayers);

L2Program

2010-02-25 14:23:28

From: caused
I don't see that "PlayerReports" does anything important for your script.

try to comment it out, and see what happens ;)


//SetArrayLength(PlayerReport, HowManyPlayers);


thanks that worked but the script didnt work (didnt expect it to as its for a pserver not runescape.) So i wrote my own basic one which for some reason isnt work aswell! mind taking a look?

[PHP]program Pickpocketing;
{.include SRL/SRL.scar}

const
GuardColor= 689068;//colour of the guard

var
pickpocketbmp : Integer;

loginbmp : integer;

var x,y: Integer;

procedure LoadBmps;
begin

loginbmp := BitmapFromString(88, 26, 'beNrtmM9LQkEQx/2DOlXHDhZ' +
'16A/wEC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rbxqlATU' +
'FEtMtrk3Onutql6KBIGEiWMvDUoD4sUYZn5/33O04XXiwyLiAMRl/' +
'DKS4Urn6KloLR5eisSAF2iNONzaaUSCxFuZWqlEgMTwQlfiuChIAw' +
'wQws1czzim6A0is0ZwHSWmCijJPtTO9ag0DySsdbt6Zffbvv6jYZ4' +
'AUS+JWULG60RVjXc/oHIuVsiGJvSmej1FxLbt7fazIdP+LufYJkIL' +
'lf+e74CFIwdaK7bD4LcA5qxvMg+7ZFQDoId5FORZSvAfFQqIs8V/V' +
'jUF5nJhxJp/srEyRAemqLaB/NSZthF4e7QJpjVHILZDWuC1IX1fD1' +
'zg1fgH81TAR');
end;

procedure Logon;
begin
if(FindBitmap(Loginbmp,x,y)) then
Mouse(x, y, 4, 4, True);
SendKeys('my user'+chr(13));
SendKeys('my pass'+chr(13));
end;

procedure PickPocket;
begin
if FindColorTolerance(x, y, GuardColor, MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);//Use mouse for Runescape
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(3000+random(100));
end else exit;
end;

begin
SetupSRL;
LoadBmps;
repeat
PickPocket;
until(false);
end.[/PHP]

caused

2010-02-25 14:31:51

It does compile though.

Which part is not working ?

L2Program

2010-02-25 14:32:32

From: caused
It does compile though.

Which part is not working ?


Yeah there are no errors, but it wont find the loginbmp. Ive done string to bmp that is also correct. And its right there in the window.

caused

2010-02-25 14:34:01

Did you target your client (crosshair on Client) ?

Otherwise try recreating the bmp, and make it a smaller one ;)…

~caused

NCDS

2010-02-25 14:37:03

I apologize, I left "SetArrayLength(PlayerReport, HowManyPlayers); " in there from the script I just copied it out of is all ;)

You could also just use

WaitOption('ick', 2000);
That will search for the Option with 'ick' in it and wait 2000 ms maximum for it to show up. If it finds it, then it will click.

L2Program

2010-02-25 14:43:31

From: NCDS
I apologize, I left "SetArrayLength(PlayerReport, HowManyPlayers); " in there from the script I just copied it out of is all ;)

You could also just use

WaitOption('ick', 2000);
That will search for the Option with 'ick' in it and wait 2000 ms maximum for it to show up. If it finds it, then it will click.


Srl doesnt compile with private servers so I need to make everything bmps =[

Yeah I targeted the window, and the images is small (just the login text.) could it be that when I rollover the log in button it changes colour?

NCDS

2010-02-25 14:45:59

From: lewis_
Srl doesnt compile with private servers so I need to make everything bmps =[

Yeah I targeted the window, and the images is small (just the login text.) could it be that when I rollover the log in button it changes colour?


You will want to look into BitmapMask's then.

There are a few tutorials on them here I believe.

L2Program

2010-02-25 14:47:27

Cheers and if anyone is still looking over why my login procedure doesnt work heres an image of the login box and the rollover image of login next to it.


MylesMadness

2010-02-25 14:48:49

Whats with the sudden want for people to auto pservers?

L2Program

2010-02-25 14:53:03

From: MylesMadness
Whats with the sudden want for people to auto pservers?


I think a few decent ones have popped up. That are actually a "challenge" mind answering one question?

What actually does the SRL do, does it just contain all the interface options on runescape etc - if thats the case could I not find and older revision of srl that works with the interfaces in the server?

NCDS

2010-02-25 14:58:15

From: lewis_
Cheers and if anyone is still looking over why my login procedure doesnt work heres an image of the login box and the rollover image of login next to it.



Well since the position of the login screen is constant, you could just use:

procedure MouseBox(x1, y1, x2, y2: Integer; ClickType: Integer);
options for ClickType are:
1 : Click Left;
2 : Click Right;
3 : Nothing;

It's in SRL so you will have to include it, but it is still quite useful with things like that.

I suggest having some sort of a GetColor(); check though to make sure you are at the login screen.

L2Program

2010-02-25 15:02:52

From: NCDS
Well since the position of the login screen is constant, you could just use:

procedure MouseBox(x1, y1, x2, y2: Integer; ClickType: Integer);
options for ClickType are:
1 : Click Left;
2 : Click Right;
3 : Nothing;

It's in SRL so you will have to include it, but it is still quite useful with things like that.

I suggest having some sort of a GetColor(); check though to make sure you are at the login screen.


Intresting thanks.

I got these coords in the colour picker, (-468, 89) for where the login tab is to click left.

So i would the add that procedure, then where i want it to click right add in Click Right; ?

caused

2010-02-25 15:04:36

Negative x coord ?.

Seems like you didnt put your crosshair on your client ;)….

L2Program

2010-02-25 15:07:38

From: caused
Negative x coord ?.

Seems like you didnt put your crosshair on your client ;)….


My bad lol ;)

at (413, 190)

So how would I implement this?

Frement

2010-02-25 15:10:47

From: lewis_
My bad lol ;)

at (413, 190)

So how would I implement this?


if ( GetColor( 413, 190 ) = TheColor ) then begin
//do stuff
end;

NCDS

2010-02-25 15:11:16

From: lewis_
Intresting thanks.

I got these coords in the colour picker, (-468, 89) for where the login tab is to click left.

So i would the add that procedure, then where i want it to click right add in Click Right; ?


Like caused said you need to make sure you activate your client by dragging the crosshairs over it before you try and obtain coords.

Also, you will need two sets of coords, as you are searching a box. x1, y1 represents the x and y value of the top left point of the box you want to search. Where as x2, y2 represents the x and y values for the bottom right corner of the box.

If you want to ClickLeft you will need to put '1', if you want to ClickRight put '2'

caused

2010-02-25 15:14:14

Well if you use MouseBox you need the top left x1 and y1 coords and top bottom right x2 and y2 coords.

MouseBox(x1, y1, x2, y2: Integer; ClickType: Integer);


Thats
MouseBox(413, 190, 423, 200, 1);


for your :].

You should modify x2 and y2 though.

~caused

L2Program

2010-02-25 18:42:27

Right thanks for your posts ive just come back to this, and trying something another user posted above.

[PHP]program testinglogin;
{.include SRL/SRL.scar}

var x,y: Integer;

procedure Logon;

begin
if (GetColor(422, 190)=8034470) then begin
Wait(1000+random(100));
Mouse(x, y, 4, 4, True);
SendKeys('user'+chr(13));
Wait(1000+random(100));
SendKeys('pass'+chr(13));
end;

end.[/PHP]

I cant find where im missing the semicolon :(

[PHP][Error] (21799:4): Semicolon (';') expected[/PHP]

Mr. Doctor

2010-02-25 18:46:18


program testinglogin;
{.include SRL/SRL.scar}

var x, y : Integer;

procedure Logon;
begin
if (GetColor(422, 190)=8034470) then
begin
Wait(1000+random(100));
Mouse(x, y, 4, 4, True);
SendKeys('user'+chr(13));
Wait(1000+random(100));
SendKeys('pass'+chr(13));
end;
end;

begin
SetUpSRL;
ActivateClient;
ClearDebug;
Logon;
end.

Fixed with standards. You were missing the begin for the main loop and an end; for the logon procedure.

L2Program

2010-02-25 19:08:34

From: Junkj

program testinglogin;
{.include SRL/SRL.scar}

var x, y : Integer;

procedure Logon;
begin
if (GetColor(422, 190)=8034470) then
begin
Wait(1000+random(100));
Mouse(x, y, 4, 4, True);
SendKeys('user'+chr(13));
Wait(1000+random(100));
SendKeys('pass'+chr(13));
end;
end;

begin
SetUpSRL;
ActivateClient;
ClearDebug;
Logon;
end.

Fixed with standards. You were missing the begin for the main loop and an end; for the logon procedure.


Anywhere where i can learn the conventions?

Mr. Doctor

2010-02-25 19:10:05

From: lewis_
Anywhere where i can learn the conventions?


Tutorial in my signature shows how to chop a tree with extra basic stuff. There many other beginner tutorials here.