SRL Archive - First Scripts

PowerTreeNoober


rya

2009-08-20 01:13:01

PowerTreeNoober
Its my first Scirpt that cuts normal, oak and willows and drops

Updates coming
1-Progy Done
2-I think there is a bug where it dose not stop after its done the loads I think its Done
3-Maybe add banking

If poeple could test out and give feedback it would be great, also if there is a bug some help on fixing it maybe thanks
And hope you like my first ever scirpt :cool:

Poeple please Post Proggys
And any ideas for the next Version would be great

Version Updates descriptions:

PowerTreeNoober V1.1
Added Proggy
Changed Bits Thanks to JAD
Added Intro
Found a Bug and Fixed it

PowerTreeNoober V1.2
Kind of reworte the cut Procedure
Made a Spin Procedure for AntiBan

Quick Note
LOL Nobody Downloaded V1.1 befor i uploaded V1.2 :)

JAD

2009-08-20 03:02:43

This is a great first script. Much better than my first :p

A few suggestions:

Players strings 1 (the should axe be equipped) should use a boolean variable. A boolean variable can only hold two types of values: true and false. That sounds perfect in this case.

Players[0].Booleans[0] := true; //true to equip, false for in inventory[/csar]

For your random finding, maybe give the user an option for what to use the lamp on? You could this as a constant or you could add another string to the Players array.

Why is Text an array of string? A normal string would work just fine there.

In CutTree, there are a few problems near FindObjTPA:
1) FindObjTPA moves the mouse to the object already. You do not need to call another MMouse to move there again.

2) then, you click the mouse at a random spot around there too.

3) Both those things combined are very unhuman and could cause you to miss the tree. You should do:

[scar]
FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)
//MMouse(x, y, 4, 4); Get rid of this
GetMousePos(x,y); //Get the current mouse position, which is where
begin //the tree was found
case Random(2) of
0 : begin
Mouse(x, y, 0, 0, False); //Click where the tree was found,
Wait(1500 + Random(2000)); //not a random spot near there
ChooseOption('hop');
end;
1 : Mouse(x, y, 0, 0, True); //Click where the tree was found,
//not a random spot near there
end;

Some more adjustments to that (didn't want to cram too many comments into the above one):


FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)
GetMousePos(x,y);
//begin //unnecessary begin/end

//Took out the case. With 2 cases or less it actually takes more lines
if(random(2) = 1)then
begin
Mouse(x, y, 0, 0, False);
Wait(1500 + Random(2000));
ChooseOption('hop');
end else
Mouse(x, y, 0, 0, True);
Wait(4500 + Random(3000));
AntiRandoms;
AntiBan;
//end; // unnecessary


In here:


until (Invfull) or not FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text);
while (not FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)) do
Wait(1500 + Random(2000));

You may want to drop the logs if the inventory is full before waiting until finding the tree? Do like:


until (Invfull) or not FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text);
if(InvFull)then Drop; //You will need to put the drop procedure
//above CutTree
while (not FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)) do
Wait(1500 + Random(2000));

I would also try some MarkTimes because you do have some possible infinite loops here. For the first one (example), what if the script is finding the obj tpa but not chopping because you lost your axe, and therefore the inventory isn't filling up either? Then this loop will go on forever.

Try creating an integer variable called Timer, and then:

MarkTime(Timer);
repeat
if(TimeFromMark(Timer) > 600000+random(100000))then
begin
//gone on for over 10 minutes
Writeln('Problem chopping the logs');
Exit; //Get out of this procedure
end;
SetTree;
FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)
MMouse(x, y, 4, 4);
begin
case Random(2) of
0 : begin
Mouse(x, y, 4, 3, False);
Wait(1500 + Random(2000));
ChooseOption('hop');
end;
1 : begin
Mouse(x, y, 3, 4, True);
end;
end;
Wait(4500 + Random(3000));
AntiRandoms;
AntiBan;
end;
until (Invfull) or not FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text);

And also with your while:


MarkTime(Timer);
while (not FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)) do
begin
Wait(1500 + Random(2000));
if(TimeFromMark(Timer) > 20000 + random(5000))then //over 20 seconds
break; //Get out of the loop



Your drop procedure could be shortened a good amount:


procedure Drop;
begin
Inc(LoadsDone);
if(lowercase(Players[CurrentPlayer].Strings[1]))then
begin
DropAll; //SRL function to drop everything in inventory
IncEx(LogsCut, 28);
end else
begin
for i:= 2 to 28 do
DropItem(i);
IncEx(LogsCut, 27);
end;
AntiRandoms; //Moved to bottom because you do it either way
AntiBan;
end;

You also were incrementing LogsCut if Players Strings[1] wasn't true 27 times because you had it in the for loop.


In your main loop:

if (not LoggedIn) then
NextPlayer(True);

Change NextPlayer(True); to NextPlayer(False);




I am really impressed by some of the advanced techniques you used. I don't mean to discourage you with everything I pointed out, but you still just have a few things to work on. Keep working at it, and I'm sure you will become an SRL member sometime in the future.

If you are interested in learning a little more advanced object finding than FindObjTPA, you may find some use in reading my tutorial: http://www.villavu.com/forum/showthread.php?t=48915

Cheers!
~JAD

marpis

2009-08-20 11:15:56

You don't SetTree 'normal/oak' :p
The script is looking very good for a first script! Alot of "advanced" things where most new scripters make mistakes.

Also i recommend you to check uptext/option 'hop down', because in lumbridge you might accidentally click the p2p tree and get stuck there :p

rya

2009-08-20 11:45:54

Thanks For the feedback, and thanks for the changes
The Normal/Oak i was going to add but missed out sorry because it looks botty trying to find a oak

And JAD you did not discourage and thanks for taking the time to help me

Ghostman

2009-08-20 15:14:19

Very nice for a first time (hmmmmm are you sure this is your first script)

rya

2009-08-20 15:51:35

From: Ghostman
Very nice for a first time (hmmmmm are you sure this is your first script)

Well it is my first is it that good?

Tsige

2009-10-06 17:15:34

very nice :D

Ghostman

2009-10-07 22:22:35

lol of course it is

Should have seen mine =/

rya

2009-10-07 23:12:58

Grave Dig?
It does not Work