rj
2013-07-25 17:22:51
Problem solved! The RSPS was in OpenGL mode instead of safemode (never heard of a RSPS with OpenGL support..) so Simba couldn't get the colors!
2013-07-25 17:22:51
2013-07-25 17:32:04
2013-07-25 17:35:30
From: Sjoe
where's your mmouse, I guess you wanna clicK?
function findCrab():Boolean;
var
TPA:TPointArray;
ATPA:T2DPointArray;
i, x, y:Integer;
Bounds:TBox;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.10);
FindColorsSpiralTolerance(256, 166, TPA, 3820363, 3, 3, 514, 339, 8);
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.02, 0.02);
if (Length(TPA) > 0) then
begin
ATPA := TPAToATPAEx(TPA, 40, 40);
filterTPAsBetween(ATPA, 1, 50);
SortATPAFromFirstpoint(ATPA, Point(256, 166));
DebugATPABounds(ATPA);
for i := 0 to high(ATPA) do
begin
Bounds := GetTPABounds(ATPA[i]);
MiddleTPAEx(ATPA[i], x, y);
if not hpExists(Bounds, 0, 6) then
begin
result := true;
mmouse(x, y, 0, 0);
ClickMouse2(Mouse_left);
//updatestate('Attacking rock crab');
wait(1500);
while (isMoving) do
wait(200);
exit;
end;
end;
end;
end; 2013-07-25 17:38:34
2013-07-25 17:41:01
From: Vinyl Scratch
You have ACA looking at 250 tolerance. But your tolerance in the function isn't 250.
Try that, and tell us what happens.
FindColorsSpiralTolerance(256, 166, TPA, 3820363, 3, 3, 514, 339, 8);
2013-07-25 18:01:32
2013-07-25 18:08:34
From: BMWxi
Add WriteLn everywhere to make sure it's doing what you want.
2013-07-25 18:10:35
program autocrabs;
{$I SRL/SRL.Simba}
{$i SRL/srl/misc/debug.simba}
procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);
for i := 0 to h do
begin
l := length(atpa[i]);
if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1);
c[high(c)] := atpa[i];
end;
end;
atpa := c;
end;
function getHp():Integer;
begin
end;
Procedure report;
begin
end;
function hpExists(bounds:TBox; offx, offy:Integer):Boolean;
var
TPA:TPointArray;
ATPA:T2DPointArray;
begin
//if (not t_loggedin) then exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.68, 0.00);
FindColorsSpiralTolerance(256, 86, TPA, 47445, Bounds.X1-offx, Bounds.Y1-offy, Bounds.X2, Bounds.Y2, 8);
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.02, 0.02);
if (Length(TPA)>0) then
begin
result := true;
end;
end;
function findCrab():Boolean;
var
TPA:TPointArray;
ATPA:T2DPointArray;
i, x, y:Integer;
Bounds:TBox;
begin
ColorToleranceSpeed(2);
writeln('1');
SetColorSpeed2Modifiers(0.00, 0.10);
writeln('2');
FindColorsSpiralTolerance(256, 166, TPA, 3820363, 3, 3, 514, 339, 8);
writeln('3');
ColorToleranceSpeed(1);
writeln('4');
SetColorSpeed2Modifiers(0.02, 0.02);
writeln('5');
if (Length(TPA) > 0) then
begin
writeln('found a tpa');
ATPA := TPAToATPAEx(TPA, 40, 40);
filterTPAsBetween(ATPA, 1, 50);
SortATPAFromFirstpoint(ATPA, Point(256, 166));
DebugATPABounds(ATPA);
for i := 0 to high(ATPA) do
begin
Bounds := GetTPABounds(ATPA[i]);
MiddleTPAEx(ATPA[i], x, y);
if not hpExists(Bounds, 0, 6) then
begin
result := true;
mmouse(x, y, 0, 0);
ClickMouse2(Mouse_left);
//updatestate('Attacking rock crab');
wait(1500);
while (isMoving) do
wait(200);
exit;
end;
end;
end;
end;
begin
activateclient;
wait(800);
if findcrab then
writeln('found crab');
end.2013-07-25 18:42:10
2013-07-25 19:03:17
From: Vinyl Scratch
FindColorsSpiralTolerance is a boolean, put it in if..then statements.
2013-07-25 22:05:30
From: Officer Barbrady
Doesn't have to be in if then because I check for the TPA length anyway
2013-07-25 22:23:37
2013-07-26 00:28:23
From: Kasi
The problem is your mixing up includes again. your probably using regular runescape functions on soulsplit or something.
Edit : i think it's because it's loosing focus so there is no image buffer being passed to simba if that makes sense.
Edit2 : to test this, just debug the current client image right before it hits if (Length(TPA) > 0) then… if the client it blank or doesnt = the actual window then it's loosing focus.