PDA

View Full Version : Banking Problems



CamHart
10-21-2006, 03:26 PM
I've been having some problems with my banking. I've looked at others to use as an example, but SCAR doesn't seem to recognise some of the Text. If you find something wrong with the code or if theres something i must account for please tell me. Thanks...

Function OpenUpBank(DTMs:Array of Integer; xs, ys, x1, y1, x2, y2:integer):Boolean;
Var PreTime, CurTime, C, BankWords:integer;
Begin
Status('Searching for bank desk...');
C:=0;
BankWords:= CreateBitmapMaskFromText('Bank', UpChars);
Repeat
C:=C+1;
//If(IsUpTextMulti('Bank', 'booth', 'Booth'))Then

If(IsUpText('Use B'))Then

//If(FindBitMapIn(BankWords, xs, ys, 0, 0, 200, 50))Then

//If(FindText(x, y, 'Bank', UpChars, 0, 0, 200, 50))Then

Begin
Wait(Rands(100,200));
GetMousePos(xs, ys);
Mouse(xs, ys, 0, 0, false);
Writeln('Clicked');
//Repeat
Wait(Rands(4000, 5000));
//Until((TimeFromMark(PreTime) > (4000)) or (ClickOption('quickly', 1)) or (ClickOption('Bank Banker', 1)));
End else
If((ClickOption('quickly', 1)) or (ClickOption('Bank Banker', 1)))Then
Begin
Flag;
MarkTime(PreTime);
Repeat
Wait(Rands(10,200));
Until((TimeFromMark(PreTime) > 6000) or (BankScreen));
End;
If(FindDTMs(DTMs, xs, ys, x1, y1, x2, y2))Then
Begin
MMouse(xs, ys, 3, 3);
Wait(Rands(400, 1200));
Mouse(xs, ys, 5, 2, false);//edit
End else
If(FindDTMs(DTMs, xs, ys, MSX1, MSY1, MSX2, MSY2))Then
Begin
MMouse(xs, ys, 3, 3);
Wait(Rands(400, 1200));
End;
Until((C > 5) or (BankScreen));
FreeBitMap(BankWords);
End;

Thats my banking method, the DTM is a DTM of the bank desk, and the mouse almost always finds its way over it within a few seconds. Its with the text detection in the upper left corner, and with the ChooseOption that I'm having problems. It is just not returning either of the If statements as True and I don't know what to do. I've tried the stuff with all the // before it also and nothing seems to work.

IronTeapot
10-21-2006, 03:33 PM
I believe isUpText will not work with capital letters, even IF you specify it to look for 'Booth', try just using 'ooth' and things for your searching and for your CreateBitmapMaskFromText 'ank' functions.

Home
10-21-2006, 03:46 PM
Always wait before Test checking.. and.. your mouse must be ON bank booth :P

And i don't see Mouse moving :)


~Home ( Am i Blind ?! )

CamHart
10-21-2006, 05:37 PM
IronTeapot - Thanks ill try that out


Always wait before Test checking.. and.. your mouse must be ON bank booth :P

And i don't see Mouse moving :)


~Home ( Am i Blind ?! )
FindDTMs(DTMs, xs, ys, x1, y1, x2, y2)
Function i made that finds and moves the mouse to it :P

Did you mean always wait before TEXT checking? I'll try that out too, XD thanks a bunch.

Home
10-21-2006, 06:19 PM
Like..
MMouse(...........)
Wait(100+Random(100))
IsUptext('.....')

And so on.. :)


~Home

I Pick Axes
10-21-2006, 08:39 PM
Keep in mind that SRL has a built in OpenBank and related, including some OpenBankQuiet procedures. Also available are most banking functions.

Boreas
10-21-2006, 09:43 PM
I modded WT Fakawi's Draynor melter to work in port phasmatys, and the bank finding is pretty fast. I'll release it if Fakawi's cool with it so you can see how it works. Findyellows breaks up most of the minimap in to boxes, and finds the yellow that is always in banker dots (195836) only finding once per box, which in theory mines only 1 hit per yellow dot if the boxes are the right size, however when its more than 1 it takes care of it later. Then it looks at the distances between the dots and figures out which are the ones in the bank (as opposed to the ones walking around outside). Right now its hard coded to work with the layout in port phasmatys bank

x x x x

this is about how the bankers are. Calling findyellows and then clicking the spot it returns get me wicked close to the bank booth. So close that the modified version of simple bank down there finds it usually right away, and if not then pretty fast after that. To use, first change the analysis part of findyellows to suit your bank, and then follow the mainloop example below.

If people like it, I'll put whichbank in the params and a case of for the banks, and have that call oustide procs, and leave it to you to write those.





type ybox = record
x1,y1,x2,y2,cx,cy:integer;
active:boolean;
end;


type tehpoint = record
x,y :integer;
active : boolean;
end;

type combo = record
point1,point2,x1,y1,x2,y2,dist:integer;
active:boolean;
end;






procedure findyellows (var fx, fy:integer; PointsToFind,width,basex,basey,endx,endy:integer);
var
box :array of ybox;
ypoint : array of tehpoint;
com:array [1..300] of combo;
x,d,e,f,i,g,nob,{gx,gy,}currentpoint,row,prow,col, nor,noc:integer;//var
//x,d,nob,gx,gy,currentpoint,row,prow,col,nor,noc:in teger;

begin
noc:=(( (endx-basex) - (width mod (endx-basex)))/width)+1;
nor:=(( (endy-basey) - (width mod (endy-basey)))/width)+1;
//noc:=round( (endx-basex)/width );
//nor:=round( (endy-basey)/width );

nob:=nor*noc;
setarraylength(box, ((nob)+2));
repeat
x:=x+1;
if ((x+noc) mod noc)>0 then
col:=((x+noc) mod noc);
if ((x+noc) mod noc) =0then
col:=noc;
prow:=0;
repeat
prow:=prow+1;
until ( x<=(noc*prow));
row:=prow;
box[x].x1:=(basex+ ((col-1)*width) );
box[x].x2:=(basex+(col*width));
box[x].y1:=(basey+ ((row-1)*width) );
box[x].y2:=(basey+(row*width));
box[x].cx:=round((box[x].x2+box[x].x1)/2);
box[x].cy:=round((box[x].y2+box[x].y1)/2);
box[x].active:=true;

{
movemouse(box[x].x1,box[x].y1);
holdmouse(box[x].x1,box[x].y1,true);
movemouse(box[x].x2,box[x].y2);
releasemouse(box[x].x2,box[x].y2,true);
}


until x>=nob;


currentpoint:=1;
d:=0;
setarraylength(ypoint, pointstofind+1);
repeat
d:=d+1;
if (box[d].active) then
begin
if findcolor(gx,gy,195836,box[d].x1,box[d].y1,box[d].x2,box[d].y2) then
begin
ypoint[currentpoint].x :=gx;
ypoint[currentpoint].y :=gy;
currentpoint:=currentpoint+1;
box[d].active:=false;
end;
end;
until (( currentpoint= pointstofind)or (d=nob));
e:=0;
repeat
e:=e+1;
//writeln(inttostr(ypoint[e].x)+' '+inttostr(ypoint[e].y));
//if not((ypoint[e].x = 0) and (ypoint[e].y = 0)) then ypoint[e].active:=true;
until e=16;

//writeln(' all points');
e:=0;

repeat
f:=f+1;
g:=0;
repeat
g:=g+1;
e:=e+1;
//writeln(inttostr(f)+' '+inttostr(g)+' '+inttostr(e));
com[e].point1:=f;
com[e].point2:=g;
com[e].x1:=ypoint[f].x;
com[e].y1:=ypoint[f].y;
com[e].x2:=ypoint[g].x;
com[e].y2:=ypoint[g].y;

if not((com[e].x1=0) or (com[e].y1=0) or (com[e].x2=0) or (com[e].y2=0)) then com[e].active:=true;
until( (g=16) or (e=256));
until ((f=16) or (e=256));

e:=0;
repeat
e:=e+1;
com[e].dist:=Round(Sqrt(Sqr(com[e].x1 - com[e].x2) + Sqr(com[e].y1 - com[e].y2)))
if ((com[e].dist=0) or (com[e].dist>20)) then com[e].active:=false;
i:=0;
repeat
i:=i+1;
if ((com[e].active) and (com[i].active))then
begin
if ((com[e].point1=com[i].point2)and (com[e].point2=com[i].point1)) then com[i].active:=false;
end;
until i=256;
if com[e].dist=1 then com[e].active:=false;
//if com[e].active then writeln(inttostr(com[e].point1)+' '+inttostr(com[e].point2)+' '+inttostr(com[e].dist));
until e=256;
e:=0;
repeat
e:=e+1;
if com[e].active then
begin
if (com[e].dist <6 ) then
begin
i:=0;
repeat
i:=i+1;
if ((com[i].point1=com[e].point1) or (com[i].point1=com[e].point2) or (com[i].point2=com[e].point1) or (com[i].point2=com[e].point2))then
begin
if com[i].dist>7 then
begin
fx:=com[e].x1;
fy:=com[e].y1;
end;
end;
until i=256;
end;
end;
until e=256;
end;

//----------modified this from WT Fakawi's Draynor Melter

Function SimpleBank:Boolean;
var sx,sy,dx,dy,Mark2,Tries:integer;
begin
SX:=280; SY:=180;
repeat
sx:=Sx+5+random(5);
sy:=180+5+Random(40);
MMouse(sx, sy, 0, 0);
if IsUpTextMulti('e Bank','Booth','ooth') then
begin
GetMousePos(Dx, Dy);
Mouse(Dx, Dy, 0, 0, False);
if ChooseOption(Dx, Dy, 'uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
writeln('couldnt find the bank. Exiting');
Exit;
end;
until BankScreen;
end;
Result := True;
Exit;
end;
wait(1);
Tries:=Tries+1;
until(tries >10) or bankscreen;
end;



//------main loop

//click the bank symbol

findyellows(gx,gy,16,5,590,30,700,120);
Mouse(gx,gy,0,0,True);
CountFlag(0);
simplebank;

CamHart
10-21-2006, 11:09 PM
Thanks guys got it working <3....

CamHart
10-21-2006, 11:13 PM
Keep in mind that SRL has a built in OpenBank and related, including some OpenBankQuiet procedures. Also available are most banking functions.
None of them worked too well... Took SUPER long to finally open the bank. Like 5-10 minutes of sitting there.

Boreas the method i found has worked pretty well so far, but yours sounds a lot nicer that what im doing lol. I'll take a look at the code later, I've gotta go to a football playoff party for my football team right now.