SRL Archive - OSR Help

New to scripting: Angle issues


tvjj

2012-04-07 01:34:04

hey every one im following yohojos scripting tut's there have been a few problems so far but have mostly figured them out, i just came across a new one though, im trying to make my first powercutter, and im trying to set the angle but the way yohojo says to do it with

SetAngle(False)
this is supposed to make it set the angle as low as possible, although it does not, i tried tinkering with:

procedure SetAngle(ANGLE: Integer);
begin
if ((Angle = SRL_ANGLE_NONE) or (not LoggedIn)) then
Exit;

KeyDown((Angle * 2) + 38);
Sleep(1000 + Random(300));
KeyUp((Angle * 2) + 38);
Wait(500 + Random(100));
end;

but im getting errors that state:
[Error] (88:11): Duplicate identifier 'SETANGLE' at line 87

here is the full script of what i have so far.


//TVJJ'S First PowerChopper//

program PowerChopper;
//{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
{$Include SRL/SRL/skill/fighting.simba}

Const
SRLStats_Username = ''; //Your SRL stats Username.
SRLStats_Password = ''; //Your SRL stats Password.
BreakEvery = '3'; //How many minutes to break after.
BreakFor = '1'; //How long to break for.
Version = '1.0a'; // No need to touch.
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; // Player to start autoing with (0 means first char)

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;

With Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
end;// declare players


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;



Function CheckAndClick(UpText, Option:String; x,y:integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
if WaitUpText (UpText, 1500+Random(500)) Then
Begin
Result:=True;
GetMousePos(x, y);
If RClick Then
Begin
Mouse(x, y, 0, 0, False);
Result:= WaitOption (Option, 2000);
If Result Then FFlag (0);
End else
Begin
Mouse(x, y, 0, 0, True);
Wait (100+Random(50));
FFlag(0);
End;
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;


Procedure FailSafe (Reason:String);
Begin
Players [CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;

procedure SetAngle(ANGLE: Integer);
begin
if ((Angle = SRL_ANGLE_NONE) or (not LoggedIn)) then
Exit;

KeyDown((Angle * 2) + 38);
Sleep(1000 + Random(300));
KeyUp((Angle * 2) + 38);
Wait(500 + Random(100));
end;

Function ChopDown: Boolean;
Var
X, Y: Integer;
begin
//Ex. FindObjCustom(x, y, ('att', 'ack'), [123456, 345678], 5);//
If FindObjCustom(X, Y, ['Chop', 'Down', 'p d'], [2108982, 1252123, 1713960, 2307133], 2) Then
StatsGuise('Hooray, we found a tree');
GetMousePos(X, Y);
Case Random(1) of
0: Mouse (X, Y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
WaitOption ('chop', 500);
End;
End;

end;

begin
SetupSRL;
DeclarePlayers;
SetAngle;
//Repeat
Chopdown;
//Until(false);
End.

and again any and all help is greatly appricated

iBlank

2012-04-07 02:16:10

Just do SetAngle(1)

m34tcode

2012-04-07 03:38:58

From: tvjj
hey every one im following yohojos scripting tut's there have been a few problems so far but have mostly figured them out, i just came across a new one though, im trying to make my first powercutter, and im trying to set the angle but the way yohojo says to do it with
Simba Code:
[LEFT]SetAngle(False)
[/LEFT]

this is supposed to make it set the angle as low as possible, although it does not, i tried tinkering with:
Simba Code:
[LEFT]procedure SetAngle(ANGLE: Integer);
begin
if ((Angle = SRL_ANGLE_NONE) or (not LoggedIn)) then
Exit;

KeyDown((Angle * 2) + 38);
Sleep(1000 + Random(300));
KeyUp((Angle * 2) + 38);
Wait(500 + Random(100));
end;
[/LEFT]


but im getting errors that state:
[Error] (88:11): Duplicate identifier 'SETANGLE' at line 87

here is the full script of what i have so far.

Simba Code:
[LEFT]//TVJJ'S First PowerChopper//

program PowerChopper;
//{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
{$Include SRL/SRL/skill/fighting.simba}

Const
SRLStats_Username = ''; //Your SRL stats Username.
SRLStats_Password = ''; //Your SRL stats Password.
BreakEvery = '3'; //How many minutes to break after.
BreakFor = '1'; //How long to break for.
Version = '1.0a'; // No need to touch.
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; // Player to start autoing with (0 means first char)

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;

With Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
end;// declare players


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;



Function CheckAndClick(UpText, Option:String; x,y:integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
if WaitUpText (UpText, 1500+Random(500)) Then
Begin
Result:=True;
GetMousePos(x, y);
If RClick Then
Begin
Mouse(x, y, 0, 0, False);
Result:= WaitOption (Option, 2000);
If Result Then FFlag (0);
End else
Begin
Mouse(x, y, 0, 0, True);
Wait (100+Random(50));
FFlag(0);
End;
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;


Procedure FailSafe (Reason:String);
Begin
Players [CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;

procedure SetAngle(ANGLE: Integer);
begin
if ((Angle = SRL_ANGLE_NONE) or (not LoggedIn)) then
Exit;

KeyDown((Angle * 2) + 38);
Sleep(1000 + Random(300));
KeyUp((Angle * 2) + 38);
Wait(500 + Random(100));
end;

Function ChopDown: Boolean;
Var
X, Y: Integer;
begin
//Ex. FindObjCustom(x, y, ('att', 'ack'), [123456, 345678], 5);//
If FindObjCustom(X, Y, ['Chop', 'Down', 'p d'], [2108982, 1252123, 1713960, 2307133], 2) Then
StatsGuise('Hooray, we found a tree');
GetMousePos(X, Y);
Case Random(1) of
0: Mouse (X, Y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
WaitOption ('chop', 500);
End;
End;

end;

begin
SetupSRL;
DeclarePlayers;
SetAngle;
//Repeat
Chopdown;
//Until(false);
End.
[/LEFT]


and again any and all help is greatly appricated

SRL was updated, so setangle no longer uses a boolean value. The tutorial is outdated, for now =]

Use SetAngle(SRL_ANGLE_LOW);

SRL_ANGLE_NONE will leave the angle where it is at;

NKN

2012-04-07 10:34:23

Why do you have the whole Angle Procedure in there? It's already SRL.


SetAngle(SRL_ANGLE_LOW)
Will do the trick.

tvjj

2012-04-07 12:04:13

well im really fresh to scripting so i decided to try a couple things before making myself look more nooby :P

tvjj

2012-04-07 12:05:46

and thank you all for the reply's when people said this community is good, they were not kidding +rep all :D

mrbarrybadger

2012-06-02 09:54:53

Dont Worry Set Angle Seems To Work On S.M.A.R.T. but not on a targeted rs window

riwu

2012-06-02 10:14:05

From: mrbarrybadger
Hey i have the same problem, is there something wrong with the path now? it compiles fine but when i attempt to rune the script it seems to ignore the command, to make sure it wasn't the script that caused it to skip I made a new one which is literally just to SetAngle(SRL_ANGLE_HIGH);
and once again it compiles fine but when i log in and target the window then run the script there is a delay and it says successfully executed even though the window is still at ANGLE LOW I dont really understand why :/

Works fine for me? what do u understand by ANGLE HIGH? Its simply the highest elevation ur compass can go (i.e. pressing "up arrow" will not make it go even higher). Are u at a place where u are restricted to low angle?

EDIT: if it works on smart it should work on targeted rs window too. u probably drag the cross hair to the wrong window.