SRL Archive - OSR Help

Function wont find Bank


Bobzilla69

2010-09-21 06:17:44

Hey,

i made my own function to find the bank, however it doesnt seem to be able to open the bank.

Function MyOpenBank:Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
x, y, i, ii:Integer;
begin
Result:= False;
if BankScreen then
begin
Result:= True;
Writeln('Bank Found');
Exit;
end;
MakeCompass('W');
Wait(300); //screen settel
FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
//DebugTPA(TPA, '');
//Wait(3000);
ATPA := SplitTPAEx(TPA, 10, 10);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
//DebugATPABounds(ATPA);
ii := High(ATPA); //get higherst entry in array
for i := 0 to ii do //from 0 first entry in array to ii highest entry
begin
MiddleTPAEx(ATPA[i], x, y);//find middle of array entry
MMouse(x, y, 3, 3);
if WaitUpTextMulti(['ooth', 'ank booth'], 300) then
begin
Mouse(x, y, 0, 0, False);
Wait(200); //ERROR HERE
//ChooseOption('uickly'); //Dont work
//WaitOptionMultiEx(['se-quickly', 'uickly'], 'all', ClickLeft, 200);//Dont work
//WaitOption('uickly', 500); //Dont work
ChooseOptionMultiEx(['uickly'], 'all', ClickLeft) //Dont work
Flag;
Wait(2000 + Random(800));
if BankScreen then
begin
Result:= True;
Writeln('Bank Found');
Exit;
end;
end;
end;
end;

i have tried just using SRL's OpenBank(); and that works fine, however my function wont for for some reason.

any ideas

BraK

2010-09-21 06:33:09

What part is it getting hung up on/What is it doing or not doing that you have defined? What bank are you trying to open?

Also Some to think about.



ii := High(ATPA); //get higherst entry in array
for i := 0 to ii do //from 0 first entry in array to ii highest entry


Could be


for i := 0 to High(ATPA) do

~BraK

Bobzilla69

2010-09-21 06:36:12

From: BraK
What part is it getting hung up on/What is it doing or not doing that you have defined? What bank are you trying to open?

~BraK


hey,

its getting stuck on choosing the option, which would be uickly.

but i have done some more testing and it seems to be that it will find,
chooseoption('uic')
chooseoption('uick')
chooseoption('uickl')

however
chooseoption('uickly')

will not work, must be a problem with the character y

cant anyone else confirm the same problem?

edit: thanks for the extra scripting advice

BraK

2010-09-21 06:39:01

From: bobzilla69
hey,

its getting stuck on choosing the option, which would be uickly.

but i have done some more testing and it seems to be that it will find,
chooseoption('uic')
chooseoption('uick')
chooseoption('uickl')

however
chooseoption('uickly')

will not work, must be a problem with the character y

cant anyone else confirm the same problem?

edit: thanks for the extra scripting advice


Did you Shorten it the other way 'ckly' and 'kly'

~BraK

Bobzilla69

2010-09-21 06:45:51

From: BraK
Did you Shorten it the other way 'ckly' and 'kly'

~BraK


yes i just tried now, they dont work.

from what i can see it wont work if its any characters and y

so uickly, ickly, ckly, kly, ly. none of those will work.

if you simply do y. that will work


edit:
below is script i used to test, its crude but shows if its working

simply run script and quickly right click bank.
program new;
{$i srl/srl.scar}
begin
setupsrl;
wait(4000); //wait to allow you to right click bank
ChooseOption('y');
end.

BraK

2010-09-21 06:58:02

It's Always a good to test all directions. You found even more info on the problem. By doing so You isolated it further. That Way it's easier to fixed for the devs.

Good Job
~BraK

Bobzilla69

2010-09-21 06:59:29

From: BraK
It's Always a good to test all directions. You found even more info on the problem. By doing so You isolated it further. That Way it's easier to fixed for the devs.

Good Job
~BraK


hehehe, thanks, you help :)

will update bug post on it now

Wanted

2010-09-21 15:39:16

    MMouse(x, y, 3, 3);
if WaitUpTextMulti(['ooth', 'ank booth'], 300) then
begin
Mouse(x, y, 0, 0, False);


You might want to put a GetMousePos(x, y) before clicking the mouse since your MMouse is a random 3.

Anyways yea, the y bitmap for upchars is off by a pixel or two, I'll update that and bump this thread http://villavu.com/forum/showthread.php?t=59071 with a fix, but you could of avoided this all together by just not using the y character in your choose option or using chooseoptionmulti with one more inputs with out the y.

Camaro'

2010-09-21 16:22:24

From: BraK
What part is it getting hung up on/What is it doing or not doing that you have defined? What bank are you trying to open?

Also Some to think about.



ii := High(ATPA); //get higherst entry in array
for i := 0 to ii do //from 0 first entry in array to ii highest entry


Could be


for i := 0 to High(ATPA) do

~BraK


He had it right, your way is slower. It has to call High() every time it iterates the loop, his way it calls it once.

Bobzilla69

2010-09-21 16:29:24

From: IceFire908
    MMouse(x, y, 3, 3);
if WaitUpTextMulti(['ooth', 'ank booth'], 300) then
begin
Mouse(x, y, 0, 0, False);


You might want to put a GetMousePos(x, y) before clicking the mouse since your MMouse is a random 3.

Anyways yea, the y bitmap for upchars is off by a pixel or two, I'll update that and bump this thread http://villavu.com/forum/showthread.php?t=59071 with a fix, but you could of avoided this all together by just not using the y character in your choose option or using chooseoptionmulti with one more inputs with out the y.


ok cool, thanks for the update. yeh i ahve now used the multi with and without the y

[QUOTE=Camaro';738320]He had it right, your way is slower. It has to call High() every time it iterates the loop, his way it calls it once.[/QUOTE]

ok, its good to know which is faster will make script more stream line and effective.

BraK

2010-09-21 17:16:45

[QUOTE=Camaro';738320]He had it right, your way is slower. It has to call High() every time it iterates the loop, his way it calls it once.[/QUOTE]

Huh didn't know that it would slow it down. that's good to know.

Wizzup?

2010-09-22 05:33:38

From: BraK
Huh didn't know that it would slow it down. that's good to know.


It doesn't seriously slow it down. Unless you want to iterate over 1000000 points which will be slow anyway.