SRL Archive - First Scripts

Draynor willow cutter and banker


bobng

2008-07-02 18:00:36

So, I made this willow cutter and banker. Start at draynor bank, and it will cut down all the willows it finds, then bank them.
Not 100% perfect, but it does work well.

Any tips would be appreciated.

program New;
{.include Srl\Srl.Scar}
//{.include SRL\SRL\Core\Inventory.scar}
{.include SRL\SRL\Skill\WoodCutting.scar}
//FindColorSpiralTolerance(x, y, color, MSX1, MSY1, MSX2, MSY2, 3)
var
x :Integer;
y :Integer;
const
fishcolor = 16740896;
willowcolor = 2850671; //3891047;

procedure setup;
begin
activateclient;
wait(1000)
setupsrl
MouseSpeed := 10
Writeln('Draynor Village Willow Whipper')
Writeln('Setting up script...')
MakeCompass('n')
SetAngle(True)
SetRun(True)
wait(200)
if GetSkillInfo('woodcutting', False) < 30 then
begin
writeln('Error! Your woodcutting level must be higher than 30 to cut willows!')
TerminateScript;
end;
end;

procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
end else
begin
Mouse(649, 36,0,0,True);
end;
end;

procedure gototrees;
begin
SetRun(True)
if FindColorSpiral(x,y,fishcolor,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found fish colour. Moving to it')
Mouse(x, y, 0, 0,True)
end else
begin
writeln('Have not found fish colour! Using "blind" co-ordinate based location technique')
writeln('This is not very acurate')
Mouse(591,132,0,0,True)
end;
end;

begin
setup
repeat

//if FindColor(x, y, fishcolor, MSX1, MSY1, MSX2, MSY2) then
gototrees ;
repeat
wait(100)
until(FlagDistance < 1)
//until()
FindObj(x, y, 'willow',willowcolor, 2)
Mouse(x,y,0,0,True)
repeat
SolveNonTalkingRandoms;
//SolveTalkingRandom()
if FindEnt(x, y, False) then
begin
// Run 2 t3h b4nk!!!
gotobank;
wait(10000)
boredhuman;
wait(30000)
RandomRClick;
wait(20000)
gototrees;
end;
FindObj(x, y, 'willow',willowcolor, 2)
Mouse(x,y,0,0,True)
if FindFight then
begin
gotobank
wait(10000)
boredhuman;
wait(30000)
RandomRClick;
wait(20000)
gototrees;
end;
wait (1000+random(1000)+random(2000)+random(4000)+random(4000))
if (random(100) = 100) then
begin
BoredHuman;
end;
until(InvFull)
gotobank;
repeat
wait(100)
until(FlagDistance < 1)
//FindObj(x,y,'bank booth',5001555,5)
//Mouse(x,y,0,0,True)
OpenBankQuiet('db')
DepositAll;
CloseBank;
until(False)
end.

Twisted

2008-07-02 18:59:07

for your mouse(X, X, 0, 0, X), you might want to make it 5, 5 just so you wont get banned fast.

bobng

2008-07-02 19:02:28

From: twistedvip50
for your mouse(X, X, 0, 0, X), you might want to make it 5, 5 just so you wont get banned fast.


It just adds the random value onto the position (So, if it was going to 10,10, with a random value of 5,5, it just goes to 15,15 (I think)), making it a bit pointless IMO

Twisted

2008-07-02 20:33:13

no, it'll be like 11, 13, 12, 15… etc. It is random just like the case random(x) of.

Foss

2008-07-03 06:59:06

First think i can think of is to add a DeclarePlayers; and make it Multi-User.

turbobk

2008-07-03 07:44:46

Hey there bobng.

Firstly nice try for your first script :)

Ok with all the Mouse movements, try to add a little bit of randomness to it just like twistedvip50 said. Example from your script:

No Mouse Randomness:
procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
end else
begin
Mouse(649, 36,0,0,True);
end;
end;


With Mouse Randomness:
procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,5,5,True)
end else
begin
Mouse(649, 36,5,5,True);
end;
end;


Also with your wait times add randomness to them, the more random the better. So in your script you have 'wait(10000);', that will wait for exactly 10 seconds every time. But with 'wait(10000 + random(2000));' the script will wait anywhere from 10 seconds to 12 seconds. Example from your script:

No Wait Randomness:
//SolveTalkingRandom()
if FindEnt(x, y, False) then
begin
// Run 2 t3h b4nk!!!
gotobank;
wait(10000)
boredhuman;
wait(30000)
RandomRClick;
wait(20000)
gototrees;
end;


With Wait Randomness:
//SolveTalkingRandom()
if FindEnt(x, y, False) then
begin
// Run 2 t3h b4nk!!!
gotobank;
wait(10000 + random(2000));
boredhuman;
wait(30000 + random(2000));
RandomRClick;
wait(20000 + random(2000));
gototrees;
end;


Thirdly you should learn some Indenting, it really makes your scripts look so much more neat and tidier. Here is another example:

No Indenting:
procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
end else
begin
Mouse(649, 36,0,0,True);
end;
end;


With Indenting:
Procedure gotobank;
Begin
SetRun(false); //<------- here.
If FindColorSpiral(x, y, 1890556, MMX1, MMY1, MMX2, MMY2) Then
Begin
WriteLn('Found bank. Moving towards it'); //<---- Dont forget the ;'s
Mouse(x, y, 5, 5, True); //<-------- here aswell =] I put them in for you
End Else
Begin
Mouse(649, 36, 5, 5, True);
End;
End;


See how much neater that looks?
Get that done then repost the script and I'll have a closer look at it for you.
Its hurting my eyes looking at it ;)


Thanks,
TurboBk.

bobng

2008-07-03 14:33:48

From: Foss
First think i can think of is to add a DeclarePlayers; and make it Multi-User.


I wrote it for my my use only really, so I thought it would be pointless.


And thanks TurboBK, that was really helpful! +rep

jones2644

2008-07-03 21:02:13

so has anyone tested it yet or not?

turbobk

2008-07-04 04:53:56

From: bobng
I wrote it for my my use only really, so I thought it would be pointless.


And thanks TurboBK, that was really helpful! +rep



No problem, if you have any more problems with it.. I'll be glad to help :)

insanomano7

2008-07-05 07:48:02

make it MultiUser;

bigboi

2008-07-06 03:54:16

Very nice script, Worked like a charm

PvH

2008-07-06 08:01:04

Here are some suggestions:
First of all, use failsafes, what if it can't find the color?
It will keep searching for it.. and it will just stand there..
Try using ObjTpa for tree finding.
Try walking to bank with dtms.
Have randomness in clicking and waiting.
Also, improve your standards.
I fixed them for you, I didn't change anything else in your script, so it is still bannable (no randomness in waiting/clicking = bannable for sure!)

program New;
{.include Srl\Srl.Scar}
//{.include SRL\SRL\Core\Inventory.scar}
{.include SRL\SRL\Skill\WoodCutting.scar}
//FindColorSpiralTolerance(x, y, color, MSX1, MSY1, MSX2, MSY2, 3)
var
x,y :Integer;

const
fishcolor = 16740896;
willowcolor = 2850671; //3891047;

procedure setup;
begin
activateclient;
wait(1000)
setupsrl;
MouseSpeed := 10;
Writeln('Draynor Village Willow Whipper');
Writeln('Setting up script...');
MakeCompass('n');
SetAngle(True);
SetRun(True);
wait(200);
if GetSkillInfo('woodcutting', False) < 30 then
begin
writeln('Error! Your woodcutting level must be higher than 30 to cut willows!');
TerminateScript;
end;
end;

procedure gotobank;
begin
SetRun(false);
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it');
Mouse(x,y,0,0,True);
end else
begin
Mouse(649, 36,0,0,True);
end;
end;

procedure gototrees;
begin
SetRun(True);
if FindColorSpiral(x,y,fishcolor,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found fish colour. Moving to it');
Mouse(x, y, 0, 0,True);
end else
begin
writeln('Have not found fish colour! Using "blind" co-ordinate based location technique');
writeln('This is not very acurate');
Mouse(591,132,0,0,True);
end;
end;

begin
setup;
repeat
//if FindColor(x, y, fishcolor, MSX1, MSY1, MSX2, MSY2) then
gototrees;
repeat
wait(100);
until(FlagDistance < 1)
//until()
FindObj(x, y, 'willow',willowcolor, 2);
Mouse(x,y,0,0,True);
repeat
SolveNonTalkingRandoms;
//SolveTalkingRandom()
if FindEnt(x, y, False) then
begin
// Run 2 t3h b4nk!!!
gotobank;
wait(10000);
boredhuman;
wait(30000);
RandomRClick;
wait(20000);
gototrees;
end;
FindObj(x, y, 'willow',willowcolor, 2);
Mouse(x,y,0,0,True);
if FindFight then
begin
gotobank;
wait(10000);
boredhuman;
wait(30000);
RandomRClick;
wait(20000);
gototrees;
end;
wait(1000+random(1000)+random(2000)+random(4000)+random(4000));
if (random(100) = 100) then
begin
BoredHuman;
end;
until(InvFull)
gotobank;
repeat
wait(100);
until(FlagDistance < 1)
//FindObj(x,y,'bank booth',5001555,5)
//Mouse(x,y,0,0,True)
OpenBankQuiet('db');
DepositAll;
CloseBank;
until(False)
end.
This is a good start, but I recommend you to read some tutorials and try to improve your script;)

PvH

Mohism

2008-07-09 03:31:04

Pretty good, keep up the good work.

RPS13x

2008-07-09 04:42:37

Not bad, worked fine.

Claymore

2008-07-09 11:46:21

Sorry to say, but it needs A LOT of work. I know it works and all, but it sitll needs work though.


procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
end else
begin
Mouse(649, 36,0,0,True);
end;
end;/SCAR]

Where is the FAIL SAFE!? :duh:

[SCAR]
procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
DidFindBank := True;
end else
begin
Mouse(649, 36,0,0,True);
end;
begin
repeat
Tries := Tries + 1;
if (Tries = 20) then
TerminateScript;
until (DidFindBank = True);
end;
end;

I don't know if it works or not. I don't want to work too much on it.

Second is standards! Why do this? So you can edit better, not get Expect identifier errors (Such as Expected BEGIN or END) and to make your script neat-er.


procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
end else
begin
Mouse(649, 36,0,0,True);
end;
end;

Wrong….


procedure gotobank;
begin
SetRun(false)
if FindColorSpiral(x,y,1890556,MMX1,MMY1,MMX2,MMY2) then
begin
writeln('Found bank. Moving towards it')
Mouse(x,y,0,0,True)
end else
begin
Mouse(649, 36,0,0,True);
end;
end;

Right… See how aligned everything is. Let me tell you…

2 spaces forward AFTER using BEGIN (Example)

procedure BlahBlah;
begin
TwoSpacesHere;
end;
begin
2 spaces backwards DURING using END. Example on top. (Notice that after END nothing is changed.

2 spaces AFTER THEN unless there is a BEGIN after it (Example)


if (YourStupid) then
begin
Writeln('I am stupid...')
end;
if (not (YourStupid)) then
Writeln('Hooray! I am not stupid');

Get it?

2 spaces back DURING USING until. (Example)


end;
until (FindBank = True)
end;
2 spaces forward AFTER repeat


begin
repeat
//Codes//
until (WhatTheHellIsTheCode = True)
end;

That is all i can tell you because this post is getting too large…

Also another one


if GetSkillInfo('woodcutting', False) < 30 then

It should be…


if GetSkillLevel('woodcutting') < 30 then

Good Job on your first script mate! +Rep if i help much? :spot:

Magiic

2008-07-09 16:00:24

yeah it looks pretty good and it works the only problem is sometimes (only occasionaly it walks off randomly and stops

ilove 58008

2008-10-11 16:11:18

can any of u send me the finished script

Blumblebee

2008-10-11 16:16:45

looks O.K… only suggestion is really, dont use findobj, maybe use FindobjTPA. And secondly, use standards. Standards make your script more appealing, and easier to read the code aswell.

-Blumblebee

in2it

2008-10-12 05:06:12

nice script worked nicely for me :f:

bobng

2008-10-18 13:08:18

Woah, this threads a bit old, isn't it?

Anyway, I thought about coding failsafes, but I couldn't be arsed. It was just a quick script that I could run while I was reading, and occasionally glance at the screen to check if its all going well.

I'm so used to coding in python (Which rules, by the way) that its pretty hard to get my head around all these useless breaks and ;'s.

in2it

2008-10-18 23:57:38

YOU need failsafes and Overall not a bad script :P

inzone

2008-10-19 03:19:48

doesnt work

alpha0peanut11

2008-10-19 09:55:49

im a noob at scripts and wat, so do u have to run runescape for the script to work?????

alpha0peanut11

2008-10-19 09:57:13

im a noob to scar, but do u have to run runescape or can u run scar then run it???, sum 1 help me plz?

1337N3SS

2008-10-19 10:00:16

well of course… its meant for runescape…

rooshan1234tec

2008-10-19 14:57:30

dosnt work it dosnt click on the trees…

bobng

2008-10-20 10:53:20

From: rooshan1234tec
dosnt work it dosnt click on the trees…


Its about a thousand years out of date, thats why.