Your DeclarePlayers and some global variables that are used for options can be shortened and "Tidied" with this:
Simba Code:
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:
Simba Code:
findcolortolerance(x,y,2438653,MSX1,MSY1,MSX2,MSY2,15);
That should be (And every other thing you have this way):
Simba Code:
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:
Simba Code:
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:
Simba Code:
// 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;