SRL Archive - OSR Help

First script just repeats login procedure.


L2Program

2010-02-27 11:14:59

I've just added a login procedure that works to my thieving script, but when I play the script now it will keep repeating the login script, and not do the pickpocketing script at all.

Few reasons why I think the pickpocketing script wont work:

I've added finding more than one colour - probably done incorrectly
I was told to free my bitmaps - also possibly done in the wrong place.

Hope anyone can help!

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

{ Author Lewis }

//credits to: caused, members from srl forums.

// notes to me to complete:
// Eating on low HP
// World Selection
// username and password and world as constants.

const
Target1= 11371366;//colour of the Target

Target2= 11371366;//Different colour of same target

Target3= 11371366;//Different colour of same target

var
pickpocketbmp : Integer;

var x,y: Integer;

procedure LoadBmps;
begin

pickpocketbmp := BitmapFromString(26, 12, 'beNoLcY8NgaL/YADn' +
'UoggpjEwMBCvmLqm4VFMFdPgDoYrQPPFfySAXxCIGMAATQGaIISLr' +
'BdZHKt3MI1C8xEuNp6gwOMjrG4mGLB4fITVzfhjAS05oTkP09lYY4' +
'EgGzPM8cQCFRAAosKhNg==');
end;

procedure FreeBmps;
begin
FreeBitmap(pickpocketbmp);
end;

procedure Logon;
begin
MouseBox(310, 184, 453, 195, 1);
begin
Wait(1000+random(100));
SendKeys('user');
Wait(1000+random(100));
MouseBox(343, 328, 414, 338, 1);
Wait(1000+random(100));
SendKeys('pass');
Wait(1000+random(100));
MouseBox(355, 368, 406, 375, 1);
Wait(3000+random(100));
end;
end;

Procedure EatingOnLowHP;
begin
end;

procedure PickPocket;
begin
if FindColorTolerance(x, y, Target1, MSX1, MSY1, MSX2, MSY2, 3) then
else
if FindColorTolerance(x, y, Target2, MSX1, MSY1, MSX2, MSY2, 3) then
else
if FindColorTolerance(x, y, Target3, MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(2500+random(100));
end else Logon;
end;

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

NCDS

2010-02-27 11:22:30

you want Target to be an array:

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

{ Author Lewis }

//credits to: caused, members from srl forums.

// notes to me to complete:
// Eating on low HP
// World Selection
// username and password and world as constants.

var
pickpocketbmp : Integer; Target: array [0..2] of Integer;

var x,y: Integer;

procedure LoadBmps;
begin

pickpocketbmp := BitmapFromString(26, 12, 'beNoLcY8NgaL/YADn' +
'UoggpjEwMBCvmLqm4VFMFdPgDoYrQPPFfySAXxCIGMAATQGaIISLr' +
'BdZHKt3MI1C8xEuNp6gwOMjrG4mGLB4fITVzfhjAS05oTkP09lYY4' +
'EgGzPM8cQCFRAAosKhNg==');
end;

procedure FreeBmps;
begin
FreeBitmap(pickpocketbmp);
end;

procedure Logon;
begin
MouseBox(310, 184, 453, 195, 1);
begin
Wait(1000+random(100));
SendKeys('user');
Wait(1000+random(100));
MouseBox(343, 328, 414, 338, 1);
Wait(1000+random(100));
SendKeys('pass');
Wait(1000+random(100));
MouseBox(355, 368, 406, 375, 1);
Wait(3000+random(100));
end;
end;

Procedure EatingOnLowHP;
begin
end;

procedure PickPocket;
begin
for i := 0 to High(Target) do
begin
if FindColorTolerance(x, y, Target[i], MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(2500+random(100));
end else Logon;
end;
end;

begin
SetupSRL;
LoadBmps;
Logon;
repeat
EatingOnLowHP;
PickPocket;
FreeBmps;
until(false);
end.

L2Program

2010-02-27 11:26:25

From: NCDS
you want Target to be an array:

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

{ Author Lewis }

//credits to: caused, members from srl forums.

// notes to me to complete:
// Eating on low HP
// World Selection
// username and password and world as constants.

var
pickpocketbmp : Integer; Target: array [0..2] of Integer;

var x,y: Integer;

procedure LoadBmps;
begin

pickpocketbmp := BitmapFromString(26, 12, 'beNoLcY8NgaL/YADn' +
'UoggpjEwMBCvmLqm4VFMFdPgDoYrQPPFfySAXxCIGMAATQGaIISLr' +
'BdZHKt3MI1C8xEuNp6gwOMjrG4mGLB4fITVzfhjAS05oTkP09lYY4' +
'EgGzPM8cQCFRAAosKhNg==');
end;

procedure FreeBmps;
begin
FreeBitmap(pickpocketbmp);
end;

procedure Logon;
begin
MouseBox(310, 184, 453, 195, 1);
begin
Wait(1000+random(100));
SendKeys('user');
Wait(1000+random(100));
MouseBox(343, 328, 414, 338, 1);
Wait(1000+random(100));
SendKeys('pass');
Wait(1000+random(100));
MouseBox(355, 368, 406, 375, 1);
Wait(3000+random(100));
end;
end;

Procedure EatingOnLowHP;
begin
end;

procedure PickPocket;
begin
for i := 0 to High(Target) do
begin
if FindColorTolerance(x, y, Target[i], MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(2500+random(100));
end else Logon;
end;
end;

begin
SetupSRL;
LoadBmps;
Logon;
repeat
EatingOnLowHP;
PickPocket;
FreeBmps;
until(false);
end.


Nice didn't know about this, thanks, learning alot from this community.

EDIT: My pickpocketbmp isn't the target, the target colours are the target, the pickpocketBMP is what to select upon clicking the target, can I still use an array?

EDIT: So i found out i need to use a static array?

SetArrayLength(Strings, 3);
Strings[0] := 'would colour 1 go here?';
Strings[1] := 'Colour 2 here';
Strings[2] := 'Colour 2 here';

NCDS

2010-02-27 11:31:13

You would also need to add:

Target := [your 3 different colors in here separated by commas];
in your MainLoop. I forgot to.

L2Program

2010-02-27 11:57:11

From: NCDS
You would also need to add:

Target := [your 3 different colors in here separated by commas];
in your MainLoop. I forgot to.


Alright here's what i've got:

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

{ Author Lewis }

//credits to: caused, members from srl forums.

// notes to me to complete:
// Eating on low HP
// World Selection
// username and password and world as constants.

var
pickpocketbmp : Integer; Target: array [0..2] of Integer;

var x,y: Integer;

procedure LoadBmps;
begin

pickpocketbmp := BitmapFromString(26, 12, 'beNoLcY8NgaL/YADn' +
'UoggpjEwMBCvmLqm4VFMFdPgDoYrQPPFfySAXxCIGMAATQGaIISLr' +
'BdZHKt3MI1C8xEuNp6gwOMjrG4mGLB4fITVzfhjAS05oTkP09lYY4' +
'EgGzPM8cQCFRAAosKhNg==');
end;

procedure FreeBmps;
begin
FreeBitmap(pickpocketbmp);
end;

procedure Logon;
begin
MouseBox(310, 184, 453, 195, 1);
begin
Wait(1000+random(100));
SendKeys('user');
Wait(1000+random(100));
MouseBox(343, 328, 414, 338, 1);
Wait(1000+random(100));
SendKeys('pass');
Wait(1000+random(100));
MouseBox(355, 368, 406, 375, 1);
Wait(3000+random(100));
end;
end;

Procedure EatingOnLowHP;
begin
end;

procedure PickPocket;
begin
for i := 0 to High(Target) do
begin
if FindColorTolerance(x, y, Target, MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(2500+random(100));
end else Logon;
end;
end;

begin
SetupSRL;
LoadBmps;
Logon;
repeat
EatingOnLowHP;
Target := [6510395,7362115,4471849];
PickPocket;
FreeBmps;
until(false);
end.[/PHP]

Just a few questions about arrays, for this variable:
[PHP]var
pickpocketbmp : Integer; Target: array [0..2] of Integer;[/PHP]

Does it have to be called pickpocketbmp, because in the first script I posted pickpocketbmp and the target colours we're completely different. pickpocket bmp is pickpocket selection on right click and that target colours are the colour of the npc to pickpocket.

Secondly do I have to delcare i somewhere? Never used arrays before so i dont know, and I didn't see it in the array tut I checked out. as i'm getting this error.

[PHP]Line 54: [Error] (21836:5): Unknown identifier 'i' in script
[/PHP]

Mr. Doctor

2010-02-27 12:01:09


procedure PickPocket;
var
I : integer;
begin
for i := 0 to High(Target) do
begin
if FindColorTolerance(x, y, Target[i], MSX1, MSY1, MSX2, MSY2, 3) then
begin
Mouse(x, y, 4, 4, False);
if(FindBitmap(pickpocketbmp,x,y)) then
Mouse(x, y, 4, 4, True);
Wait(2500+random(100));
end else Logon;
end;
end;

Yes it does have to be called Pickpocketbmp, the same name as your bitmap.

NCDS

2010-02-27 12:01:20

From: lewis_

Just a few questions about arrays, for this variable:
[PHP]var
pickpocketbmp : Integer; Target: array [0..2] of Integer;[/PHP]

Does it have to be called pickpocketbmp, because in the first script I posted pickpocketbmp and the target colours we're completely different. pickpocket bmp is pickpocket selection on right click and that target colours are the colour of the npc to pickpocket.

You can call it anything you want.

From: lewis_

Secondly do I have to delcare i somewhere? Never used arrays before so i dont know, and I didn't see it in the array tut I checked out. as i'm getting this error.

[PHP]Line 54: [Error] (21836:5): Unknown identifier 'i' in script
[/PHP]

Yes that is my fault.
Put:

var
i: Integer;
right under:

procedure PickPocket;

L2Program

2010-02-27 12:10:13

From: NCDS
You can call it anything you want.


Yes that is my fault.
Put:

var
i: Integer;
right under:

procedure PickPocket;


runtime error for the target line in the main loop?

[PHP][Runtime Error] : Could not call proc in line 80 in script[/PHP]

NCDS

2010-02-27 12:24:07

What is on line 80?

Edit:
just post the whole thing so far.

L2Program

2010-02-27 12:27:34

My target colours in the main loop:

Target := [6510395,4471849,7362115];