Log in

View Full Version : Using co-ordinates to find colours?



loser69
01-13-2012, 06:05 AM
I remember in one of YoHoJo's tutorial vids with the goldfish he talks about using a findcolorspiraltolerance and in the variables of this you can create an invisible box so that the script only finds the colours in this box.

can this be used for runescape scripts too as I move the SMART client a lot so would moving the client affect the co-ordinates?

I know I can use MSX1, MSY1 , MSX2,MSY2 but these make it look for colours in quite a big area and causes the mouse to move like a spastic, I want it to search for colours in a small enclosed area if you know what I mean.


Also would it be possible to just use co-ordinates to click on static locations such as bank chests?

YoHoJo
01-13-2012, 06:08 AM
if you sure you're not moving and chest is always there then yes you can just use Mouse(547,547, 5, 5, True) (EXAMPLE CODE).

Watch my auto color aid tutorial too, that will help find the chest EXACTLY and not mess up.

Hmm why does your mouse move spazzy? Can you show us code?

Also yea MSX1, MSY1, MSX2, MSY2 (that is the order you should have them) can be changed to any numbers, you can use the color picker to find coordinates and make a smaller search box.

loser69
01-13-2012, 08:50 AM
Yea it helped a little but If I use findcolorspiraltolerance then my if isuptext doesn't work

Normally I was using findobj also here is the script currently I am just testing it.
It is also really long as I repeatedly used the autocolouraid.


program agility;

{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i SRL\SRL\Misc\Debug.SCAR}
{$i SRL\SRL\Misc\Stats.simba}



Const
SRLStats_Username = '';// Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
BreakEvery = 120; //How Many Minutes To Break After
BreakFor = 10; //How Long To Break For
Version = '69';




Var
runlog, x, y, StartTime: Integer;




procedure DeclarePlayers;
Var i:integer;
Begin
NumberOfPlayers(1);
CurrentPlayer := 0;
For I := 0 to (1-1) Do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

With Players[0] Do
Begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
Strings[0] :='stun'; //Name of spellto cast.(See list of spells above)
End; //Set to 'Range' if ranging!

End;

Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;

Procedure Antiban;
Begin
Case Random(250) Of
0: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('Magic', False) GameTab(28) End;
1: Begin StatsGuise('AntiBan') SleepAndMoveMouse(7000 + Random(500)); End;
2: Begin StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv; GameTab(28); End;
3: Begin StatsGuise('AntiBan') RandomAngle(1); End;
4: Begin StatsGuise('AntiBan') GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(28); End;
5: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); End;
End;
End;
Procedure FailSafe(Reason:String);
Begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
TerminateScript;
End;

function logcolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.41);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 932196, MSX1, MSY1, MSX2, MSY2, 3);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 5.12) and (X <= 8.69) and (Y >= 4.31) and (Y <= 7.28) and (Z >= 0.89) and (Z <= 1.46) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

procedure crosslog;

begin

SetAngle(true)
if FindObj( x, y, 'alance', logcolor ,2) then
writeln ('found log');
begin
if IsUpText('alance') then
begin
mouse( x, y, 5, 5, true);
wait(6000)

end;
end;

end;

function obstaclenetcolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.18, 12.34);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1982047, MSX1, MSY1, MSX2, MSY2, 2);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 5.02) and (X <= 7.71) and (Y >= 4.85) and (Y <= 6.45) and (Z >= 1.23) and (Z <= 3.54) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure climbnet;

begin

if FindObj( x, y, 'bstacle', obstaclenetcolor ,2) then
writeln ('found net');
begin
if IsUpText('bstacle') then
begin
mouse( x, y, 5, 5, true);
wait(3000)
end;
end;
end;


function branchcolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.47);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2117223, MSX1, MSY1, MSX2, MSY2, 2);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 7.59) and (X <= 9.69) and (Y >= 7.51) and (Y <= 9.57) and (Z >= 2.26) and (Z <= 2.79) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure climbbranch;

begin
SetAngle(true);
if FindObj( x, y, 'ranch', branchcolor ,3) then
writeln ('found branch');
begin
if IsUpText('ranch') then
begin
mouse( x, y, 1, 1, true); wait(6000)
wait(2000)
end;
end;
end;

function ropecolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 0.11);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 5667995, MSX1, MSY1, MSX2, MSY2, 3);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 19.39) and (X <= 25.38) and (Y >= 19.09) and (Y <= 24.92) and (Z >= 10.43) and (Z <= 13.61) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;



procedure walkrope;

begin

SetAngle(true);
wait(2000);
if findcolorSpiralTolerance(x,y,ropecolor,429,173,490 ,187,3) then
writeln('found rope');
Mouse(x,y, 1, 1, True);
wait(7500);

end;

function treecolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 0.22);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1853020, MSX1, MSY1, MSX2, MSY2, 3);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 5.41) and (X <= 8.47) and (Y >= 5.40) and (Y <= 8.39) and (Z >= 1.66) and (Z <= 2.49) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure downtree;

begin

if findcolorSpiralTolerance(x,y,treecolor,361,186,394 ,215,3) then
writeln('found tree');
Mouse(x,y, 3, 3, True);
wait(4000)

end;

function obstaclenetcolor2: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.18, 12.34);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1982047, MSX1, MSY1, MSX2, MSY2, 2);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 5.02) and (X <= 7.71) and (Y >= 4.85) and (Y <= 6.45) and (Z >= 1.23) and (Z <= 3.54) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

procedure climbobstaclenet;

begin

MakeCompass(266 + random(4));
wait(3000);
if findcolorSpiralTolerance(x,y,obstaclenetcolor2,MSX 1, MSY1, MSX2, MSY2,5) then
writeln('found obstacle net');
Mouse(x,y, 3, 3, True);
wait(4000);
end;
function pipecolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.13);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 9803164, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(arP) = 0) 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
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 23.62) and (X <= 36.79) and (Y >= 24.33) and (Y <= 37.91) and (Z >= 25.98) and (Z <= 40.51) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

procedure squeezepipe;

begin


if FindObj( x, y, 'through', pipecolor ,2) then
writeln ('found pipe');
begin
if IsUpText('through') then
begin
mouse( x, y, 5, 5, true);
wait(5000)

end;
end;
end;

procedure ClickNor;
begin
if InRange(Round(rs_GetCompassAngleDegrees), 5, 355) then
if Random(4) = 1 then
begin
Mouse(542, 24, 15, 15, true);
WaitOptionMulti(['ace', 'orth'], 1200);
end else
Mouse(542, 24, 15, 15, True);

end;


procedure runtolog;
begin

wait(2500)


runlog:= DTMFromString('mQwAAAHicY2ZgYGBhgABOBlTgYiHBkJOswh AdIs/ADOTDMCMSBgIAU/kCcg==');

If FindDTM(runlog, X, Y, MSX1, MSY1, MIX2, MIY2) then
begin

mouse( x, y, 3, 3, true);

FreeDTM(runlog);
wait(8000);
end;
end;






begin

Smart_Server := 83;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;

SetUpSRL;
DeclarePlayers;
LogInPlayer;
StartTime:=GetSystemTime;

//crosslog

//climbnet

//climbbranch

//walkrope

//downtree

climbobstaclenet

//squeezepipe

//ClickNor

runtolog





end.