Torrent of Flame
2009-05-27 20:19:06
This is my script and the TPA Works, but at the cost of about 15 seconds of extreme lag before clicking a Warrior. Is there a way to still use a TPA to find said Warrior but without the cost of a huge amount of lag?
program WarriorKillerATM;
{$DEFINE SMART} {To Remove SMART, Comment this out with //}
{$IFDEF SMART}
{.include SRL/SRL/Misc/SMART.scar}
{$ENDIF}
{.include SRL/SRL.scar}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name :='';
Pass :='';
Nick :='';
Active := true;
BoxRewards := ['Xp', 'ostume', 'gem', 'mote', 'ithril', 'oal'];
end;
end;
var
Warrior: array [0..11] of integer;
Ups: array of string;
{::::::::::::::::::::::: TPA Mod, by Torrent of Flame :::::::::::::::::::::}
function TPAMod(var MidColour, Tolerance: integer; var HueMod, SatMod: Extended; Colors: TIntegerArray): boolean;
var
H, S, L, Tol: Extended;
i, ii: integer;
HSLColor: Array[1..3] of Extended;
HSL: Array[0..1] of Array[1..3] of Extended;
begin
for i := 0 to High(Colors) do
begin
ColortoHSL(Colors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
for ii:= 1 to 3 do
begin
HSL[0][ii] := MinE(HSLColor[ii], HSL[0][ii]);
HSL[1][ii] := MaxE(HSLColor[ii], HSL[1][ii]);
end;
end;
H := HSL[1][1] - HSL[0][1];
S := HSL[1][2] - HSL[0][2];
L := HSL[1][3] - HSL[0][3];
MidColour := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
HueMod := (H/L);
SatMod := (S/L);
Tol := L;
if (MidColour <= 0) then
begin
WriteLn('TPA Variables not found.');
Result := False;
end else
Result := True;
Tolerance := Trunc(Tol + 0.5);
end;
{:::::::::::::::::::::::::: Warrior Variables :::::::::::::::::::::::::::::}
procedure WarriorVariables;
begin
Warrior[0] := 4876399; Warrior[1] := 3097671; Warrior[2] := 3430748; Warrior[3] := 4414308;
Warrior[4] := 5272439; Warrior[5] := 5871775; Warrior[6] := 5981728; Warrior[7] := 7032858;
Warrior[8] := 1845289; Warrior[9] := 5729921; Warrior[10] := 4018779; Warrior[11] := 4809324;
Ups := ['harid', 'arrior'];
end;
{:::::::::::::::::::::::::::: Find Willow Tree :::::::::::::::::::::::::::::}
function FindWarrior: boolean;
var
CTS, i, x, y, Px, Py, MiddleColour, Tolerance: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
HueModifier, SatModifier: Extended;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
//WarriorVariables;
//for i := 0 to High(Warrior) do
begin
//TPAMod(MiddleColour, Tolerance, HueModifier, SatModifier,[Warrior[i]]);
SetColorSpeed2Modifiers(0.38, 0.50);
{ClearDebug;
ClearReport;
Writeln('Hue Modifier is: '+FloatToStr(HueModifier)+'');
Writeln('Saturation Modifier is: '+FloatToStr(SatModifier)+'');
Writeln('Mid Colour is: '+IntToStr(MiddleColour)+'');
Writeln('Tolerance is: '+IntToStr(Tolerance)+''); }
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2961719, MSX1, MSY1, MSX2, MSY2, 39);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := SplitTPAEx(TPA, 5, 5);
for i := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
GetMousePos(Px, Py);
Wait(500 + random(350))
if(IsUpText('arrior')) then
begin
AddToReport('Attacking Using the TPA');
GetMousePos(Px, Py);
case Random(5) of
0:
begin
Mouse(Px, Py, 4, 4, False);
Wait(250 + Random(200));
ChooseOption('ttack');
Result := True;
Exit;
end;
1..4:
begin
Mouse(Px, Py, 4, 4, True);
Result := True;
Exit;
end;
end;
end;
end;
end;
begin
AddToReport('TPA Failed, attacking with FindObjTPA');
if FindObjTPA(x, y, Warrior[i], 20, 2, 15, 15, 7, [Ups]) then
begin
GetMousePos(Px, Py);
case Random(5) of
0:
begin
Mouse(Px, Py, 4, 4, False);
Wait(250 + Random(200));
ChooseOption('ttack');
Exit;
end;
1..4:
begin
Mouse(Px, Py, 4, 4, True);
Exit;
end;
end;
end;
end;
end;
begin
{$IFDEF SMART}
SMARTSetupEx(133, False, True, False);
Wait(5000);
SetTargetDC(SmartGetDC);
repeat
Wait(100);
until (SmartGetColor(253, 233) <> 1118604);
{$ENDIF}
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(5000 + Random(350));
FindWarrior;
end.