SRL Archive - OSR Help

IsMoving


Littellj

2012-03-31 00:52:56

Need to make my script wait while choping tree. Trying to use IsMoving but it's constantly clicking the tree. Help? =o
Also, Trying to get it to put the angle to high still haven't been able to figure this out :(

I put the WaitRandomRange(5000,10000) to help see if working.



program ArticPines;
{$DEFINE SRL5}
{$DEFINE SMART}

{$i srl/srl.simba}


var
x, y, i: integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
BoxRewards := ['XP','xp','lamp'];
LampSkill := Skill_Woodcutting;
Active := True;
end;
end;


Function IsMoving_W: Boolean;
begin
Result := PixelShift(IntToBox(MMCX-30, MMCY-30, MMCX+30, MMCY+30), 200) > 10000;
end;

procedure Light;
var
SlotBox:TBox;
DropsPattern: TIntegerArray;
begin
DropsPattern:=[1,2];

For i:=0 to 1 Do
Begin
FindNormalRandoms;

SlotBox:=InvBox(DropsPattern[i]);
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);

Wait(50+Random(20));


End;
End;



function FindTree (Var X,Y: Integer) : boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
i : integer;

begin
result := False;

x := MSCx; //need to get color
y := MSCy;
FindColorsSpiralTolerance( x, y, MyTPA, 7371627, MSx1, MSy1, MSx2, MSy2, 10);
if (Length(MyTPA) < 1) then
Exit;

for i:=0 to High(MyTPA)do
begin
MyPoint:= MyTPA[i]
MMouse( MyPoint.x, MyPoint.y, 3, 3);
if WaitUpTextMulti(['hop','rctic'], 400) then
begin
Result := True;
GetMousePos( x, y);
Exit;
end;
end;
//use TPA's
//positions mouse
//check uptext
//GetMousePos( x, y);
end;




function FindTree2 (Var X,Y: Integer) : boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
i : integer;

begin
result := False;
//need to get color
x := MSCx;
y := MSCy;
FindColorsSpiralTolerance( x, y, MyTPA, 14147017, MSx1, MSy1, MSx2, MSy2, 10);
if (Length(MyTPA) < 1) then
Exit;

for i:=0 to High(MyTPA)do
begin
MyPoint:= MyTPA[i]
MMouse( MyPoint.x, MyPoint.y, 3, 3);
if WaitUpTextMulti(['hop','rctic'], 400) then
begin
Result := True;
GetMousePos( x, y);
Exit;
end;
end;
//use TPA's
//positions mouse
//check uptext
//GetMousePos( x, y);
end;


procedure chop;
begin
if not LoggedIn then
Exit;
//areacheck
FindNormalRandoms;

if InvFull then
//Light;

MakeCompass(0);
if (FindTree( x, y) or FindTree2( x, y)) then
begin
writeln('Found Tree');
ClickMouse2(True);

While IsMoving_W do
Wait(RandomRange( 5000, 10000));

Wait(RandomRange( 500, 1000));

//Alch

end;

end;

begin
Smart_Server := 86;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetUpSRL();
DeclarePlayers;
LoginPlayer;

LogInPlayer;
SetAngle(0);
MakeCompass(0);

repeat
if not LoggedIn then LoginPlayer;
//areacheck;

chop;

until(AllPlayersInactive)

Logout;
TerminateScript;

end.

mormonman

2012-03-31 01:15:03

IsMoving checks the minimap. You need to use Animating(B:TBox; Time, MinCount: Integer): Boolean;

Littellj

2012-03-31 01:21:53

lol wow, thanks. Yeah i changed to averagepixelshift.

Question, how the bloody heck due i get the angle high? :(

mormonman

2012-03-31 01:23:43

SetAngle(SRL_ANGLE_HIGH);

Raskolnikov

2012-03-31 01:24:53

There's this one function that someone made to do this. Here it is :)

{*******************************************************************************
procedure SetAngle(Highest : Boolean);
By: Raymond, edit by NaumanAkhlaQ
Description: Sets the mainscreen at highest\lowest angle (Depends on the boolean)
*******************************************************************************}
procedure SetAngles(Highest : Boolean);
begin
if (not LoggedIn) then exit;
KeyDown((Integer(not Highest) * 2) + 38);
Sleep(1000 + Random(300));
KeyUp((Integer(not Highest) * 2) + 38);
Wait(500 + Random(100));
end;

Littellj

2012-03-31 01:29:17

kk thanks, another.

I Changed my IsMoving_W into detecting pixel shift.


I have a while IsMoving_W do.

It will do what ever i tell it to do and still check the pixel shift of the char correct? And then when it returns false move on?

So if i wanted to add an alching procedure, it would only happen while moving?


Edit: Also, for some reason the Angle_High only works some times.

mormonman

2012-03-31 01:36:58

Yes, but I didn't know you could alch and woodcut at the same time :O

Littellj

2012-03-31 01:39:06

From: mormonman
Yes, but I didn't know you could alch and woodcut at the same time :O



Yes, :) I've got the script to work. At least cutting ;) not for the alching! Also where do you suggest adding my antiban? After IsMoving?

mormonman

2012-03-31 01:41:43

When do you want to perform antiban? Between alchs?

Littellj

2012-03-31 01:46:45

From: mormonman
When do you want to perform antiban? Between alchs?


Um, I'm thinking between trees. (aka stops moving)

also back to my question before, it will continually loop during the while moving part?

mormonman

2012-03-31 02:27:55

Yes it will. You will need another loop to handle clicking a new tree and doing antiban.

Littellj

2012-03-31 02:49:04

This is what i have below so far. OK
1) I've come into a rather annoying thing where it will continually keep clicking
the alch spell and then checking to see if existsitem(10) & 9, ( I put this in so that it wouln't over alch the logs.

If i was to put a If existsItem(#) during the while moving loop it would switch to the game tab after every alch. Which is slow and bot like if you ask me.

Basically my question is how would I make it wait till i have a descent amount of logs in invy, ~8, I was thinking something along the lines of. WaitUntillExistsItem(10) lol




Is this correct?
\/
if (FindTree( x, y) or FindTree2( x, y)) then
begin
writeln('Found Tree');
ClickMouse2(True);

While IsMoving_W and not(InvFull)do
begin
Wait(RandomRange(1000,1500));
Alch;

end;

Wait(RandomRange( 500, 1000));

{if InvFull then
Light;}

end;


program ArticPines;
{$DEFINE SRL5}
{$DEFINE SMART}

{$i srl/srl.simba}


var
x, y, i: integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
BoxRewards := ['XP','xp','lamp'];
LampSkill := Skill_Woodcutting;
Active := True;
end;
end;



Function IsMoving_W: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 600);
end;
procedure Light;
var
SlotBox:TBox;
DropsPattern: TIntegerArray;
begin
DropsPattern:=[1,2];

For i:=0 to 1 Do
Begin
FindNormalRandoms;

SlotBox:=InvBox(DropsPattern[i]);
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);
Wait(20+Random(20));

MoveMouse(X, Y+40);
ClickMouse(X, Y, mouse_Left);

Wait(50+Random(20));


End;
End;


////////////////////////////////////////////////////////////////////
/////////////{Modified from FLIGHTS Heavy Rodder!}//////////////////
////////////////////////////////////////////////////////////////////

Procedure ReadyAlch;
var
AlchBMP: Integer;
begin
AlchBMP := BitmapFromString(10, 6, 'meJwLuf2Kd8o6JkYmVl1+sVgVpk0' +
'y8sez4Uhi10WILLsQO4sHG1MOC1ABHAGl2OKaILJABDQBGQGlIAii' +
'AFOWtbwfiICyaAq+n0oEigMNZ/HJZjFwhyuA2wIAwl0jlg==');

if FindBitmapIn(AlchBMP, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(X, Y, 3, 3);
ClickMouse2(True);
end else if not FindBitmapIn(AlchBMP, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
GameTab(tab_Magic);
if FindBitmapIn(AlchBMP, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse( x, y, 5, 5);
ClickMouse2(True);
MMouseItem(22);
end;
end;
FreeBitmap(AlchBMP);

end;


Procedure Alch;
begin
ReadyAlch;

repeat

if InvFull then
exit;

if ExistsItem(10) and ExistsItem(9) then
begin
MMouseItem(22);
if WaitUpTextMulti(['Cast', 'ow L', 'evel', 'lchem'], 400) then
ClickMouse2(True);
end;

ReadyAlch;
until(not(IsMoving_W))

end;



function FindTree (Var X,Y: Integer) : boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
i : integer;

begin
result := False;

x := MSCx; //need to get color
y := MSCy;
FindColorsSpiralTolerance( x, y, MyTPA, 7371627, MSx1, MSy1, MSx2, MSy2, 10);
if (Length(MyTPA) < 1) then
Exit;

for i:=0 to High(MyTPA)do
begin
MyPoint:= MyTPA[i]
MMouse( MyPoint.x, MyPoint.y, 3, 3);
if WaitUpTextMulti(['hop','rctic'], 400) then
begin
Result := True;
GetMousePos( x, y);
Exit;
end;
end;
//use TPA's
//positions mouse
//check uptext
//GetMousePos( x, y);
end;




function FindTree2 (Var X,Y: Integer) : boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
i : integer;

begin
result := False;
//need to get color
x := MSCx;
y := MSCy;
FindColorsSpiralTolerance( x, y, MyTPA, 14147017, MSx1, MSy1, MSx2, MSy2, 10);
if (Length(MyTPA) < 1) then
Exit;

for i:=0 to High(MyTPA)do
begin
MyPoint:= MyTPA[i]
MMouse( MyPoint.x, MyPoint.y, 3, 3);
if WaitUpTextMulti(['hop','rctic'], 400) then
begin
Result := True;
GetMousePos( x, y);
Exit;
end;
end;
//use TPA's
//positions mouse
//check uptext
//GetMousePos( x, y);
end;


procedure chop;
begin
if not LoggedIn then
Exit;
//areacheck
FindNormalRandoms;

if InvFull then
//Light;

SetAngle(0);
MakeCompass(0);
if (FindTree( x, y) or FindTree2( x, y)) then
begin
writeln('Found Tree');
ClickMouse2(True);

While IsMoving_W do
begin
Wait(RandomRange(1000,1500));
Alch;

end;

Wait(RandomRange( 500, 1000));

{if InvFull then
Light;}

end;

end;

begin
Smart_Server := 86;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetUpSRL();
DeclarePlayers;
LoginPlayer;

LogInPlayer;
SetAngle(0);
MakeCompass(0);

repeat
if not LoggedIn then LoginPlayer;
//areacheck;

chop;

until(AllPlayersInactive)

Logout;
TerminateScript;

end.