o.k so im making an autocolour and it is going to be multi-player so i decided the user would pick a base colour then i would program the script to find that colour and then check if the monster was already there with danknesses findfightat. then the script would move the mouse to that location and check for uptext 'attack ' + themonstersname this is what i came up with.
SCAR Code:
procedure extrasetup;
var temp : Integer;
begin
if(findcolortolerance(x,y,Colours[CurrentPlayer].begincolour,MSX1,MSY1,MSX2,MSY2,6)) then
begin
if(not InFightAt(x,y))then
begin
writeln('not in fight');
mmouse(x,y,2,2);
if(istextat2(9,9,'Attack ' + Colours[CurrentPlayer].monster,100))then
begin
writeln('found uptext');
Colours[CurrentPlayer].colour1 := getcolor(x,y);
Colours[CurrentPlayer].colour2 := getcolor(x + 5,y + 5);
temp := Colours[CurrentPlayer].colour1 - Colours[CurrentPlayer].colour2;
end;
end;
end;
if(not Colours[CurrentPlayer].colour1 = 0)then
begin
if(temp <= 2000000)then
begin
writeln('Colour 1: ' + inttostr(Colours[CurrentPlayer].colour1));
writeln('Colour 2: ' + inttostr(Colours[CurrentPlayer].colour2));
Players[Currentplayer].loc := 'Ready';
end;
end;
wait(random(1000));
end;
the InFightAt i refer to is this one by either dankness or fawki:
SCAR Code:
Function InFightAt(x, y: Integer):Boolean;
var
dx, dy: Integer;
begin
if ( FindColor(dx, dy, GreenStatusColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, RedStatusColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, MissedColor, x - 20, y - 10, x + 20, y + 10) or
FindColor(dx, dy, HitColor, x - 20, y - 10, x + 20, y + 10) ) then
Result:=True;
end;
with the help of writelns i have managed to debug the program down to this bit
SCAR Code:
if(not Colours[CurrentPlayer].colour1 = 0)then
begin
if(temp <= 2000000)then
begin
writeln('Colour 1: ' + inttostr(Colours[CurrentPlayer].colour1));
writeln('Colour 2: ' + inttostr(Colours[CurrentPlayer].colour2));
Players[Currentplayer].loc := 'Ready';
end;
end;
hopefully some of you wise scripting gods can help me.