SRL Archive - Help

Bank pin procedure


doxin

2012-12-26 06:34:19

im writing a script for an rsps. this script can open the bank but i want to be able to have the script enter a pin. so far i only have
Const

//Banking
BankPin = True; // true if you have a pin, false if not
PinNumber = '';

and i have this

procedure Banking;
var x, y: integer;

begin

WriteLn('Starting to bank');
if BankPin then
begin
end;

since the bank pin numbers dont move, i want to set a coordinate for each number. i also want to be able to just enter a pin number into "PinNumber = ' '; " and have the string converted so each number can be given their respective coordinates. how would i achieve this? or could someone just point me in the right direction?

DannyRS

2012-12-26 06:38:12



Procedure EnterPin(Text: String);
Var
I: Integer;
Begin
For I:=1 To Length(Text) Do
Begin
If (Text[I] = '0') Then
Click(0position)
Else If (Text[I] = '1') Then
Click(1Position)
Else If (Text[I] = '2' Then
Click(2Position);
End;
End;


If BankPin Then
EnterPin(PinNumber);

Something like this i think is what you want, I've never done it though and I'm on my phone not my PC so i cant check syntax ;)

doxin

2012-12-26 06:59:56

Thanks I think it got it from here

riwu

2012-12-26 07:09:29

Use InPin from the include…
Declare your pin under Players[CurrentPlayer].Pin.

DannyRS

2012-12-26 07:10:27

From: riwu
Use InPin from the include…
Declare your pin under Players[CurrentPlayer].Pin.


Private server ;)

riwu

2012-12-26 07:12:49

Ohhh…
If the one in PS is similar to RS you can't use static coors since the number appear on diff places every time. Have to use OCR/bitmap/dtm.

DannyRS

2012-12-26 07:14:47

From: riwu
Ohhh…
If the one in PS is similar to RS you can't use static coors since the number appear on diff places every time. Have to use OCR/bitmap/dtm.


I think he also mentioned the numbers dont move ;)

riwu

2012-12-26 07:19:59

Oh. Can be done with some math to avoid long case/if statements then.
Like

B:= Grid();
for i:=0 to High(PinNumber) do
MouseBox(B[PinNumber].X1, B[PinNumber].Y1, ....);
May have to twist a bit depending on the Grid setup.

doxin

2012-12-26 16:21:15

procedure EnterPin(Text: String);
var
I: Integer;
begin
For I:=1 To Length(Text) do
begin
if (Text[I] = '0') then
AL_AccurateMMouse(point(68, 139), 3, 3);
AL_FastClick(mouse_left);
Wait(500+random(500));
else if (Text[I] = '1') then //this is line 24 <---
AL_AccurateMMouse(point(160, 137), 3, 3);
AL_FastClick(mouse_left);
Wait(500+random(500));
end;
end;

identifier expect at line 24?

Sin

2012-12-26 16:49:57

If the numbers don't move, just use Coordinates?

doxin

2012-12-26 16:53:21

i am using coordinates. im just wondering why it wont compile. it says "identifier expected at line 24"

DannyRS

2012-12-26 16:53:46

From: doxin

identifier expect at line 24?


try this

procedure EnterPin(Text: String);
var
I: Integer;
begin
For I:=1 To Length(Text) do
begin
if (Text[I] = '0') then
begin
AL_AccurateMMouse(point(68, 139), 3, 3);
AL_FastClick(mouse_left);
Wait(500+random(500));
end else
if (Text[I] = '1') then //this is line 24 <---
begin
AL_AccurateMMouse(point(160, 137), 3, 3);
AL_FastClick(mouse_left);
Wait(500+random(500));
end;
end;
end;

doxin

2012-12-26 16:59:25

it compiles now. ill complete the procedure and i'll test it out

EDIT:it enters the pin perfectly now. thanks :D