SRL Archive - Research & Development Lounge

Not finding color?


k9thebeast

2014-01-08 16:45:06

Very simple script taken off a tutorial here but I cannot get it working and would appreciate any help.

program FindObjExample;
{.include SRL/SRL.simba}

function MineCopper: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;
if FindObjCustom(x, y, ['ine', 'ocks'], [1250324, 1250328], 5) then//Notice how I used "[]".
begin
Writeln('Found copper rock!');
Mouse(x, y, 0, 0, True);//MMouse and uptext check isn't needed becaue it's already built into FindObjCustom, understand?
Result := True;//Returns true of the copper ore was clicked.
end else
Writeln('Couldn''t find the copper rock.');
end;
//Notice that we didn't use MSCX or MSCY. This is because FindObjCustom automatically starts searching from the center. :)
begin
ClearDebug;
SetupSRL;
ActivateClient;
if MineCopper then
Writeln('Mined copper ore!')
else
Writeln('Didn''t mine copper ore.');
end.

I know it says copper, but I just havent changed it. I am trying to make it click on the black of the coal rock. The way I run it is I select a client (an rsps webpage) and then I press start. It returns to me that it couldnt mine/find copper.

Any Ideas?
Thanks
k9

rj

2014-01-08 16:50:25

Does it move the mouse?

The SRL include won't always work on RSPS's

k9thebeast

2014-01-08 17:35:31

Thanks for responding.

No mouse movement. Should I assume it wont work for this rsps? Perhaps it would on the downloaded client instead of thew web client? (ill check that out now)
Thanks
k9

k9thebeast

2014-01-08 18:07:02

However the mouse shouldnt move if the color is not found (which it isnt). Is it possible the color find function isnt working?

rj

2014-01-08 18:08:17

From: k9thebeast
However the mouse shouldnt move if the color is not found (which it isnt). Is it possible the color find function isnt working?

The problem lies here:

  if not LoggedIn then Exit;

It's exiting the function because it didn't detect that your logged in, because SRL-OSR is designed for Runescape 2007 and not a RSPS

k9thebeast

2014-01-08 18:12:20

From: Officer Barbrady
The problem lies here:

  if not LoggedIn then Exit;

It's exiting the function because it didn't detect that your logged in, because SRL-OSR is designed for Runescape 2007 and not a RSPS


Thanks! its still a really shitty script but at least it does something :)

Thanks Again!

rj

2014-01-08 18:15:03

From: k9thebeast
Thanks! its still a really shitty script but at least it does something :)

Thanks Again!


Is the uptext working?

k9thebeast

2014-01-08 18:20:27

Not yet, as of now it just puts the cursor on every black mark it sees and doesnt click. Little glitchy lol I'm playing around with it

rj

2014-01-08 18:28:24

From: k9thebeast
Not yet, as of now it just puts the cursor on every black mark it sees and doesnt click. Little glitchy lol I'm playing around with it


try this to grab the uptext

function _317_getuptext():string;
var
texttpas, textatpa:t2dpointarray;
texttpa:tpointarray;
textcolors, tols:tintegerarray;
i:integer;
begin
textcolors := [14211802, 14276876];
tols := [44, 40];
for i := 0 to high(textcolors) do
begin
setLength(texttpas, (length(texttpas) + 1));
findColorsTolerance(texttpas[i], textcolors[i], 8, 6, 325, 300, tols[i]);
end;
texttpa := mergeAtpa(texttpas);
// debugtpa(texttpa, 'bmp');
textatpa := splittpaex(texttpa, 1, 10);
filtertpasbetween(textatpa, 0, 4);
SortATPAFromFirstPointX(textatpa, Point(0, 0));

result := getTextATPA(textatpa, 5, 'upchars07');
end;

begin
writeln(_317_getUptext);
end.

ONly supports white & blue text have not added the rest yet

k9thebeast

2014-01-08 18:29:58

Yea did doesnt look like IsUpText is working

Edit: looking at your code thanks

k9thebeast

2014-01-08 18:38:06

program FindColorExample;
{.include SRL/SRL.simba}

function ClickTree: Boolean;
var
x, y : Integer;
begin
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 1645339, MSX1, MSY1, MSX2, MSY2, 10) then//Notice how the result will return true if it finds the color.
//*Note that you should pick a color from the tree that ISN'T too close to the grass color.
begin
Writeln('Found tree!');
MMouse(x, y, 4, 4);
Wait(1000 + Random(100));//Remember to wait before checking the uptext.
Writeln(getUptext);
//if IsUpText('ock') then//Remember to not include the capital letter of the tree name.

// Mouse(x, y, 0, 0, True);

end else
Writeln('Couldn''t find the color of the tree.');
end;

begin
ClearDebug;
SetupSRL;
ActivateClient;
Wait(1000 + Random(500));//Remember you should give it time to activate the RS client.
ClickTree
end.


function getuptext():string; //317
var
texttpas, textatpa:t2dpointarray;
texttpa:tpointarray;
textcolors, tols:tintegerarray;
i:integer;
begin
textcolors := [14211802, 14276876];
tols := [44, 40];
for i := 0 to high(textcolors) do
begin
setLength(texttpas, (length(texttpas) + 1));
findColorsTolerance(texttpas[i], textcolors[i], 8, 6, 325, 300, tols[i]);
end;
texttpa := mergeAtpa(texttpas);
// debugtpa(texttpa, 'bmp');
textatpa := splittpaex(texttpa, 1, 10);
filtertpasbetween(textatpa, 0, 4);
SortATPAFromFirstPointX(textatpa, Point(0, 0));

result := getTextATPA(textatpa, 5, 'upchars07');
end;

Unfortunately the function isnt returning anything. (printing an empty line)

rj

2014-01-08 21:18:28

@k9thebeast; can you link me to the server?

k9thebeast

2014-01-09 14:39:45

Pmed

rj

2014-01-09 16:14:55

From: k9thebeast
Pmed


function _317_getuptext():string;
var
texttpas, textatpa:t2dpointarray;
texttpa:tpointarray;
textcolors, tols:tintegerarray;
i:integer;
begin
textcolors := [14211802, 14276876];
tols := [44, 40];
for i := 0 to high(textcolors) do
begin
setLength(texttpas, (length(texttpas) + 1));
findColorsTolerance(texttpas[i], textcolors[i], 8, 6, 325, 300, tols[i]);
end;
texttpa := mergeAtpa(texttpas);

textatpa := splittpaex(texttpa, 1, 10);
filtertpasbetween(textatpa, 0, 4);
filtertpasbetween(textatpa, 55, 400);
SortATPAFromFirstPointX(textatpa, Point(0, 0));

result := getTextATPA(textatpa, 5, 'upchars07');
end;

begin
wait(700);
writeln(_317_getUptext);
end.

Make sure you drag the green target to the client. The uptext works fairly decent for me