SRL Archive - OSR Help

Picking bananas in Karamja!Must get help


Mor

2012-04-06 17:02:00

What is wrong in my script?I have tried to put the "repeat-until" in other places in the code but still it doesnt work.
The color I picked is the color of the leaves,and there is no other object with the same color.
The mouse always return to the inventory tab.

procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
MyPoint : TPoint;
I : Integer;

begin
FindColorsTolerance( TPA, 6336583, MSX1, MSY1, MSX2, MSY2, 17);
begin
for i:=0 to high(TPA) do
repeat
MyPoint :=TPA[i];
MMouse(MyPoint.x,MyPoint.y,1,1);
if IsUpText('ick') then
begin
wait(700);
Mouse(x,y,1,1,true);
wait(900);
end;
until (InvFull);
end;
end;





begin
//{$IFDEF SMART}
// Smart_Server := 0;
// Smart_Members := True;
// Smart_Signed := True;
// Smart_SuperDetail := False;
//{$ENDIF}
SetUpSRL();
ActivateClient();
DeclarePlayers();
LoginPlayer();
PickBanana;
end.

PatDuffy

2012-04-06 17:23:49

Well just looking at the code, I have a few small suggestions

procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
MyPoint : TPoint;
I : Integer;

begin
if FindColorsSpiralTolerance(MSCX,MSCY,TPA, 6336583, MSX1, MSY1, MSX2, MSY2, 17) then
begin
for i:=0 to high(TPA) do
repeat
MyPoint :=TPA[i];
MMouse(MyPoint.x,MyPoint.y,1,1);
if IsUpText('ick') then
begin
wait(700);
Mouse(x,y,1,1,true);
wait(900);
end;
until (InvFull);
end;
end;

FindColorsSpiralTolerance is better because it will search from the center of the screen outwards in a spiral, which results in sorting trees by distance from player. You were also using it as a procedure, and it's a function :p

That might not compile what I put, if it doesn't then I messed up a parameter for FindColorsSpiralTolerance :p

Mor

2012-04-06 17:32:11

From: PatDuffy
Well just looking at the code, I have a few small suggestions

procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
MyPoint : TPoint;
I : Integer;

begin
if FindColorsSpiralTolerance(MSCX,MSCY,TPA, 6336583, MSX1, MSY1, MSX2, MSY2, 17) then
begin
for i:=0 to high(TPA) do
repeat
MyPoint :=TPA[i];
MMouse(MyPoint.x,MyPoint.y,1,1);
if IsUpText('ick') then
begin
wait(700);
Mouse(x,y,1,1,true);
wait(900);
end;
until (InvFull);
end;
end;

FindColorsSpiralTolerance is better because it will search from the center of the screen outwards in a spiral, which results in sorting trees by distance from player. You were also using it as a procedure, and it's a function :p

That might not compile what I put, if it doesn't then I messed up a parameter for FindColorsSpiralTolerance :p


You didn't mess parameters,but it still doesn't find the bananas.
The mouse point always return to the inv tab after quick search.

PatDuffy

2012-04-06 17:32:57

Is it finding bananas at all?

Mor

2012-04-06 17:34:50

From: PatDuffy
Is it finding bananas at all?

No.

PatDuffy

2012-04-06 17:36:42

Is the mouse moving at all? Such as moving over banana trees?

Mor

2012-04-06 17:39:01

From: PatDuffy
Is the mouse moving at all? Such as moving over banana trees?


Yes. it makes quick search on the trees and return to inventory tab.

PatDuffy

2012-04-06 17:41:59

So it is going over the correct trees then? That means that your uptext check isn't working correctly. You might want to try WaitUpTextMulti like this:


if WaitUpTextMulti([various text here],300) then

That will wait 300ms at each point looking for a TStringArray 'Uptext' so it gives more variety and stability in case it can't find a certain uptext.

Mor

2012-04-06 17:57:49

From: PatDuffy
So it is going over the correct trees then? That means that your uptext check isn't working correctly. You might want to try WaitUpTextMulti like this:


if WaitUpTextMulti([various text here],300) then

That will wait 300ms at each point looking for a TStringArray 'Uptext' so it gives more variety and stability in case it can't find a certain uptext.


Still it does the same response but slower

procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
MyPoint : TPoint;
I : Integer;

begin
if FindColorsSpiralTolerance(MSCX,MSCY,TPA, 1435889, MSX1, MSY1, MSX2, MSY2, 40) then
begin
for i:=0 to high(TPA) do
repeat
MyPoint :=TPA[i];
MMouse(MyPoint.x,MyPoint.y,1,1);
wait(1000);
if WaitUpTextMulti(['ick','nana'],500) then
begin
Mouse(x,y,1,1,true);
wait(600);
end;
until (InvFull);
end;
end;

nickrules

2012-04-06 20:16:23

Try more uptext combinations (['Ban','ick','nana','nan','Pick'], etc). If it's mousing over them but not clicking, then it's resulting false at the uptext check. Another route would be right clicking right away, then using chooseoption.

Also,
          MyPoint :=TPA[i];
isn't entirely needed. You could just use the point from the TPA, rather than assigning it to a second TPoint.
MMouse(TPA[i].x,TPA[i].y,1,1)

Runescape Pro

2012-04-06 20:21:46

Make sure your graphic settings are safe mode(hold s while rs is loading) abd max brightness, everything else off(except max cpu).

BobboHobbo

2012-04-06 22:00:14

Why pick the colour of the leaves? pick the colour of the Banana use ACA to find the best colour.

Mor

2012-04-07 06:06:03

Thank you friends.
Finally, after a lot of help in the srl chat channel and here,it picks one banana,
But doesn't make the loop.After it picks one banana the mouse return to the inventory tab.
Maybe the InvFull function doesn't work anymore?Because I tried to do do the loop with "until(not(loggedin));"
and it picks bananas, but with "until(InvFull);" it picks only one banana.
Look here please:

procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
I : Integer;

begin
if not FindColorsSpiralTolerance(MSCX,MSCY,TPA, 1503736, MSX1, MSY1, MSX2, MSY2, 17) then
Exit;
for I := 0 to High(TPA) do
begin
x := TPA[I].x;
y := TPA[I].y;
MMouse(x, y, 3, 3);
if IsUpText('ick') then
begin
Wait(100 + Random(150));
GetMousePos(x, y);
Mouse(x, y, 1, 1, True);
Wait(500 + Random(250));
Break;
end;
end;
end;


procedure MainLoop;
begin
WalkToPort;
TalkWithNPC;
GoToBananas;
[B] repeat
if(not(loggedin)) then
Exit;
PickBanana;
until(InvFull);[/B]
end;




begin
//{$IFDEF SMART}
// Smart_Server := 0;
// Smart_Members := True;
// Smart_Signed := True;
// Smart_SuperDetail := False;
//{$ENDIF}
SetUpSRL();
ActivateClient();
DeclarePlayers();
LoginPlayer();
repeat
Wait(1000)
until(RsReady());
MainLoop;

end.