SRL Archive - OSR Help

Help with 2 Things


Google

2012-04-29 15:09:08

Alright so I've been using findobjcus w/ ACA for a while becasue its been so simple and I can just throw scripts together but I gave ATPA a go here is my issue > It will Find the Altar perfectly Fine > Right click wont choose the option altar and will immediately move outside to the left side of the screen then repeat > finding altar > rightclicking bla bla.
Function Altar: Boolean;
Var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.39, 0.20);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, AltarColor, MSX1, MSY1, MSX2, MSY2, 18); // Used ACA 'AltarColor'
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) Do
Begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(X, Y, 2, 2);
If (IsUpTextMultiCustom(['Altar'])) Then
begin
ClickMouse2(False);
Wait(100 + Random(50));
ChooseOption('Altar');
end;
result:=true;
break;
end;
end;
end;


Second one is simple the Until(invFull); must be written wrong because on a full inventory it will still keep trying to pick up items. Whats the correct way to write it?

Procedure PickupSticks;
Begin
Gametab(Tab_Inv)
If (FindObjCustom(X, Y, ['The names here'], [COL], 5)) Then // ignore this line
Begin
Writeln('Found Da Sticks');
Wait(700+random(50));
ClickMouse2(False);
Wait(200 + Random(150));
ChooseOption('Take')
Wait(500 + Random(150));
MMouse(292,180,2,2);
Wait(44000 + Random(1000));
End Else Writeln('Cant Find The Stick');
Repeat
PickupSticks;
Until(invFull); // < Here is the issue
Teleport;
End;

Rich

2012-04-29 15:58:01

For the first point, try using 'ltar' without the A.

As for the second question, what I see is that it'll never actually reach that part of the code which checks if the inventory is full because of the way you've written it. Just rearrange it a bit to make
procedure PickupSticks;
begin
repeat
GameTab(tab_Inv)
if (FindObjCustom(X, Y, ['The names here'], [COL], 5)) then // ignore this line
begin
Writeln('Found Da Sticks');
Wait(700+random(50));
ClickMouse2(False);
Wait(200 + Random(150));
ChooseOption('Take')
Wait(500 + Random(150));
MMouse(292,180,2,2);
Wait(44000 + Random(1000));
end else
WriteLn('Cant Find The Stick');
until(InvFull)
Teleport;
end;
and it should work fine.

Google

2012-04-29 16:09:37

Tried changing the uptext to 'ltar' didnt seem to work

Rich

2012-04-29 16:15:04

Try increasing the wait, or using WaitOption instead. Also, there are few failsafes in that procedure. You return it true even though it may not choose the option, which is what's happening, so add a few else statements in there as well :)

Google

2012-04-29 16:30:00

Function Altar: Boolean;
Var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.39, 0.20);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, AltarColor, MSX1, MSY1, MSX2, MSY2, 18); // Used ACA 'AltarColor'
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 20, 20);

For I := 0 to High(ATPA) Do
Begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(X, Y, 2, 2);
Wait(1000 + Random(600));
If (IsUpTextMultiCustom(['ltar','Altar','tar','ar'])) Then
Begin
Wait(1000 + Random(800));
ClickMouse2(False);
Wait(700 + Random(50));
ChooseOption('Altar');
End;
Break;
End;
End;

Changed the code to add longer waits, it will find the color and sit there find a new color move to it and sit there won't right click the object and enter. Ideas?

Rich

2012-04-29 16:39:36

Try running this. I've added some debugging WriteLns so we can see what it's actually doing.

Function Altar: Boolean;
Var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.39, 0.20);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, AltarColor, MSX1, MSY1, MSX2, MSY2, 18); // Used ACA 'AltarColor'
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 20, 20);

For I := 0 to High(ATPA) Do
Begin
WriteLn('Starting FOR TO DO loop');
WriteLn(GetArrayLength(ATPA));
MiddleTPAEx(ATPA[i], x, y);
MMouse(X, Y, 2, 2);
Wait(1000 + Random(600));
If (IsUpTextMultiCustom(['ltar','Altar','tar','ar'])) Then
Begin
WriteLn('Found uptext');
Wait(1000 + Random(800));
ClickMouse2(False);
Wait(700 + Random(50));
if ChooseOption('Altar') then
WriteLn('Chose option');
End;
Break;
End;
End;

Google

2012-04-29 17:01:09

Figured out the issue it was the uptext being 'mysterious ' instead of altar, fail on my part.