cradlefatal
2013-03-11 21:59:06
I have a function this is supposed to find and clickbank I have my procedure which is MyPath from the loadstone to the bank how can I add that function into the end of my code so when it reaches the bank then it does what that function is
here is my code for the function and procedure and the full code for the script
here is my code for the function and procedure and the full code for the script
function Findandclickbank(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
if not(FindColorsTolerance(arP, 15858941, MSX1, MSY1, MSX2, MSY2, 0)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 91.17) and (X <= 91.21) and (Y >= 96.83) and (Y <= 96.87) and (Z >= 97.07) and (Z <= 97.11) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Counter')) then
begin;
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;
GetMousePos(fx, fy);
end;
Procedure My_Path1;
Var
WalkTime, cx, cy: Integer;
Begin
If not LoggedIn then Exit;
MarkTime(WalkTime);
SPS_GetMyPos;
begin
If (ObjDTM_Find('90:79:5:0:7:142:47:0:7:88:31:1:7:120:29:3:7:106:96:3:7:102:121:6:81:46:110:48:112:75:72:154:53:68:66:48', cx, cy, True)) Then
Writeln('In Edgeville');
If (ObjDTM_Find('80:80:5:0:7:87:32:0:7:141:47:1:7:119:31:3:7:106:96:3:7:102:120:5:45:48:107:49:101:127:64:125:60:98', cx, cy, True)) Then
Writeln('Lodestone 2nd Attempt');
If (ObjDTM_Find('80:80:5:0:7:139:44:0:7:87:29:1:7:118:28:3:7:105:91:3:7:101:115:5:89:148:109:43:46:47:48:85:65:100', cx, cy, True)) Then
Writeln('Lodestone Found on 3rd try');
If (ObjDTM_Find('80:80:5:0:7:134:48:0:7:83:34:1:7:113:32:3:7:101:95:3:7:97:118:3:46:55:104:55:91:123', cx, cy, True)) Then
Writeln('Wow Finally found the Lodestone 4th try');
If (ObjDTM_Find('80:80:4:3:7:96:118:3:7:100:95:1:7:112:33:0:7:83:35:4:48:53:102:54:79:151:49:83', cx, cy, True)) Then
Writeln('Found Lodestone on 5th Attempt')
Else
Begin
Writeln('Unable to locate starting point, Starting over');
MakeCompass('S');
end;
end;
begin
If (ObjDTM_Walk('103:107:3:1:7:90:48:2:7:25:125:10:7:126:92:3:82:81:78:134:122:130', 2, 100, 5, True)) Then
Writeln('Walking to Bank');
If (ObjDTM_Walk('75:127:3:1:7:66:27:10:7:66:102:10:7:102:69:3:80:79:62:133:101:146', 2, 100, 5, True)) Then
Writeln('made it to point B');
If (ObjDTM_Walk('46:111:4:1:7:68:119:1:7:84:127:10:7:97:131:10:7:97:103:5:79:84:47:99:44:124:50:122:56:117', 2, 100, 5, True)) Then
Writeln('point c');
end;
end;
End;
program The_Walker;
{$DEFINE SMART8}
{$I SRL\SRL.simba}
{$I SRL\SRL\misc\Debug.simba}
{$I Srl/Srl/Skill/Mining.Simba}
{$I Srl/Srl/Skill/Crafting.Simba}
{$I SRL\SRL\Misc\smartgraphics.simba}
{$I sps/sps.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
CONST
Version = '1.0';
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
Active := True;
end;
End;
Procedure BasicSetup;
Var
LastPainted, StartTime: Integer;
Begin
Smart_FixSpeed:=True;
SRL_SixHourFix:=True;
SetupSRL;
ObjDTM_Setup;
MarkTime(LastPainted);
MouseSpeed:=50;
DeclarePlayers;
StartTime:=GetSystemTime;
LoginPlayer;
Wait(1500);
If (TimeFromMark(StartTime) > 120000) Then
SelectWorld(RandomWorld(Players[0].Member,True));
End;
Procedure PrepTime;
Begin
LodestoneTeleport('Taverley');
Writeln('porting now');
Wait(8000);
Writeln('wait time for portal');
SPS_Setup(RUNESCAPE_SURFACE,['11_7','11_6','10_6','10_7','12_7','12_6']);
SPS_GetMyPos;
Writeln('checking location');
MakeCompass('W');
GameTab(tab_inv);
End;
function Findandclickbank(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
if not(FindColorsTolerance(arP, 15858941, MSX1, MSY1, MSX2, MSY2, 0)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 91.17) and (X <= 91.21) and (Y >= 96.83) and (Y <= 96.87) and (Z >= 97.07) and (Z <= 97.11) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Counter')) then
begin;
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;
GetMousePos(fx, fy);
end;
Procedure My_Path1;
Var
WalkTime, cx, cy: Integer;
Begin
If not LoggedIn then Exit;
MarkTime(WalkTime);
SPS_GetMyPos;
begin
If (ObjDTM_Find('90:79:5:0:7:142:47:0:7:88:31:1:7:120:29:3:7:106:96:3:7:102:121:6:81:46:110:48:112:75:72:154:53:68:66:48', cx, cy, True)) Then
Writeln('In Edgeville');
If (ObjDTM_Find('80:80:5:0:7:87:32:0:7:141:47:1:7:119:31:3:7:106:96:3:7:102:120:5:45:48:107:49:101:127:64:125:60:98', cx, cy, True)) Then
Writeln('Lodestone 2nd Attempt');
If (ObjDTM_Find('80:80:5:0:7:139:44:0:7:87:29:1:7:118:28:3:7:105:91:3:7:101:115:5:89:148:109:43:46:47:48:85:65:100', cx, cy, True)) Then
Writeln('Lodestone Found on 3rd try');
If (ObjDTM_Find('80:80:5:0:7:134:48:0:7:83:34:1:7:113:32:3:7:101:95:3:7:97:118:3:46:55:104:55:91:123', cx, cy, True)) Then
Writeln('Wow Finally found the Lodestone 4th try');
If (ObjDTM_Find('80:80:4:3:7:96:118:3:7:100:95:1:7:112:33:0:7:83:35:4:48:53:102:54:79:151:49:83', cx, cy, True)) Then
Writeln('Found Lodestone on 5th Attempt')
Else
Begin
Writeln('Unable to locate starting point, Starting over');
MakeCompass('S');
end;
end;
begin
If (ObjDTM_Walk('103:107:3:1:7:90:48:2:7:25:125:10:7:126:92:3:82:81:78:134:122:130', 2, 100, 5, True)) Then
Writeln('Walking to Bank');
If (ObjDTM_Walk('75:127:3:1:7:66:27:10:7:66:102:10:7:102:69:3:80:79:62:133:101:146', 2, 100, 5, True)) Then
Writeln('made it to point B');
If (ObjDTM_Walk('46:111:4:1:7:68:119:1:7:84:127:10:7:97:131:10:7:97:103:5:79:84:47:99:44:124:50:122:56:117', 2, 100, 5, True)) Then
Writeln('point c');
end;
end;
End;
Begin
BasicSetup;
PrepTime;
My_Path1;
End.