All pastes #740980 Raw Edit

Mine

public text v1 · immutable
·published 2007-10-18 11:32 UTC
rendered paste body
{.include SRL/SRL.scar}
const
  Treecolour = 2969159;
  Treecolour1 = 2969159;
  Treecolour2 = 2969159;
var

  RockColor, Mask, x, y: Integer;
  RockDTM: integer;

procedure SetupGlobalColors;
begin
  RockColor := 5593948;
end;

procedure SetRockDTM;
var DTMSubPoints: array[0..2] of TDTMPointDef;
var CGMainPoint: TDTMPointDef;
var RockTDTM: TDTM;
begin

  CGMainPoint.x := 642; // Centre Of Rock Formation
  CGMainPoint.y := 54;
  CGMainPoint.areasize := 1;
  CGMainPoint.areashape := 0;
  CGMainPoint.color := 0;
  CGMainPoint.tolerance := 255; // Any Color

  DTMSubPoints[0].x := 662;
  DTMSubPoints[0].y := 13;
  DTMSubPoints[0].areasize := 1;
  DTMSubPoints[0].areashape := 0;
  DTMSubPoints[0].color := RockColor;
  DTMSubPoints[0].tolerance := 1;

  DTMSubPoints[1].x := 623;
  DTMSubPoints[1].y := 30;
  DTMSubPoints[1].areasize := 1;
  DTMSubPoints[1].areashape := 0;
  DTMSubPoints[1].color := RockColor;
  DTMSubPoints[1].tolerance := 1;

  DTMSubPoints[2].x := 628;
  DTMSubPoints[2].y := 37;
  DTMSubPoints[2].areasize := 1;
  DTMSubPoints[2].areashape := 0;
  DTMSubPoints[2].color := RockColor;
  DTMSubPoints[2].tolerance := 1;

  RockTDTM.MainPoint := CGMainPoint;
  RockTDTM.SubPoints := DTMSubPoints;
  RockDTM := AddDTM(RockTDTM);
end;

procedure EntFinder; // Thanks to YoHoJo.
var
  EX, EY: integer;
  FX, FY: integer;
  SafeEntWait: LongInt;
begin
  if (not (LoggedIn)) then
  begin
    Nextplayer(false);
  end;
  begin
    Status('Checking For Ent')
      if
      (FindObjCustom(EX, EY, ['Tree', 'Willow', 'Oak'], [4690821], 5)) then
    begin
      MMouse(EX, EY, 0, 0)
        if FindColorTolerance(FX, FY, 55769, 85, 15, 115, 15, 20) then
      begin
        Status('Ent Found');
        MouseFindFlag(645, 83, 2, 2);
        MarkTime(SafeEntWait)
          repeat
          FTWait(5)
            FindNormalRandoms;
          if not (LoggedIn) then
            NextPlayer(False);
        until TimeFromMark(SafeEntWait) > 29000 + Random(10000)

      end;
    end;
  end;
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;
  Wait(20)
    FindTalk;
  FTWait(3)
    EntFinder;
  if (FindFight) then
  begin
    RunAwayDirection('North');
    Wait(8000 + Random(2000));
    RunBack;
  end;
  Wait(20)
    FindTalk;
end;


procedure FindIt;
begin
  if (FindDTM(RockDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
  begin
    MouseFindFlag(x + 20, y + 10, 2, 2);
    Writeln('lol');
    FFlag(30);
    Exit;
  end;

  Writeln('DTM Not Found, using the fish symbol.');
  if FindSymbol(x, y, 'fish') then
  begin
    mouse(x, y + 20, 6, 6, true);
    writeln('yay found fish.');
    FFlag(30);
  end;
end;

function UpdateCoords(var cx, cy: Integer; ax, ay, TheColor, Tol: Integer): Boolean;
var
  //ax, ay,
  Counter: Integer;
begin

  //GetMousePos(ax, ay);
  if (ax < 20) then ax := 20; if (ay < 20) then ay := 20;
  while (FlagPresent) and (FindColorSpiralTolerance(cx, cy, TheColor, ax - 20, ay - 20, ax + 20, ay + 20, Tol)) do
  begin
    ax := cx; ay := cy;
    Wait(10);
  end;
  if (ax < 10) then ax := 10; if (ay < 10) then ay := 10;
  while (FindColorSpiralTolerance(cx, cy, TheColor, ax - 10, ay - 10, ax + 10, ay + 10, Tol)) and (Counter < 100) do
  begin
    ax := cx; ay := cy;
    Counter := Counter + 1;
    Wait(10);
  end;
  Result := FindColorSpiralTolerance(cx, cy, TheColor, ax - 10, ay - 10, ax + 10, ay + 10, Tol);
  if (not Result) then

  else

end;

{ ---------------------------------------------------------------------------- ]
[  >>  Part of Woodcutting                                                     ]
[  >>  Function StartChopping(Click: Boolean): Boolean;                        ]
[  >>  Starts Cutting the Tree, Returning a Boolean                            ]
[ ---------------------------------------------------------------------------- }

function StartChopping(var cx, cy, TreeColor: Integer; Click: Boolean): Boolean;
begin
  if not (LoggedIn) then Exit;



  while not (FindColorSpiralTolerance(cx, cy, TreeColour, MSX1, MSY1, MSX2, MSY2, 5)) do
  begin
    if not (Loggedin) then Exit;
    Wait(100);
  end;

  repeat
    if not (LoggedIn) then Exit;
    if FindColorSpiralTolerance(x, y, TreeColour, MSX1, MSY1, MSX2, MSY2, 5) or
      FindColorSpiralTolerance(x, y, TreeColour1, MSX1, MSY1, MSX2, MSY2, 5) or
      FindColorSpiralTolerance(x, y, TreeColour2, MSX1, MSY1, MSX2, MSY2, 5) then
      MMouse(x, y, 1, 1);
    if IsUpText('Willow') then
    begin
      GetMousePos(x, y);
      TreeColor := GetColor(x, y);
      if (Click) then
      begin
        if (Random(5) = 0) then
        begin
          Mouse(x, y, 0, 0, False);
          Wait(100 + Random(100));
          ChooseOption('Chop');
        end else
          Mouse(x, y, 0, 0, True);
      end else
        MMouse(x, y, 0, 0);
      Result := True;
    end;
    Wait(100 + Random(100));
  until (Result = True)
end;

procedure Chopping;
var
  cx, cy, Counter, CountUntil, Current, Mark, TreeColor: Integer;
begin
  repeat
    if StartChopping(cx, cy, TreeColor, True) then
    begin
      if UpdateCoords(x, y, cx, cy, TreeColor, 10) then
        MMouse(x, y, 0, 0) //MMouse(cx, cy, 0, 0)
      else
      begin
        Flag;
        Wait(400 + Random(200));
        StartChopping(x, y, TreeColor, False)
      end;
      Current := InvCount;
      MarkTime(Mark);
      CountUntil := 64 + Random(20);
      Counter := 0;

      if not (LoggedIn) then Exit;
      EntFinder;


      if (TimeFromMark(Mark) >= 20 * 1000) and (Current = InvCount) then
        Break
      else
      begin
        Current := InvCount;
        MarkTime(Mark);
      end;
      Wait(10);
      EntFinder;
    end;

  until not (IsUpText('Willow')) or (Invfull)


end;

{
procedure Cut;
begin
repeat
if FindColorSpiralTolerance(x, y, TreeColour, MSX1, MSY1, MSX2, MSY2, 5)or
FindColorSpiralTolerance(x, y, TreeColour1, MSX1, MSY1, MSX2, MSY2, 5)or
FindColorSpiralTolerance(x, y, TreeColour2, MSX1, MSY1, MSX2, MSY2, 5)then
MMouse(x,y,1,1);
if IsUpText('Willow') then
begin
Mouse(x,y,1,1,true);
end;
Until(Invfull);
end;
}

procedure Bank;
begin
  if FindSymbol(x, y, 'bank') then
  begin
    mouse(x, y, 1, 1, true);
    writeln('yay');
    FFlag(0);
  end else
    writeln('symbol false, using fish symbol.');
end;

function OpenBank31: Boolean;
var
  x, y, fs, fs2: Integer;
begin
  Status('Banking');
  if not BankScreen then
    repeat
      if (FindObj(x, y, 'Use Bank', 4870227, 10)) then
        Mouse(x, y, 4, 4, False)
      else
        if (FindObj(x, y, 'Use Bank', 2578028, 10)) then
          Mouse(x, y, 4, 4, False)
        else
          if (FindObj(x, y, 'Use Bank', 5462367, 10)) then
            Mouse(x, y, 4, 4, False);
      Wait(250);
      if (ChooseOption('quickly')) then
      begin
        Flag;
        repeat
          Wait(100);
          fs := fs + 1;
        until (BankScreen) or (fs >= 50);
      end;
      fs2 := fs2 + 1;
    until (BankScreen) or (fs2 > 5);
  if BankScreen then Result := True;
  wait(200);
  FixBank;
  Deposit(2, 28, 2);
  CloseBank;
end;

begin
  SetupSRL;
  ActivateClient;
  SetupGlobalColors;

    FindIt;
    repeat
      Chopping;
      EntFinder;
    until (invfull);
    if Invfull then

      Bank;
      OpenBank31;
    end;
  until (false);
end.