SRL Archive - First Scripts

Reflection simba willow chopper


austin2162

2010-05-16 21:14:23

This is my first simba script
also my first reflection script
dont have reflection
go here
http://villavu.com/forum/showthread.php?p=710707#post710707
this is a willow chopper and banker with reflection and antiban

bbri06

2010-05-16 22:13:31

I looked through the code briefly and I suggest you take a look at these two tutorials. The way you have tried to create a failsafe is a little ineffective.

Scripting standards -
http://villavu.com/forum/showthread.php?t=3293

Failsafes -
http://villavu.com/forum/showthread.php?t=43037

Also, you should add some time marks into your repeats so you don't have them repeating forever if the condition is not met. For instance, in bank1 you have


repeat
OpenBank('db',true,true);
wait(500);
if (not(R_loggedin)) then
loginplayer;
until bankscreen = true
You could do something like

MarkTime(z); // z should be declared as an integer
repeat
OpenBank('db',true,true);
wait(500);
if (not(R_loggedin)) then
loginplayer;
if(TimeFromMark(z) > 60000)then
TerminateScript;
//60000 is 60 seconds. So, if the script has been trying to open the bank for 60 seconds and still hasn't done it, then the script will terminate.
until bankscreen = true

Good job for your first script, though.

i luffs yeww

2010-05-16 23:01:12


program Treechopper;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.simba}
{dont have reflection http://blanddns.no-ip.org:81/repos/reflection}
{see my tut to set it up http://villavu.com/forum/showthread.php?p=710707#post710707}


var
x, y, a, b, c, d, e2, f, t, t1, t2: Integer;
r1, r2: String;
Bank, Trees, e: TTile;

{------------------------------------------------------------------------------}
{------------------------------PLayer setup------------------------------------}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Your RuneScape username.
Pass := ''; // Your RuneScape password.
Nick := ''; // 3-4 LOWERCASE letters from username.
Active := True; // Use this player?
end;
end;
{------------------------------------------------------------------------------}
{---------------------------------keep out-------------------------------------}

procedure Report;
begin
t := GetTimeRunning / 1000;
t1 := t / 60;
t2 := t1 / 60;
d := c * 28;
ClearDebug;
Writeln('-----Willow tree------');
Writeln('-------Chopper--------');
Writeln('Total loads ' + IntToStr(c) + ' Total logs ' + IntToStr(d));
Writeln('-----Current act------');
Writeln(' ' + r1 + ' ');
Writeln(' ' + r2 + ' ');
Writeln('------Time running----');
Writeln(' ' + IntToStr(t2) + ' hrs ' + IntToStr(t1) + ' mins ' + IntToStr(t) + ' sec');
Writeln('Levels gained: ' + IntToStr(b));
Writeln('Pos ' + IntToStr(e2) + ' anim ' + IntToStr(GetAnimation) + ' ');
end;

procedure StartUp;
begin
MakeCompass('n');
SetAngle(True);
r1 := 'Starting up.';
r2 := 'Making compass north.';
Report;
Bank := Tile(3092, 3243);
Trees := Tile(3085, 3237);
end;

procedure FaiSafe;
begin
repeat
if (not(R_LoggedIn)) then
LoginPlayer;
if not(FindObjCustom(x, y, ['illow'], [10076602, 5207920], 5)) then
begin
Inc(a);
Wait(2750 + Random(500));
r1 := 'No tree found, waiting.';
r2 := 'Try ' + IntToStr(a);
Report;
Writeln('No trees found waiting.');
end else
begin
r1 := 'Tree found! Moving on.';
r2 := 'Tries ' + IntToStr(a);
Report;
Writeln('Trees found right postion. Moving on.');
Wait(250 + Random(500));
a := 0;
Exit;
end;
Writeln('Try ' + IntToStr(a));
if(a = 5)then
begin
r1 := 'No tree found, max trys.';
r2 := 'logging out';
Report;
Writeln('LOST! logging out.');
LogOut;
TerminateScript;
end;
until False;
end;

procedure Bank1;
begin
if (not(R_LoggedIn)) then
LoginPlayer;
WalkToTile(Bank, 0, 0);
R_Flag;
r1 := 'Walking...';
r2 := ' ';
Report;
r1 := 'Looking for bank...';
r2 := ' ';
Report;
repeat
OpenBank('db', True, True);
Wait(250 + Random(500));
if (not(R_LoggedIn)) then
LoginPlayer;
until BankScreen;
r1 := 'Depositing all.';
r2 := ' ';
Report;
DepositAll;
CloseBank;
r1 := 'Waiting...';
r2 := ' ';
Report;
WalkToTile(Trees, 0, 0);
if (not(R_LoggedIn)) then
LoginPlayer;
R_Flag;
r1 := 'Entering failsafe...';
r2 := ' ';
Report;
FailSafe;
end;

procedure AntiBan;
begin
if (not(R_LoggedIn)) then
LoginPlayer;
case Random(8) of
1..3: SmartMoveMouse(x + Random(342), y + Random(452));
4: Wait(234 + Random(34));
5: MakeCompass(Random(180));
6: MakeCompass(Random(-180));
7, 8: RandomMovement;
end;
end;


procedure FindTrees;
begin
repeat
if (not(R_loggedin)) then
LoginPlayer;
r1 := 'Searching for tree.';
r2 := '';
Report;
if(FindObjCustom(x, y, ['illow'], [10076602, 5207920], 5))then
begin
SmartClickMouse(x, y, True);
R_Flag;
repeat
AntiBan;
Wait(1000 + Random(250));
if(LevelUp)then
begin
Inc(b);
LevelUp;
end;
until not((GetAnimation = 875) or (InvFull));
r1 := 'Tree gone.';
r2 := 'Or full.';
Report;
Wait(750 + Random(500));
until InvFull;
r1 := 'Full!';
r2 := 'Banking.';
Report;
Bank1;
end;



begin
SetupSRL;
Report;
DeclarePlayers;
LoginPlayer;
repeat
Wait(50 + Random(50));
until R_RSReady;
StartUp;
repeat
FindTrees;
until False;
end.

Just standardized it.

austin2162

2010-05-16 23:22:31

The fail safe worked before i added reflection and it work a bit during reflection its if it gets lost that its supposed to log out

edit:
i really suck at standerds but i look at how the script runs instead of what it looks like.

edit2:
If you really what i can reupload with the standerized one that some one posted
btw not my first script
could some one get a report?

i luffs yeww

2010-05-16 23:41:46

:p Standards are mostly just for readability and debugging. It's just something to have if you want it to look professional and be easy to fix. :)

austin2162

2010-05-17 02:41:54

So I've noticed. I suck at them. But I'm just happy if they work the way I want :p

TRiLeZ

2010-05-17 04:19:47

This thread belongs in one of the scripts section. This isn't reflection development.

On the other hand, good job with making this script. :)

Sir R. M8gic1an

2010-05-17 05:42:56

moved.

~RM

austin2162

2010-05-17 16:45:08

Thanks Rasta.

i luffs yeww

2010-05-17 16:50:44

The flow of the script seemed quite odd. Actually, it was confusing and could have been done better. I'm not trying to sound rude, but I think that you could learn a lot by making this into different functions/procedures for more failsafes (if(CanBank)then DoBank; etc.). The reason for that is so it doesn't try to skip steps even if it didn't do the previous. And it wasn't very structured.

Nothing too important, but I think you could learn a lot from expanding and perfecting this. :)

austin2162

2010-05-17 20:47:32

Good news on yew chopper simba+reflection its gone for 3 hrs and collected 217 yew logs, it currently runs in edgeville and has dual tree support

i luffs yeww

2010-05-17 23:54:44

:) I can standardize it for you.

austin2162

2010-05-18 16:34:40

I ll send it to you when I finish

rya

2010-05-25 14:52:17

So i think i fail at setting up reflection or maybe simba, when i run this i get this.

[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(131:3): Variable 'TESTSTRING' never used at line 130
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(167:3): Variable 'TESTSTRING' never used at line 166
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(211:3): Variable 'I' never used at line 210
[Error] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(90:21): Unknown identifier 'SmartGetFieldShort' at line 89
Compiling failed.
i think every things upto date
Thanks
~Rya

aran armath

2010-05-25 15:53:46

From: rya
So i think i fail at setting up reflection or maybe simba, when i run this i get this.

[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(131:3): Variable 'TESTSTRING' never used at line 130
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(167:3): Variable 'TESTSTRING' never used at line 166
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(211:3): Variable 'I' never used at line 210
[Error] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(90:21): Unknown identifier 'SmartGetFieldShort' at line 89
Compiling failed.
i think every things upto date
Thanks
~Rya


Something I believe is wrong with reflection's objects. Been waiting for a fix today ans hasn't been one.

Narcle

2010-05-25 16:51:48

I believe you need the newer SMART that's in Opendev "libsmart.dll" and place it into Simbas plugins folder.

Also the hooks need to be updated so it won't work until then anyways.

rya

2010-05-26 12:17:51

Now i get

[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(131:3): Variable 'TESTSTRING' never used at line 130
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(167:3): Variable 'TESTSTRING' never used at line 166
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Characters.simba(211:3): Variable 'I' never used at line 210
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(69:4): Variable 'THETYPE' never used at line 68
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(133:3): Variable 'IDX' never used at line 132
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(133:3): Variable 'I' never used at line 132
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(196:4): Variable 'NL' never used at line 195
[Hint] C:\Users\Ryan\Desktop\Auto\Simba\Includes\srl\srl\Reflection\Objects.simba(244:4): Variable 'NL' never used at line 243
[Error] (60:21): Closing parenthesis expected at line 59
Compiling failed.
Any idea's ? :(

Baked0420

2010-05-26 13:18:38

your probably missing a ")" on line 59 :p