SRL Archive - OSR Help

RC Script


VillaVuFTW

2012-01-28 11:36:16

I'm making an Astral Script, and it can't find the Altar..

I'm using Mat's OBJFinder by Color Tolerance.. :O

It keeps not being able to find it.. is there a way I can add multiple color choices?

Nebula

2012-01-28 17:48:45

FindObjCustom(); should work. It allows you to find objects using multiple colors and multiple uptexts.

Or if you know how to use it, FindObjTPA();

Jhangir

2012-01-30 17:06:48

Just use find obj ex works great

Kasi

2012-01-30 17:22:36

Use ACA? cant be that hard to get a color

NexPB

2012-01-30 17:29:38

Color I used for astral altar: 8551552 tolerance:15

PatDuffy

2012-01-30 17:37:15

For runecrafting altars I've found it good to use a DTM, might want to use FindDTMRotated.

putonajonny

2012-01-30 17:40:17

is it not finding that colour at all, or just finding so much of that colour it doesn't know which is the alter?

Nebula

2012-01-30 18:04:40

Put this before your finder function so that it searches from the center out. That should speed it up if speed is the issue.

x := MSCX
y := MSCY

Nataurs

2012-01-30 21:17:23

Been using this code for my upcoming astral script


function AltarColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.25);

if not (FindColorsTolerance(arP, 8818061, MSX1, MSY1, MSX2, MSY2, 2)) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
Break;
end;

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

Function FindObjEx_F(ColorA, ColorB, Tol, Bounds, sX, sY: Integer; UpText: TStringArray; Var X, Y: Integer): Boolean;
var
B: TBox;
TPA: TPointArray;
L,i,CTS: Integer;
ATPA,ATPA2: T2DPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(sX, sY, TPA, ColorA, MSX1, MSY1, MSX2, MSY2, Tol);
if Length(TPA) < 1 then
begin
ColorToleranceSpeed(CTS);
Exit;
end;
ATPA := TPAtoATPAEx(TPA, Bounds, Bounds);
L := High(ATPA);
SetArrayLength(ATPA2, L+1);
for i := 0 to L do
begin
B := GetTPABounds(ATPA[i]);
with B do
begin
FindColorsSpiralTolerance(sX, sY, ATPA2[i], ColorB, B.X1-Bounds, B.Y1-Bounds, B.X2+Bounds, B.Y2+Bounds, Tol);
ColorToleranceSpeed(CTS);
if Length(ATPA2[i]) > 0 then
begin
MiddleTPAEx(ATPA2[i], X, Y);
MMouse(X, Y, 5, 5);
if WaitUpTextMulti(UpText, 150) then
begin
Result := True;
GetMousePos(X, Y);
Exit;
end;
end;
end;
end;
end;

function FindAltar: Boolean;
var
x, y, i: Integer;
label
Start;
begin
Gametab(tab_Inv);

Start:
if FindObjEx_F(6514535, 10133921, 15, 10, MSCX+50, MSCY, ['Craft','rune','Altar'], X, Y) then
begin
HumanMMouse(x, y, 10, 10);
ClickMouse2(true);
Wait(RandomRange(600, 800));
Result := true;
if did not DidRedClick then
goto Start;
end else if FindObjTPA(x, y, AltarColor, 15, 2, 105, 105, 3, ['raft', 'Craft']) then
begin
HumanMMouse(x, y, 10, 10);
ClickMouse2(true);
Wait(RandomRange(600, 800));
Result := true;
if did not DidRedClick then
goto Start;
end else
begin
Inc(i);
if i > 3 then
begin
Writeln('Failed to find altar');
Exit;
end else
goto Start;
end;
end;

Mat

2012-01-31 08:36:52

If your using my altar finding then it was very bad :P ACA with a FindObjTPA.
DTM's would be quite good as Pat said.
Mat

Nataurs

2012-01-31 09:11:22

Oh that was from you :). I found a post where flight quoted part of that code. Just wondering why you think its bad, ive been using it past few days and it pretty much finds the altar every time in one click