SRL Archive - Reflection Help

it wont click sometimes


Kasi

2008-08-27 16:40:42

here this is my script its a draynor willow cutter it wont click after the first click
program New;
{.Include SRL/SRL/Misc/SMART.Scar}
{.Include SRL/SRL.Scar}
{.include SRL/SRL/Reflection/Reflection.scar}
Var
Path, WillowCoords : TPointArray;
I, Dis, WFlag, X, Y, FX, FY, Axe, AX, AY, WCLevel, ALevel, Log, Wc, Bxe, BX, BY,
WillowCount, Ent, EX, EY : Integer;
FindFlag, Equiped, Broken : Boolean;
ObjectRecord: TAutoColorInfo;
Me, P : Tpoint;

Procedure DeclarePlayers;
Begin

CurrentPlayer := 0;
HowManyPlayers := 1;
NumberOfPlayers( HowManyPlayers );

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Pin := '';
Players[0].Strings[0] := '';
Players[0].loc := '';
Players[0].Active := True;

Writeln( IntToStr ( HowManyPlayers ) + ' Player[s]' );

end;

Procedure AtReflectionCoords;
Begin
Me := GetMyPos;
Writeln('We Are At X : '+IntToStr(Me.x)+', Y : '+IntToStr(Me.y)+'.');
End;

Function FindWoodCuttingAxe : Boolean;
Begin
Axe := DTMFromString('78DA6394616060D0654001265EC10CFF81342' +
'310FF0702463E20C389010D302291405A900835F240C298801A45' +
'20A145408D30903022A0460C486812502349580D005F3E0833');
GameTab(4);
If FindDTM(Axe, AX, AY, MIX1, MIY1, MIX2, MIY2) Then
Begin
Result := True;
Equiped := False;
WriteLn('Found Axe In Inventory');
FreeDTM(Axe);
End;
If Not FindDTM(Axe, AX, AY, MIX1, MIY1, MIX2, MIY2) Then
Begin
Gametab(5);
If FindDTM(Axe, AX, AY, MIX1, MIY1, MIX2, MIY2) Then
Begin
Result := True;
Equiped := True;
WriteLn('Found Axe Equiped');
FreeDTM(Axe);
End;
End;
End;

Function IsAxeEquipable : Boolean;
Begin
WCLevel := GetSkillLevel('Woodcutting');
ALevel := GetSkillLevel('Attack');
Case LowerCase(Players[CurrentPlayer].Strings[0]) Of
'Bronze' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
'iron' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
'steel' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
If ALevel = 5 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
If ALevel > 5 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
End;
'black' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
If ALevel = 10 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
If ALevel > 10 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
End;
'mith' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
If ALevel = 20 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
If ALevel > 20 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
End;
'addy' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
If ALevel = 30 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
If ALevel > 30 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
End;
'rune' :Begin
If Not FindWoodCuttingAxe Then TerminateScript;
If FindWoodCuttingAxe And Equiped = False Then
Begin
If ALevel = 40 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
If ALevel > 40 Then
Begin
Mouse(AX, AY, 2, 2, False);
ChooseOption('ield');
Equiped := True;
Result := True;
End;
End;
End;
End;
Begin
If WCLevel = 30 Then
Begin
WriteLn('Your Woodcutting Level Is 30...Enough To Cut Willows.');
End;
If WCLevel > 30 Then
Begin
WriteLn('Your WoodCutting Level Is '+IntToStr(WCLevel)+'...More Then Enough To Cut Willows.');
End;
If WCLevel < 30 Then
Begin
WriteLn('Your WoodCutting Level Is '+IntToStr(WCLevel)+'...Not Enough To Cut Willows...');
WriteLn('Go Train Up Some More');
TerminateScript;
End;
End;
End;

Function MiddlePathRandom: TPointArray;
Begin
Setlength(Result, 1);
Case Random(1) Of
0 : Result[0] := Point(3085, 3238);
1 : Result[0] := Point(3086, 3238);
2 : Result[0] := Point(3086, 3237);
3 : Result[0] := Point(3085, 3237);
4 : Result[0] := Point(3087, 3237);
5 : Result[0] := Point(3088, 3237);
6 : Result[0] := Point(3089, 3237);
7 : Result[0] := Point(3089, 3236);
8 : Result[0] := Point(3088, 3236);
9 : Result[0] := Point(3087, 3236);
End;
End;

Function WillowPathRandom : TPointArray;
Begin
SetLength(Result, 1);
Case Random(1) Of
0 : Result[0] := Point(3087, 3226);
1 : Result[0] := Point(3087, 3227);
2 : Result[0] := Point(3088, 3227);
3 : Result[0] := Point(3087, 3228);
4 : Result[0] := Point(3088, 3228);
5 : Result[0] := Point(3089, 3228);
6 : Result[0] := Point(3089, 3229);
7 : Result[0] := Point(3089, 3230);
8 : Result[0] := Point(3089, 3231);
9 : Result[0] := Point(3088, 3231);
10: Result[0] := Point(3088, 3230);
11: Result[0] := Point(3087, 3230);
12: Result[0] := Point(3087, 3231);
13: Result[0] := Point(3086, 3231);
14: Result[0] := Point(3086, 3230);
15: Result[0] := Point(3086, 3229);
16: Result[0] := Point(3087, 3232);
17: Result[0] := Point(3087, 3233);
18: Result[0] := Point(3086, 3232);
19: Result[0] := Point(3085, 3232);
20: Result[0] := Point(3084, 3232);
21: Result[0] := Point(3084, 3233);
22: Result[0] := Point(3084, 3234);
23: Result[0] := Point(3085, 3234);
24: Result[0] := Point(3086, 3234);
25: Result[0] := Point(3087, 3234);
26: Result[0] := Point(3088, 3234);
27: Result[0] := Point(3089, 3234);
28: Result[0] := Point(3089, 3232);
29: Result[0] := Point(3089, 3233);
30: Result[0] := Point(3085, 3235);
31: Result[0] := Point(3085, 3236);
32: Result[0] := Point(3084, 3236);
33: Result[0] := Point(3083, 3236);
34: Result[0] := Point(3082, 3236);
35: Result[0] := Point(3082, 3235);
36: Result[0] := Point(3083, 3234);
37: Result[0] := Point(3089, 3227);
38: Result[0] := Point(3089, 3226);
39: Result[0] := Point(3088, 3226);
End;
End;

Function BankPathRandom : TpointArray;
Begin
Setlength(Result, 1);
Case Random(1) Of
0 : Result[0] := Point(3092, 3244);
1 : Result[0] := Point(3092, 3242);
2 : Result[0] := Point(3092, 3241);
End;
End;

Function FindFlagDistance : Integer;
Begin
WFlag := DTMFromString('78DA6314606060E0614001FFA13423880D048' +
'C42408618AA9A586341B81A302D88A9E658180BAA1A90391C4498' +
'C381DB3D609A1B48F011502348580D00E8A20B3F');
If FindDtm(WFlag, Fx, Fy, MMX1, MMY1, MMX2, MMY2) Then
Begin
FindFlag := True;
Result := Distance(MMCX, MMCY, Fx, Fy);
FreeDtm(WFlag);
End;
If Not FindDtm(WFlag, Fx, Fy, MMX1, MMY1, MMX2, MMY2) Then
Begin
Writeln('Flag Not Found');
FindFlag := False;
FreeDtm(WFlag);
End;
End;

Procedure DistanceWalkFlag;
Begin
FindFlagDistance;
If FindFlag Then
Begin
Repeat
Dis := FindFlagDistance;
Status(+IntToStr(Dis)+' Pixel(s) Away From Flag');
Wait(100);
Until(Not(FindFlag));
End;
End;

Procedure WalkReflectionPath(WhichPath, RandX, RandY : Integer);
Begin
Case WhichPath Of
0:Path := WillowPathRandom;
1:Path := MiddlePathRandom;
2:Path := BankPathRandom;
End;
For I := 0 To High(Path) Do
Begin
WalkToTile(Path[I], RandX, RandY);
DistanceWalkFlag;
AtReflectionCoords;
End;
End;

Procedure WalkTheReflection(Where:String);
Begin
Case Where Of
'Willow':Begin
WalkReflectionPath(0, 0, 0);
Players[CurrentPlayer].loc := 'Willow';
End;
'Middle':Begin
WalkReflectionPath(1, 0, 0);
Players[CurrentPlayer].loc := 'Middle';
End;
'Bank' :Begin
WalkReflectionPath(2, 0, 0);
Players[CurrentPlayer].loc := 'Bank';
End;
End;
End;

Function FindWillowReflected : Boolean;
Begin
WillowCoords := [Point(3083, 3236), Point(3084, 3236), Point(3084, 3235), Point(3083, 3235),
Point(3085, 3234), Point(3086, 3234), Point(3086, 3233), Point(3085, 3233),
Point(3088, 3233), Point(3089, 3232), Point(3089, 3233), Point(3088, 3232),
Point(3087, 3230), Point(3088, 3230), Point(3088, 3229), Point(3087, 3229),
Point(3088, 3226), Point(3089, 3226), Point(3089, 3225), Point(3088, 3225)];
SortTPAFrom(WillowCoords, GetMyPos);
If (DistanceFrom(WillowCoords[0]) > 3) then
Begin
If not(TileOnMM(WillowCoords[0])) then
Begin
Writeln('Couldn''t find bank');
Result := False;
Exit;
End;
WalkToTile(WillowCoords[0], 0, 0);
Wait(10);
DistanceWalkFlag;
Wait(100 + Random(100));
End;
If Not(TileOnMS(WillowCoords[0], 15)) Then
Begin
SetAngle(True);
MakeCompass('n');
If not(TileOnMS(WillowCoords[0], 20)) Then
Begin
Writeln('Couldnt'' find bank booth');
Result := False;
Exit;
End;
End;
P := TileToMS(WillowCoords[0], 20);
Mouse(p.x, p.y, 5, 5, False);
Wait(100 + Random(100));
Result := ChooseOption('hop');
End;

Function FindWillowEnt : Boolean;
Begin
Ent := DTMFromString('78DA9D934D0B8240108677AD28E81059F675F' +
'0D0C10E097A89D2DF5FE92A7E54D045837E4A1A5D6666C1210F23' +
'8B0FEFFBCEEC28774288B9008F52F2FB96BFB36CBF4F2053DC469' +
'45940E6F11C43C66ACAB2C3ABD55841268A0DC8B41A33C8E4C500' +
'321B9AB9BCA3CC6BEA758D0CDAD71432D5DB848CDD141365C63AB' +
'666CE499F32284FAC343A68CE2AED41664B7B7FD543CA209DBAD2' +
'30284F5E22C6617839B477E2E550AF0CDFA9CBD071E96E6819E47' +
'5BE08C8ECE9AEA619BA2F8FEAA804DD85CFD8799FF10F7A8CBE7C' +
'CD6E609D0343E7D814AB8309193A21D5217942C67C02CD9CFFD13' +
'975331F3BBE43D6');
MMouse(X, Y, 0, 0);
If FindDTM(Ent, EX, EY, MSX1, MSY1, MSX2, MSY2) Then
Begin
Result := True;
Mouse(623, 85, 0, 0, True);
Wait(1000);
Repeat
MMouse(X, Y, 0, 0);
If FindDTM(Ent, EX, EY, MSX1, MSY1, MSX2, MSY2) Then Wait(1000);
Until(Not (FindDTM(Ent, EX, EY, MSX1, MSY1, MSX2, MSY2)));
End;
FreeDTM(Ent);
End;

Function FindWillowTree : Boolean;
Begin
with ObjectRecord do
begin
UpText := 'hop';
MaxDist := 15;
Color := 1916208;
HueMod := 0.41;
SatMod := 1.73;
LumTol := 3;
MinR := 37; MaxR := 58;
MinG := 49; MaxG := 70;
MinB := 23; MaxB := 37;
MinX := 2.10; MaxX := 4.15;
MinY := 2.74; MaxY := 5.27;
MinZ := 1.32; MaxZ := 2.48;
end;
If FindObjRecordEx(x, y, ObjectRecord, MSX1, MSY1, MSX2, MSY2, False, True) Then Result := True;
If Not FindObjRecordEx(x, y, ObjectRecord, MSX1, MSY1, MSX2, MSY2, False, True) Then FindWillowReflected;
End;

Function FindDraynorBank : Boolean;
Begin
with ObjectRecord do
begin
UpText := 'Use';
MaxDist := 15;
Color := 405828;
HueMod := 0.03;
SatMod := 0.27;
LumTol := 4;
MinR := 53; MaxR := 84;
MinG := 38; MaxG := 61;
MinB := 4; MaxB := 8;
MinX := 2.25; MaxX := 5.24;
MinY := 2.23; MaxY := 5.11;
MinZ := 0.44; MaxZ := 0.93;
end;
If FindObjRecordEx(x, y, ObjectRecord, MSX1, MSY1, MSX2, MSY2, False, True) Then Result := True;
If Not FindObjRecordEx(x, y, ObjectRecord, MSX1, MSY1, MSX2, MSY2, False, True) Then
Begin
OpenBankReflection('db');
Result := True;
End;
End;

Function CountThemWillows : Integer;
Begin
Log := DTMFromString('78DA6394606060E06340013ECEE20CFF81342' +
'310FF0702460E204384010D302291401A640E0701358A44A85101' +
'120204D4A811E11E905D1204D480CC9021A00614365204D4F0020' +
'94EFC6A008DA3075F');
Wc := CountItemsIn('inv', 'dtm', log, []);
FreeDTM(Log);
Result := Wc;
End;

Function IsAxeBroken : Boolean;
Begin
bxe := DTMFromString('78DA63746662602864644006F601F60CFF813' +
'448F43F1030BA01D514A3AA81C8C24820ED09545340408D3B504D' +
'0501350E40352544A8C923A0C606A8269F801A53A09A36026ACC8' +
'16A3A08A8B102AA29C7AF06000AF40D22');
If Equiped Then Gametab(5);
If Not Equiped Then Gametab(4);
If FindDTM(Bxe, BX, BY, MIX1, MIY1, MIX2, MIY2) Then
Begin
Result := True;
Broken := True;
End;
FreeDTM(Bxe);
End;

Procedure WithDrawNewAxe;
Begin
Axe := DTMFromString('78DA6394616060D0654001265EC10CFF81342' +
'310FF0702463E20C389010D302291405A900835F240C298801A45' +
'20A145408D30903022A0460C486812502349580D005F3E0833');
If BankScreen Then
Begin
FixBankTab;
If FindDTM(Axe, BX, BY, MSX1, MSY1, MSX2, MSY2) Then
Begin
Mouse(BX, BY, 0, 0, False);
ChooseOption('w-1');
End;
FreeDTM(Axe);
End;
FreeDTM(Axe);
End;

Procedure BankTheWillows;
Begin
IsAxeBroken;
If Players[CurrentPlayer].loc = 'Bank' Then
Begin
If Not FindDraynorBank Then OpenBankReflection('db');
If FindDraynorBank Then
Begin
If PinScreen Then InPin(Players[CurrentPlayer].Pin);
If BankScreen Then
Begin
WillowCount := CountThemWillows;
If Not Equiped Then Deposit(2, 28, True);
If Equiped Then DepositAll;
If Broken Then WithDrawNewAxe;
CloseBank;
End;
End;
End;
End;

Procedure AreWeCutting;
Begin
MMouse(X, Y, 0, 0);
Repeat
If IsUpText('hop') then
Begin
Wait(1);
FindWillowEnt;
End;
Until(Not(IsUpText('hop')));
End;

Procedure SRLSMARTReflection;
Begin
SetupSRL;
SmartSetup('world106', True, True, False);
Wait(1000);
SetTargetDC(SmartGetDC);
While Not RSReady Do Wait(100);
// SetupReflection;
End;

Procedure WoodCuttingLoop;
Begin
FindWoodCuttingAxe;
IsAxeEquipable;
If Players[CurrentPlayer].loc = 'Bank' Then WalkTheReflection('middle');
If Players[CurrentPlayer].loc = 'Middle' Then WalkTheReflection('willow');
Repeat
If FindWillowTree Then
Begin
Mouse(X, Y, 0, 0, True);
AreWeCutting;
End;
Until(InvFull);
If Players[CurrentPlayer].loc = 'Willow' Then
Begin
WalkTheReflection('bank');
BankTheWillows;
End;
End;

begin
SRLSMARTReflection;
DeclarePlayers;
LoginPlayer;
WoodCuttingLoop;
end.

randy marsh

2008-08-27 16:48:04

click what tree?

Kasi

2008-08-27 16:49:04

no it wont click the mm after the first mm click
and it dont bank

Method

2008-08-27 19:00:21

It doesn't click more than once because the array only has a length of one. You set everything to Result[0] instead of the length of the array that you actually want. Plus, you have some odd random cases in there for seemingly no reason.