SRL Archive - Help

ACA help


Footy

2012-08-12 10:56:41

Im using ACA to find my bank in al-kharid, but ACA keeps saying it cant find the color on the second loop. It works fine the first loop, and there is plenty of the color there when it checks the second time. What Am I doing wrong? Here is my openbank procedure
Function OpenBankCustom:boolean;
var
counter, BankFails, x, y:integer;
begin
if resetting = true then
begin
Writeln('We are now back on course, Lets roll');
Resetting := false;
end;
if not(loggedin) then
exit;
if bankfails >= 3 then
begin
writeln('We failed 3 times trying to open the bank! Closing script and logging out!');
Logout;
Exit;
end;
if FindObjTPAMulti(x, y, [BankColor1, BankColor2], 5, 2, 15, 15, 75, ['Bank Bank', 'ank B', 'Bank B', 'k Ban', 'nk Ba']) then
begin
Mouse(x, y, 7, 3, mouse_right);
WaitOption('Bank Bank', 1000);
Marktime(Counter);
repeat
wait(randomrange(50, 200));
if TimeFromMark(Counter) > 7000 then
begin
writeln('The bank never opened! Lets try again');
inc(BankFails);
Exit;
end;
until(BankScreen or PinScreen);
end else
begin
writeln('We couldnt find the bank! Lets try again!');
inc(BankFails);
Exit;
end;
if (bankscreen or pinscreen) then
Result := True else
Result := False;
end;

Solar

2012-08-12 11:39:49

I'm probably wrong but instead of Exit should you not use Break instead at some point?
Also, what do you mean when you say it works fine for the first loop, wouldn't you be out of the loop if it worked fine the first time around?

Footy

2012-08-12 11:46:02

The Exits mean exit the procedure, and that si what its supposed to do for those. What I mean is this script tans leather, then banks. So it banks fine, goes and tans the leather, then when it gets back to the bank, it says ACA couldnt find the color for all my colors. this is what it returns
SRL Compiled in 16 msec
Object DTM Include: Setup complete.
Current player: My Account
AutoColor = 9539216
Time to walk to the tanner!
Time to walk to the bank!
Failed to find the color, no result.
Failed to find the color, no result.
Failed to find the color, no result.
The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3, 4]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]

Heres the entire script so far.
program AlKharid_Tanner;
{$i srl/srl.simba}
{$i ObjectDTM\ObjDTMInclude.simba}

type TLeatherRecord = record
LeatherDTM, WaitTimeMin, WaitTimeMax:integer;
end;

var
LDTM:TLeatherRecord;
Hides_Tanned, Times_Reset:Integer;
Resetting:boolean;

const
Row = 2; //Row of item to tan in bank.
Column = 2; //Column of item to tan in bank.
Hides_To_Tan = 200; //How many hides are you tanning?
Profit_per_hide = 54; //How much profit do you make per hide tanned? Used in progress report.

procedure DeclarePlayers;
Begin
HowManyPlayers := 3;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; //Username Here!
Players[0].Pass := ''; //Password Here!
Players[0].Pin := ''; //Pin here!
Players[0].Active := True;
Players[0].Strings[0] := 'hardleather'; //What Are we Tanning? Options(GreenLeather, RedLeather, BlackLeather, BlueLeather, RoyalLeather, HardLeather, SoftLeather) Dont Missspell them!

Players[1].Name := ''; //Username Here!
Players[1].Pass := ''; //Password Here!
Players[1].Pin := ''; //Pin here!
Players[1].Active := False; //Set to true if you are using
Players[1].Strings[0] := 'greenleather';

Players[2].Name := ''; //Username Here!
Players[2].Pass := ''; //Password Here!
Players[2].Pin := ''; //Pin here!
Players[2].Active := False; //Set to true if you are using
Players[2].Strings[0] := 'royalleather';
End; //Copy and paste for more players

Procedure LoadTLeatherRecord;
begin
case lowercase(Players[CurrentPlayer].Strings[0]) of
'greenleather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYEhkZGBIAeJQIA4A4hwgvgTED4D4JBBfAOKLQMxpywVUzYSCQSLogBELBgMADIgGaQ==');
LDTM.WaitTimeMin := 1000;
LDTM.WaitTimeMax := 1400;
end;
'blueleather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYChkZGBIB+JUIK4A4mogvgLEJ4D4FhDfg7K5eTyBqplQMBcDJmDEgsEAADGZBtM=');
LDTM.WaitTimeMin := 1200;
LDTM.WaitTimeMax := 1800;
end;
'redleather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYNjAyMCwGIiXA/EeIF4HxJeA+CwQ3wXiy0B8BIhteTmBqplQMBcDJmDEgsEAAKFaB/E=');
LDTM.WaitTimeMin := 2000;
LDTM.WaitTimeMax := 3000;
end;
'blackleather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYNBiZGBQAmJTIJYHYjMgvgjE94D4FBCfAOLLIDlZWaBqJhTMxYAJGLFgMAAAqwgFag==');
LDTM.WaitTimeMin := 2500;
LDTM.WaitTimeMax := 3500;
end;
'softleather': begin
LDTM.LeatherDTM := DTMFromString('mggAAAHicY2NgYIgH4mwgTgXiICAOBeIMIL7IyMBwDYiPAfE5IL4DxbYWnEBZJgzMyoAdMOLAEAAA+wgH0Q==');
LDTM.WaitTimeMin := 0;
LDTM.WaitTimeMax := 0;
end;
'hardleather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYLgDxE+B+DkQXwbiSyDMyMBwHIhvAfEdID4NxDoaskAZJhTMxYAJGLFgMAAAAcAI+g==');
LDTM.WaitTimeMin := 0;
LDTM.WaitTimeMax := 0;
end;
'royalleather': begin
LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYFjOyMAwA4jXAfEWIJ4DxJeA+BoQ3wPiU1DsIB0OVM2EgrkYMAEjFgwGAKx3CDA=');
LDTM.WaitTimeMin := 3000;
LDTM.WaitTimeMax := 4000;
end;
end;

end;

Procedure EnergyChecker;
var
x, y:integer;
begin
if not(loggedin) then
exit;
if findcolortolerance(x, y, 6740716, 406, 91, 742, 123, 10) then
Exit;
RestUntil(85);
Setrun(true);
end;

function BankGroundColor: Integer; //CREDITZ TO ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.62);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 5601960, MMX1, MMY1, MMX2, MMY2, 7);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 17.77) and (X <= 31.27) and (Y >= 16.80) and (Y <= 29.35) and (Z >= 9.49) and (Z <= 16.60) then
begin
Result := arC[i];
// Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;





Procedure WalkOfShame;
var
LodeTeleDTM, LodescreenDTM, Counter, x, y:integer;
begin
LodeTeleDTM := DTMFromString('mlwAAAHicY2dgYLBjYmBwBmJHIDYFYisgNgdiGyAWZmRgEABieSAWBWJ+IJYBYgkgLoubwdA25wYG3nfkE4MIA27AiAdDAQBVqBA4');
LodeScreenDTM := DTMFromString('mrAAAAHic42BgYOBgZGDwBuKnQDYrkN4MpHWB9DsGCDsAiEOAOByII6EYxI4C4kAgFpNTYnj9YA9OLAJUw4wHMxLAMAAAtbUYsg==');
wait(randomrange(400, 2000));
Gametab(tab_magic);
Marktime(counter);
repeat
wait(randomrange(25, 200));
if timefrommark(counter) > 8000 then
begin
writeln('We couldnt find the hometele button! Logging out!');
Logout;
Exit;
end;
until(findDTM(LodeTeleDTM, x, y, MIX1, MIY1, MIX2, MIY2));
Mouse(x, y, 3, 3, 1);
Marktime(counter);
repeat
wait(randomrange(25, 200));
if timefrommark(counter) > 10000 then
begin
writeln('We couldnt open the Lodestone screen! Logging out!');
Logout;
Exit;
end;
until(FindDTM(LodeScreenDTM, x, y, MSX1, MSY1, MSX2, MSY2));
Marktime(counter);
LodestoneTeleport('Al Kharid');
wait(randomrange(16000, 20000));
RadialWalkTolerance(6654870, 345, 356, 75, 2, 2, 20);
repeat
wait(randomrange(50, 250));
until not(ismoving);
RadialWalkTolerance(BankGroundColor, 300, 325, 75, 2, 2, 15);
repeat
wait(randomrange(100, 500));
until not(ismoving);
Resetting := True;
inc(Times_reset);




end;

Procedure BankFailSafe;
var
cx, cy:integer;
begin
if not(loggedin) then
exit;
if ObjDTM_find('87:80:4:7:7:94:44:7:7:81:40:7:7:88:117:7:7:49:103:4:65:63:119:62:120:97:62:94', cx, cy, true) then
exit else
WalkOfShame;

end;

function BankColor1: Integer; //Credit to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.19, 0.77);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 8820910, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 25.94) and (X <= 40.31) and (Y >= 25.83) and (Y <= 40.15) and (Z >= 21.37) and (Z <= 33.65) then
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function BankColor2: Integer; //Credit to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.24, 0.05);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 8486529, MSX1, MSY1, MSX2, MSY2, 9);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 13.63) and (X <= 28.96) and (Y >= 14.21) and (Y <= 30.01) and (Z >= 15.91) and (Z <= 33.55) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

Function OpenBankCustom:boolean;
var
counter, BankFails, x, y:integer;
begin
if resetting = true then
begin
Writeln('We are now back on course, Lets roll');
Resetting := false;
end;
if not(loggedin) then
exit;
if bankfails >= 3 then
begin
writeln('We failed 3 times trying to open the bank! Closing script and logging out!');
Logout;
Exit;
end;
if FindObjTPAMulti(x, y, [BankColor1, BankColor2], 5, 2, 15, 15, 75, ['Bank Bank', 'ank B', 'Bank B', 'k Ban', 'nk Ba']) then
begin
Mouse(x, y, 7, 3, mouse_right);
WaitOption('Bank Bank', 1000);
Marktime(Counter);
repeat
wait(randomrange(50, 200));
if TimeFromMark(Counter) > 7000 then
begin
writeln('The bank never opened! Lets try again');
inc(BankFails);
Exit;
end;
until(BankScreen or PinScreen);
end else
begin
writeln('We couldnt find the bank! Lets try again!');
inc(BankFails);
Exit;
end;
if (bankscreen or pinscreen) then
Result := True else
Result := False;
end;

Procedure SetupStuff;
begin
SetupSRL;
ObjDTM_Setup;
DeclarePlayers;
LoadTLeatherRecord;
Loginplayer;
wait(randomrange(100, 200));
Makecompass('W');

end;



Procedure WalkToBank;
begin
if resetting = true then
exit;
if not(loggedin) then
exit;
EnergyChecker;
writeln('Time to walk to the bank!');
RadialWalkTolerance(6523286, 265, 275, 75, 2, 2, 20);
repeat
wait(randomrange(25, 150));
until(not(ismoving));
RadialWalkTolerance(BankGroundColor, 295, 315, 65, 2, 2, 20);
repeat
wait(randomrange(25, 150));
until(not(ismoving));
EnergyChecker
BankFailsafe;
end;

Procedure WithDrawStuff;
begin
if resetting = true then
exit;
if not(loggedin) then
exit;
Wait(randomrange(50, 250));
Withdraw(column - 1, row - 1, 28);
wait(randomrange(100, 300));
end;

Procedure Bankprocedure;
var
counter:integer;
begin
if resetting = true then
exit;
if not(loggedin) then
exit;
Marktime(Counter);
while not(Bankscreen or Pinscreen) do
wait(randomrange(100, 400));
if timefrommark(counter) > 10000 then
begin
Writeln('We couldnt open the bank! Logging out!');
Logout;
Exit;
end;
repeat
If (PinScreen) Then (InPin(Players[0].Pin));
until (BankScreen);
DepositAll;
WithDrawStuff;
closebank;
wait(randomrange(100, 300));
Hides_Tanned := Hides_Tanned + 28;
end;

Procedure Antiban;
begin
if not(loggedin) then
exit;
case random(200) of
1: begin writeln('Antiban: Wait'); wait(randomrange(10000, 30000)); end;
2..5: begin writeln('Antiban: Checking skills'); Gametab(tab_stats) wait(randomrange(10000, 20000)); gametab(tab_Inv); wait(randomrange(100, 200)); end;
6..8: begin writeln('Antiban: Checking crafting XP'); Gametab(tab_stats) wait(randomrange(200, 600)); HoverSkill('Crafting', false); wait(randomrange(2000, 10000)); Gametab(tab_Inv); wait(randomrange(200, 450)); end;
9..12: begin writeln('Antiban: Sleepandmovemouse'); sleepandmovemouse(randomrange(1000, 10000)); end;
14..15: begin writeln('Antiban: Checking whos online'); Gametab(tab_Friends); wait(randomrange(2000, 3000)); Gametab(tab_Inv); wait(randomrange(100, 200)); end;
end;
end;

Procedure Proggy;
begin
if not(loggedin) then
exit;
Writeln('***************************************************');
Writeln('Time running = ' + (TimeRunning));
Writeln('We have Tanned ' + IntToStr(Hides_Tanned) + ' Hides so far!!');
Writeln('We have Earned ' + IntToStr(Profit_per_hide * Hides_Tanned) + ' GP so far!');
Writeln('We are Tanning ' + IntToStr(round(3600000 * 1.0 / GetTimeRunning * Hides_Tanned)) + ' Hides Per hour!');
Writeln('We are Earning ' + IntToStr(round(3600000 * 1.0 / GetTimeRunning * Profit_per_hide)) + ' Gp Per hour!');
Writeln('Thanks for using Footys Generic Tanner! Please leave feedback on the script thread!');
Writeln('***************************************************');
end;

Procedure WalkToTanner;
begin
if not(loggedin) then
exit;
if resetting = true then
exit;
writeln('Time to walk to the tanner!');
wait(randomrange(200, 600));
RadialWalkTolerance(6917275, 120, 134, 72, 2, 2, 20);
repeat
wait(randomrange(25, 150));
until(not(ismoving));
RadialwalkTolerance(49107, 40, 100, 75, 2, 2, 30);
repeat
wait(randomrange(25, 150))
until(not(ismoving));
EnergyChecker;



end;

function TannerCapeColor: Integer; //Creditz to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 2.47);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 15324904, MSX1, MSY1, MSX2, MSY2, 9);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 57.29) and (X <= 87.20) and (Y >= 58.19) and (Y <= 88.80) and (Z >= 67.85) and (Z <= 102.98) then
begin
Result := arC[i];
// Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function TannerShirtColor: Integer;
var //CREDITS TO ACA
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.14);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 3363187, MSX1, MSY1, MSX2, MSY2, 3);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 104) and (R <= 126) and (G >= 73) and (G <= 89) and (B >= 46) and (B <= 56) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 8.77) and (X <= 12.66) and (Y >= 8.09) and (Y <= 11.64) and (Z >= 3.77) and (Z <= 5.21) then
begin
Result := arC[i];
// Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

Function ClickTanner:boolean;
var
TanScreenDTM, counter, x, y:Integer;
begin
TanScreenDTM := DTMFromString('mggAAAHicY2NgYHjLyMBwE0j3A7EjEOsDcSwQPwGKLwXiqUC8EIinAPFkIC61EWb4//8/BuYC6mHFghlxYAgAAPN8FvQ=');
if not(loggedin) then
exit;
wait(randomrange(500, 1000));
if findobjTPAMulti(x, y, [TannerCapeColor, TannerShirtColor], 5, 2, 10, 10, 20, ['llis', 'Ellis']) then
begin
wait(randomrange(100, 300));
Mouse(x, y, 2, 2, mouse_right);
waitoption('ides', 1000);
end else
begin
Mouse(257, 152, 4, 4, mouse_right);
WaitOptionmulti(['hides', 'ide', 'an hi'], 1000);
end;

Marktime(counter);
repeat
wait(randomrange(50, 150));
if TimeFromMark(counter) > 8000 then
begin
writeln('Tanning screen not opening up! Logging out!');
Logout;
Exit;
end;
until(FindDTM(TanScreenDTM, x, y, MCX1, MCY1, MCX2, MCY2));
Result := True;
FreeDTM(TanScreenDTM);
wait(randomrange(1000, 2000));

end;

Procedure TanHides;
var
Counter, x, y:integer;
begin
if resetting = true then
exit;
if not(loggedin) then
exit;
if FindDTM(LDTM.LeatherDTM, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
Mouse(x, y, 5, 5, mouse_left);
exit;
end else
begin
MMouse(501, 427, 2, 10)
wait(randomrange(LDTM.WaitTimeMin, LDTM.WaitTimeMax));
Mousebox(5, 341, 505, 426, 3);
Marktime(counter);
repeat
wait(randomrange(50, 200));
if TimefromMark(counter) > 10000 then
begin
writeln('We couldnt find the LeatherDTM! Logging out!');
Logout;
exit;
end;
until(findDTM(LDTM.LeatherDTM, x, y, MCX1, MCY1, MCX2, MCY2));
mouse(x, y, 5, 5, mouse_left);
exit;
end;
Writeln('Strings[0] String " ' + (Players[0].Strings[0]) + ' " Is unknown. Please enter an option from the list. Logging out!');
Logout;
Exit;
end;

Procedure ReleaseDTMs;
begin
FreeDTM(LDTM.LeatherDTM);
end;

begin
repeat
SetupStuff;
repeat
repeat
OpenBankCustom;
until(BankScreen or pinscreen);
Bankprocedure;
WalkToTanner;
if ClickTanner then
TanHides;
WalkToBank;
Proggy;
until((Hides_Tanned >= Hides_To_Tan) or not(loggedin) or (times_reset > 2));
ReleaseDTMs;
Nextplayer(false);
until(allplayersinactive);
end.

Solar

2012-08-12 12:36:42

Been looking at this for like an hour. Be nice to see what the solution is.
Sorry I wasn't any help.

Footy

2012-08-12 12:48:00

Thats alright, thanks for trying! Still waiting for a solution!

Footy

2012-08-12 17:03:10

Bump, still wont work, need help! :(

Le Jingle

2012-08-12 17:29:06

I see in your OpenBankCustom func, you only want to move the mouse once? Maybe adding in a loop to encase the mouse(x,y..etc), so you have more than 1 chance to open the banker? Didn't look at the rest of the script, sorry if that's already covered. Also, FindObjTPAMulti, can be tricky (I don't like it personally). If you use it, try toggling the bit of params in the func? (I think they're these below);

tol, cts, objwidth, objheight, mincount

Footy

2012-08-12 17:48:52

Would that be why the ACA procedures arent returning a color? all 3 of them say no color found… Ill try your suggestions, and let you know what happens.

P1ng

2012-08-12 18:07:52

What are you using to autocolor your BankColor1 and BankColor2? Also, I'd recommend the use of actual TPAs here instead of FindObjTPA. Just my personal preference and I'm sure many others would agree that it's much more efficient

Footy

2012-08-12 18:09:30

Procedure Bankcolor1 and Bankcolor2 are ACA made functions. I have those functions, then call them for the color of my bank finding. And I've never used actual TPA's, but ill give it a shot. am I doing the autocoloring correctly?

P1ng

2012-08-12 19:20:33

You are calling the colours correctly, I can't see your autocolor functions, but if you copied them straight out of ACA then I would assume they are correct.

Footy

2012-08-12 19:22:41

They are in the third post of the thread, just use ctrl + f and search for the procedure name, Bankcolor1, and Bankcolor2. Script still doing the same thing, doing one loop, then not finding any colors on the second loop…

Brandon

2012-08-12 19:25:13

Anyway as per the PM:


Function OpenBankCustom: Boolean;
var
B: TBox;
Location: TPoint;
CTS, I, L: Integer;
ATPA: T2DPointArray;
TPA, TPA2: TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 2.40);
FindColorsTolerance(TPA, 8434655, MSX1, MSY1, MSX2, MSY2, 15);
If (Length(TPA) < 1) then Exit;

SortTPAFrom(TPA, Point(MSCX, MSCY));

ATPA:= TPAToATPAEx(TPA, 31, 190);
L := Length(ATPA);
If (L < 1) then Exit;

SetColorSpeed2Modifiers(0.11, 0.20);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));

For I := 0 To L Do
begin
B := GetTPABounds(ATPA[I]);
with B do
begin
If (FindColorsTolerance(TPA2, 4937053, MSX1, MSY1, MSX2, MSY2, 20)) then
begin
Location := MiddleTPA(TPA2);
MMouse(Location.X, Location.Y, 0, 0);
If (WaitUptextMulti(['ank', 'Bank', 'ooth', 'booth', 'ank boo'], 600)) then
begin
ClickMouse2(MOUSE_LEFT);
Result := True;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
end;
end;
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;

Footy

2012-08-12 19:28:22

From: Brandon
Anyway as per the PM:


Function OpenBankCustom: Boolean;
var
B: TBox;
Location: TPoint;
CTS, I, L: Integer;
ATPA: T2DPointArray;
TPA, TPA2: TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 2.40);
FindColorsTolerance(TPA, 8434655, MSX1, MSY1, MSX2, MSY2, 15);
If (Length(TPA) < 1) then Exit;

SortTPAFrom(TPA, Point(MSCX, MSCY));

ATPA:= TPAToATPAEx(TPA, 31, 190);
L := Length(ATPA);
If (L < 1) then Exit;

SetColorSpeed2Modifiers(0.11, 0.20);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));

For I := 0 To L Do
begin
B := GetTPABounds(ATPA[I]);
with B do
begin
If (FindColorsTolerance(TPA2, 4937053, MSX1, MSY1, MSX2, MSY2, 20)) then
begin
Location := MiddleTPA(TPA2);
MMouse(Location.X, Location.Y, 0, 0);
If (WaitUptextMulti(['ank', 'Bank', 'ooth', 'booth', 'ank boo'], 600)) then
begin
ClickMouse2(MOUSE_LEFT);
Result := True;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
end;
end;
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;


Thank you soooo much brandon! Rep+! Do you mind if I use this in my script when it goes public, with credit, of course?