I would add the number of loads to do to the player array. That way, people can choose a different amount of loads for each player:
Players[0].Name := ''; //username
Players[0].Pass := ''; //password
Players[0].Nick := ''; //3-4 letters of name
Players[0].Pin := ''; //bank Pin
Players[0].Booleans[0] := true; //true if weilding an axe
Players[0].Integers[0] := 10; //How many loads to do
Players[0].Active := True;
Just add the Integers[0] in there like that.
To save room on your script by not needing to call and free the bank DTM so much, why not take advantage of the scripts OnTerminate?
procedure OnTerminate;
begin
FreeDTM(BankDTM);
end;
OnTerminate is a procedure that is called when the user stops the script. Then, you can get rid of the procedure to declare the banker DTM and just declare it once before the main loop.
LampSkill := 'theskill';
Why do you have this in FindRandoms? There is no option in LampSkill called 'theskill' as far as I know. It should be example: LampSkill := 'summoning'; or something.
In AntiBan, it will never not do anti ban. Random returns a number between 0 and one less than the number you chose. It would need to be Random(2) to return either 0 or 1 like you meant:
Case random(2) of
0: begin
WriteLn('Performing Anti-Ban');
ApxCustomAntiban;
end;
1: WriteLn('No Anti-Ban');
end;
And it could also not use a case to be shorter:
if(Random(2) = 0)then
begin
WriteLn('Performing Anti-Ban');
ApxCustomAntiban;
end else
WriteLn('No Anti-Ban');
Cases should normally only be used with 3 or more items.
Again in ChooseArray, you need to use a Random(6) instead of 5. Random(6) would choose a number between 0-5 like you want in that case.
Procedure Equipmentcheck;
begin
If(FindAxeBool)Then
begin
WriteLn('Hatchet Found');
end;
If not(FindAxeBool)Then
begin
WriteLn('Hatchet Not Found')
exit;
end;
end;
Could simply be:
Procedure Equipmentcheck;
begin
If(FindAxeBool)Then
WriteLn('Hatchet Found') else
WriteLn('Hatchet Not Found')
end;
Only a begin/end is needed after an if/then or an else if you are calling more than one statement. Exit; just skips the rest of a procedure, so there was no point calling it here because it was already the end of the procedure. If you meant to stop the script, then you could call TerminateScript. If you wanted to switch players, you could have called Logout here (if you do what I show you to do in the main loop below).
Procedure ChopTheTree1;
begin
repeat
FindObjCustom(x,y,['Willow','illow','will'],[tree],20)
mouse(x,y,4,4,false);
FindRandoms;
until ChooseOption('Chop');
end;
First of all, you move the mouse to the tree, and then right click the mouse somewhere else (because of those random parameters). What you want to do is get the current mouse position where it found the uptext at, and click at that exact spot.
You could also use a wait in there if it doesn't choose the option Chop the first time or else the mouse could get pretty spastic.
You need to check if it found the object. Don't just right click if it didn't find it.
A fail safe would also be necessary. Add a markTime to avoid an infinite loop if it never finds the tree:
Procedure ChopTheTree1;
var Timer: Integer;
begin
MarkTime(Timer);
repeat
if(FindObjCustom(x,y,['Willow','illow','will'],[tree],20))then
begin
GetMousePos(x,y);
mouse(x,y,0,0,false); //Click where it found the tree
end;
FindRandoms;
if(ChooseOption('Chop'))then
break else
wait(1500+random(500));
until(TimeFromMark(Timer) > 7000+random(4000));
end;
Much better.
This and ChopTree2 could be easily combined. Just add a random thing after FindObj like (psuedo code):
if(Random(3) = 1)then
DoLeftClick else
DoRightClick
In ChopTree, you need to do a Random(3) instead of 2. You need a time marker in case the inventory is never full. It could be easily shortened:
//Create a timer variable above
MarkTime(Timer);
Repeat
case random(3) of
0: begin
WriteLn('Using Choping Type One');
ChopTheTree1;
end;
1: begin
WriteLn('Using Choping Type Two');
ChopTheTree2;
end;
2: begin
WriteLn('Using Choping Type Two');
ChopTheTree2;
end;
end;
wait(random(3000)); //Call here because you it's no matter what the case
AntiBan;
wait((rate*1000)+Random(5000));
until InvFull or TimeFromMark(Timer) > 100000 + random(50000);
In ToTree, you should really check if that point far away from the symbol is on the MM before clicking:
MMouse(x-50,y+30,7,5);
GetMousePos(x,y);
if(Rs_OnMiniMap(x,y))then
Mouse(x,y,0,0,true);
In ToBank, don't look for the symbol twice:
If FindSymbol(x, y, 'Bank') then
begin
WriteLn('Bank Symbol Found');
WriteLn('Walking To bank');
//FindSymbol(x, y, 'Bank'); //Take this out
//FFlag(2); //Why is this here too?
mouse(x,y,4,4,true);
FFlag(1);
end else
Try using a Tolerance radial walk in your fail safe below (for RockColour).
repeat
OpenBankQuiet('db');
InPin(Players[CurrentPlayer].Pin);
until FindDTM(BankDTM, x, y, MSX1, MSY1, MSX2, MSY2)
Fail safe here. What if it never finds the BankDTM?
Add a few things to your main loop:
begin
SetupSRL;
ActivateClient;
IntroText;
DeclarePlayers;
If(not(loggedin)) then loginplayer; //Moved to above the repeat/until
Repeat
ToTree;
ChooseArray;
ChopTree;
ToBank;
DepositItem;
SwitchPlayer;
TakeABreak;
if(not(LoggedIn))then NextPlayer(False); //For multi player
until Banked = LoadsToDo;
Logout;
end.
This really is a great first script. It's almost as good as my members app… Lol. Just keep reading up on tutorials, look at other people's scripts for learning purposes, and keep working on ways to make the script more efficient. I'm sure that you can get into very soon members if you work hard.
Good luck!
~JAD