SRL Archive - OSR Help

Need TPA help


Itankbots

2012-11-05 14:53:30

Im trying to make a script that buys Beer from the bartender in yanille. It Finds the bartender perfect the first time, But halfway through the dialogue to buy the beer the mouse spazes out and starts examining random things and never finds him again to buy another beer :c Any help would be much appreciated :)

Thank you guys :)

J J

2012-11-05 15:44:42

I would make one function that handles the identifying of the beertender and the clicking all in one. He could move which could result in misclicking.

function FindBartender: boolean;
var
i : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
Box : TBox;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.10);

if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2365496, MSX1, MSY1, MSX2, MSY2, 3) then
begin
ATPA := TPAtoATPAEx(TPA, 15, 15);
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[i]);
Box := IntToBox((MP.X - 20), (MP.Y - 20), (MP.X + 20), (MP.Y + 20));
MMouse(MP.X, MP.Y, 4, 4);
if(WaitUptext('artender', 750))then
begin
ClickMouse2(0);
if WaitOption('alk-to', 500) then
begin
Result := True;
Break;
end;
end;
end;
end;
end;

procedure buybeer;
var
Attempts: Integer;

begin
while not(InvFull) do
begin
if FindBartender then
begin
TypeSendEx(' ', false);
Wait(RandomRange(300, 600));
TypeSendEx(' ', false);
Wait(RandomRange(300, 600));
TypeSendEx(' ', false);
Wait(RandomRange(300, 600));
TypeSendEx(' ', false);
Wait(RandomRange(300, 600));
TypeSendEx(' ', false);
Wait(RandomRange(300, 600));
TypeSendEx(' ', false);
Wait(RandomRange(300, 600));
end else
Inc(Attempts);
if Attempts > 5 then
break;
end;
end;

Rezozo

2012-11-05 16:35:11

For TPA's try Footy?

Footy

2012-11-05 16:36:19

If he is finding the bartender flawlessly, then that doesn't appear to be the problem. The problem is the chat. Check out the include, I believe we have some pretty nifty functions that are chat related.

Itankbots

2012-11-06 16:45:46

Thanks guys helped alot :)