Code:
program choppernbanker; // always give a program name
{.include /SRL/SRL.scar}
{.include /SRL/SRL/skill/WoodCutting.scar}
var
x, y, i2, watercolor2:integer; //i'd switch i2 to h for example
const
WillowColorA = 2319190; //these are better as constables, because they don't change,
WillowColorB = 2319190; // we only put things as variables when we intend to make them
WillowColorC = 1791306; // change during the script
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Loc := '';
Players[0].Active := True;
Players[0].Integers[1] := 0;
Players[0].Integers[2] := 30; //Loads to do before switching players
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
// why did u have the wilow colors in declare players?
end;
function AllPlayersInactive(number : integer) : boolean;
var
thisi : integer;
thisi2 : integer;
begin;
thisi := 0;
thisi2 := 0;
for thisi := 0 to number do
begin;
if(Players[thisi].Active = True) then
begin;
Result:=False;
end else
begin;
thisi2:= thisi2 +1;
if(thisi2=number) then result:=true;
end;
end;
end;
procedure Proggy;
begin;
writeln('Player: ' + Players[CurrentPlayer].name);
writeln('Chopped approximately: ' + inttostr(Players[CurrentPlayer].Integers[1]) + ' willows');
end;
function FindFastRandoms: Boolean; //By WT-Fakawi.
var
i: Integer;
begin
for i := 1 to 8 do
begin
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
wait(1);
end;
end;
procedure FindRandoms;
begin;
if not loggedin then exit;
FindFastRandoms;
FindNormalRandoms;
end;
procedure Chop;
begin;
if not loggedin then exit;
if findcolor(x,y,WillowcolorA,0,0,1400,1400) or
findcolor(x,y,willowcolorB,0,0,1400,1400) or
findcolor(x,y,willowcolorC,0,0,1400,1400) then
begin //you have begin; here, usually we only put begin without the ";"
disguise('Chopping...')
MMouse(x,y,3,3);
if isuptext('hop') then
begin;
GetMousePos(x,y);
Mouse(x,y,0,0,true);
Flag; //when you use flag it'll wait until the flag is gone,
wait(4000 + random(1000)); // i guess this wait is to give it time to chop?
end else
begin;
i2 := 0;
while(i2 < 39) do
begin
if findcolortolerance(x,y,WillowcolorA,0,0,1400,1400,25) or
findcolortolerance(x,y,willowcolorB,0,0,1400,1400,25) or
findcolortolerance(x,y,willowcolorC,0,0,1400,1400,25) then
begin
MMouse(x,y,1,1);
if isuptext('hop') then
begin;
GetMousePos(x,y);
Mouse(x,y,0,0,true);
Flag;
end;
end else
wait(4000 + random(1000));
end;
end;
end else
i2 := i2 + 1;
if(i2 = 39) then
begin;
Players[currentplayer].loc := 'lost';
Players[currentplayer].active := False;
nextplayer(Players[currentplayer].active);
{you had next player (true) here, that means it'd get lost
but it would still try to play again next time. nextplayer(true) means
that the current player will be left to true.
next player false means that you'll switch to next player but that this
one will be left false. and you should only switch the player at the end
of the cycle in the mainloop, so that the next player doesn't start in
this programming loop, looking for the trees.
}
end; .
end;
procedure ToBank;
begin;
if not LoggedIn then exit;
disguise('Going to bank');
findsymbol(x,y,'bank');
Mouse(x,y,1,1,true);
Flag;
end;
procedure ToWillow;
begin;
if not loggedin then exit;
wait(1000 + random(50))
makecompass('E');
disguise('Going to willow')
HighestAngle;
watercolor2:=FindWaterColor;
if(findcolor(x,y,watercolor2,0,0,1400,1400)) then
begin;
wait(2000 + random(100));
mouse(x,y,1,1,true);
wait(100 + random(100)); //the fish symbol will constantly be changing place,
Flag; // do not rely too much on this, although it does work
MakeCompass('E'); // most the time. for other symbols like bank it might
FindSymbol(x,y,'fish'); // totally screw up your script, like it may click the bank script
Mouse(x,y,1,1,true) // and actually go to a wall on the outside part of the bank
Flag;
end else
begin;
writeln('Cant find watercolor. Next Player.');
Players[currentplayer].loc := 'lost';
Players[currentplayer].active := 'False';
NextPlayer(False); //same mistake as before, this should be in the mainloop, and false, not true
end;
end;
procedure BankWillows;
begin;
if not loggedin then exit;
disguise('Starting banking procedure')
if(invFull) then
begin;
ToBank;
Disguise('Opening bank and banking.')
OpenBankQuiet('db');
DepositAll;
MakeCompass('E');
Players[currentplayer].Integers[1] := Players[currentplayer].Integers[1] + 1;
if(Players[currentplayer].Integers[1] >= Players[currentplayer].Integers[2]) then
begin;
Proggy; // this should not be false,
Players[currentplayer].Active := False; // it should be true, because that way,
nextplayer(true); //when all the other players have done
//their loads, it can always come back to this
end; //one and keep on going forever
end;
end;
//mainloop
begin
SetupSRL;
MouseSpeed:=10; // SetupSRL already sets the mousespeed
DeclarePlayers;
wait(1000 + random(50)); // why wait here?
ActivateClient;
if not LoggedIn then LoginPlayer;
repeat
MakeCompass('E');
ToWillow;
FindRandoms;
repeat
if findcolor(x,y,WillowcolorA,0,0,1400,1400) or
findcolor(x,y,willowcolorB,0,0,1400,1400) or
findcolor(x,y,willowcolorC,0,0,1400,1400) then
begin;
MMouse(x,y,1,1);
FindEnt(x,y,true)
end;
Chop;
FindRandoms;
until(invFull)
FindRandoms;
BankWillows;
until(AllPlayersInactive(1))
end.
{your FindRandoms should also be inside the chopping procedure,
because while you're chopping is when it's most likely to get a random
~RMagician
}