Log in

View Full Version : colour switching finding function :p help appreciated



Sockz
02-21-2012, 09:15 AM
Hello :D

I'm trying to do a little bit of coding that will search for a colour, if unable to detect the colour will try searching for a new colour and use that as the colour to be searched from then on.

Basically I need this because the colours will change slightly between users / logouts and what not. My problem is objectTPAs don't seem to stop searching until it finds the colour, I tried objcustom function and it still took to long to find the colour. What i need is if it can't find the colour straight away, as in not move the cursor all around the screen, then begin looking for a new colour. If anyone has any ideas they think may help post please! Thanks guys for reading. :D code is below

Procedure NewColourPatch;

var
i: Integer;

begin

case i of
0:
begin
PatchColour:= 5664128
i:= i + 1
writeln('1')
end;
1:
begin
PatchColour:= 4700000
i:= i + 1
writeln('2');
end;
2:
begin
PatchColour:= 4939375
i:= 0
writeln('3');
end;
end;
end;

Procedure WalkPatch;

var
x, y: Integer;
walked: boolean;


begin
repeat
Path:= Patch
Walk;
repeat
Wait(100);
until(IsMoving = false);
x:=MSCx
y:=MSCy
if FindObjTPA(x, y, PatchColour, 5, 1, 10, 10, 5, ['arming patch']) then
begin
mouse(x, y, 5, 5, 0);
if WaitOption('alk here', 300) then
walked:= true
end else
begin
walked:= false
NewColourPatch;
end;
until(walked = true)
end;

YoHoJo
02-21-2012, 09:19 AM
I think you're over complicating it, nice idea though you're brain is cooking!
Just do

If Not FindObjTPA(x, y, PatchColour1, 5, 1, 10, 10, 5, ['arming patch']) then
If Not FindObjTPA(x, y, PatchColour2, 5, 1, 10, 10, 5, ['arming patch']) then
If Not FindObjTPA(x, y, PatchColour3, 5, 1, 10, 10, 5, ['arming patch']) then
Begin
Writeln('All of our path colors suck!');
Logout;
End;

Something similar to that will take care of it!

Sockz
02-21-2012, 09:24 AM
I think you're over complicating it, nice idea though you're brain is cooking!
Just do

If Not FindObjTPA(x, y, PatchColour1, 5, 1, 10, 10, 5, ['arming patch']) then
If Not FindObjTPA(x, y, PatchColour2, 5, 1, 10, 10, 5, ['arming patch']) then
If Not FindObjTPA(x, y, PatchColour3, 5, 1, 10, 10, 5, ['arming patch']) then
Begin
Writeln('All of our path colors suck!');
Logout;
End;

Something similar to that will take care of it!

thats only a LITTLE bit simpler than mine :P

haha kidding but its gonna have to end up like searching through 10 different colours or something and with tpas to get to, if its the last colour, will spam the mouse all around the screen. So I think i need something that will search like really quickly, if unable to find try a new colour until it finds one and sets it as default. Because it will be doing the search all over again in like 30 secs it needs to be pretty accurate, so any ideas on this? thanks for reply :D

Jagex_Fagex
02-21-2012, 09:26 AM
Check out Smartcolor, it's in the srl include and could be just what you're looking for?

YoHoJo
02-21-2012, 09:26 AM
Learn to use ACA and you will only need one color :D.
http://youtu.be/98wVrr6GwyU
^ Video tutorial I made about it.

Good luck.

Jagex_Fagex
02-21-2012, 09:33 AM
http://villavu.com/forum/showthread.php?t=52915

^^smartcolors

I'm going to have to look at ACA, but smartcolors seems like an interesting idea.

Sockz
02-21-2012, 09:44 AM
Thankyou for that link, I was looking at the include and didn't have any idea how it worked.

I'll try work this out, thanks guys for the help, much appreciated!

and I don't think I can use ACA because the colour of the actual object changes
btw thanks for the utube tuts, they helped me out so much :D

YoHoJo
02-21-2012, 09:57 AM
How much does the color change?
Like A LOT like from red to green to blue?!

Sockz
02-21-2012, 10:01 AM
just different shades of brown

YoHoJo
02-21-2012, 10:02 AM
Well then... that's EXACTLY what ACA is for!
Try it! Pick all the shades of brown, and test how accurate it finds them (and hopefully not other unrelated things).

Sockz
02-21-2012, 10:18 AM
okay, i wil ltry out both suggestions :P