SamSatanas
2012-04-22 14:45:30
I am trying to make my first script, from reading tut and videos but I can't seem to get it right. For some reason when I test my script out in Smart, it uses my own mouse.
I am trying to find a goblin and attack it. Also using auto color.
Thanks Blumblebee and tehq
I am trying to find a goblin and attack it. Also using auto color.
program new;
{$DEFINE SMART}
{$DEFINE SRL5}
{$i SRL/srl.simba}
Procedure FailSafe(Reason:String);
begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
Writeln(Reason);
TerminateScript;
end;
Function GColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.46, 1.12);
if not (FindColorsTolerance(arP, 4097397, MSX1, MSY1, MSX2, MSY2, 15)) 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
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function FindGoblin: Boolean;
var
x, y, TreeCounter, TooLong :Integer;
begin
x := MSCX;
y := MSCY;
If FindObj(x, y, 'oblin', GColor, 10) then
begin
Writeln('We Found a Goblin');
GetMousePos(x, y);
Case Random (2) of
0: Mouse(x, y, 7, 7, True);
1:
begin
Mouse(x, y, 5, 5, False);
WaitOption('ttack', 500)
end;
end;
end;
end;
begin
SetupSRL;
GColor;
FindGoblin;
end.
Thanks Blumblebee and tehq