SRL Archive - First Scripts

Daemonheim Resource Island Woodcutter


Tlachtli

2011-01-07 00:57:10

After messing around with Simba and reading some tutorials around here, I've decided to try my hand at actually writing a script. So here it is (description is copied from the script itself):

{
Daemonheim Woodcutter
by dd409

You can start the script anywhere, it will use the Ring of kinship to
teleport to Daemonheim. From there it will walk to the woodcutting
island, cut trees until the inventory is full, then use the ring to
teleport back and bank. This script is mostly F2P based, since I
do not have a membership and don't feel like getting one.

It supports all F2P axes both equipped and in inventory from bronze-rune,
and *should* support Dragon and Clay axes as well. This needs confirmation
from a member.

Assumptions:
-Ring of kinship (any color) is equipped at start of script
-Useable axe is equipped or in inventory at start of script
-Dungeoneering level is sufficient to enter the island
-Woodcutting level is sufficient to cut selected tree(s)

I will eventually add failsafes for each of these so that they no longer
need to be assumed. Consider it the first part of my 'to-do' list.

Everything outside of assumptions that still needs to be done:
-Implement bitmaps for Ring of kinship recognition (currently relies on preset screen coordinates, which I know is bad)
-Add walking from trees back to bank if Ring is not equipped
}

I think that sums it up pretty well. Since this is my first attempt at scripting, I need all the critisism on it you have to offer. Suggestions for fixing/optimizing anything within the script are also more than welcome and will be credited accordingly. Also, my standards may be a little messed up since I've never programmed in Pascal; I just followed the Java standards as closely as I could.

Also, just as proof that it runs:
------------------------------------
- Daemonheim Woodcutter - by dd409 -
------------------------------------
Player:
Trees being cut: maple
Loads banked: 1
Randoms encountered: 0
------------------------------------

So let me know what you think!

EDIT: Newer version uploaded. I've replaced the Reflection tree finding with Color. The Reflection finding code is still included, just commented out; eventually I'll add an option for the user to decide which to use.

Furyan

2011-01-07 08:41:11

I thought it was an interesting script. But not because of the way it works. Because your account name and password were still in it. Don't worry, I quickly changed your pass so that no one could steal stuff, check my PM in your inbox. (There were no moderators online to remove it).

Troll

2011-01-07 12:25:27

What are resource islands, they sound good if you need a dung lvl as botter will be less :p and also what is the ring?

Sorry im a noob about runescape nowadays

Tlachtli

2011-01-07 12:37:01

From: Furyan
I thought it was an interesting script. But not because of the way it works. Because your account name and password were still in it. Don't worry, I quickly changed your pass so that no one could steal stuff, check my PM in your inbox. (There were no moderators online to remove it).


Well, that's definitely embarrassing :blushing:. That would also explain why my login details had been changed. Thanks a ton. Anyways, I changed my password (again) and uploaded a clean copy of the script.

From: Troll Man
What are resource islands, they sound good if you need a dung lvl as botter will be less :p and also what is the ring?

Sorry im a noob about runescape nowadays


They're places you can only access with a certain Dungeoneering level. The Ring of kinship is given to you by the Dungeoneering tutor, and it allows you to form Dungeoneering parties and (conveniently) teleport straight to Daemonheim; the ring itself can be worn like any normal ring and is weightless.

EDIT: Newer version uploaded. Walking and tree finding significantly improved and slightly more human-like. Still one issue and a few features to deal with before I post this in the real scripts section. It's safe to use now if you want to mess around with it, just don't rely on it as a maple cutter for now. Also, now with 100% fewer account details! :P

RISK

2011-01-09 07:26:26

Your DeclarePlayers and some global variables that are used for options can be shortened and "Tidied" with this:


procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;


{
What "with Players[0] do" does is removes the need to put
"Players[x]." before everything. Making it look tidier and allows
for better script maintaining, in my opinion.

The strings and integers are arrays that are quite useful for options.
You could find a better alternative, if you wished. But for now it would
be good to use.
}
with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Active:=True;

Strings[0] := 'Maple'; // Chopping
Integers[0] := 999; // Loads and/or how many logs to chop of the selected type
// And etc.
end;
end;

–

Your procedure "SetupVariables" is really unneeded, in my opinion. As you should stick to using local variables and not global like you have for the TTileArrays. It makes it tidier and easier to maintain.

–
Readability:

findcolortolerance(x,y,2438653,MSX1,MSY1,MSX2,MSY2,15);

That should be (And every other thing you have this way):

FindColorTolerance(X, Y, {COLOR}, MSX1, MSY1, MSX2, MSY2, {TOL});

Yet again, it makes things easier to maintain and read over quickly when making changes to your script and future scripts that you may create.

–

For your procedure "GoToBanker" (And every other procedure that uses your TTileArrays that you have as your global variables; You should have the TTileArrays as local variables instead.

–

That is all I saw from quickly glancing over the script.

Overall, this is a good first script, dd409. You have done very well. I can't wait to see what you create in the future!

-

E: @ This line of If's:

if (Lowercase(TreeToCut[CurrentPlayer]) = 'willow') then
TargetTree := 1;
if (Lowercase(TreeToCut[CurrentPlayer]) = 'maple') then
TargetTree := 2;
if (Lowercase(TreeToCut[CurrentPlayer]) <> 'willow') and (Lowercase(TreeToCut[CurrentPlayer]) <> 'maple') then
TargetTree := 3;

This is incorrect and should be changed to a case instead since it is the same type of string you are using in all of the If's. Like this:

// You should also change "Players[*" to be something like "Chopping".
case Lowercase(Players[CurrentPlayer].Strings[0]) of // Refer to the DeclarePlayers suggestion I gave earlier in the post
'willow' : TargetTree := 1;
'maple' : TargetTree := 2;
'both' : TargetTree := 3; // If I understand this correctly in your line of If's
end;

Tlachtli

2011-01-14 14:37:42

Thanks RISK, I've committed all of those changes you suggested. The if's (or replacement case statement) were actually entirely unnecessary since I found a different way of going about it.

I've just recently gotten back to school, so my time to work on this will probably be limited. Once I get all of the kinks worked out of it and get the banking straight I'll put this up in the main section.

EDIT: Latest revision is up. I've added in Color tree finding which (for the moment) is being used instead of Reflection. Eventually I'll add an option to let the user decide which to use.