Simple script for mining ore

Basic example of ore mining. The script searches for closest deposits, approaches them in a straight line, and applies the first available skill to them.

uses SysUtils, Classes;

procedure MinerThread(); 
var Deposit: TDoodad;
begin
  Print('MinerThread started ...');
  while Delay(1000) do begin
    if (Status = lsOnline) then begin
      Deposit:= GetClosestDeposit();
      if Assigned(Deposit) and (Deposit.Valid) then begin
        Print(Format(
          '%s [id: %d; phase: %d] | Dist: %n | Action: %s [id: %d]',
          [Deposit.Name, Deposit.ID, Deposit.PhaseID, User.DistTo(Deposit), Deposit.Action(1), Deposit.ActionID(1)]
        ));
        Engine.MoveToObj(Deposit, 2);
        if Engine.UseDoodadSkill(Deposit.ActionID(1), Deposit) then
          while (User.Cast.EndTime <> 0) do Delay(100)
      end;
    end;
  end; 
end;


function GetClosestDeposit(MaxDist: Single = 30.0): TDoodad;
var
  i: Integer;
  Doodad: TDoodad;
begin
  Result:= nil;
  for i:= 0 to Doodads.Count-1 do begin
    Doodad:= Doodads(i);
    if (Doodad.ID <> 1671) or (Doodad.PhaseID = 17070) then Continue;
    if (User.DistTo(Doodad) < MaxDist) and (Doodad.ID = 1671) then begin
      MaxDist:= User.DistTo(Doodad);
      Result:= Doodad;
    end;
  end;
end;

begin
  Engine.SetGameWindow(True);
  Script.NewThread(@MinerThread);
  //...
  Delay(-1);
end.

ArcheAngel Bot classes structure
  • Classes
    • TGameControl
    • TPaxEngine
    • TGameObject
      • TItem
        • TAucItem
      • TZoneItem
      • TSpawn
        • TLive
          • TNpc
            • TMount
          • TDoodad
          • TPlayer
            • TUser
      • TMailItem
      • TEffect
        • TBuff
        • TSkill
          • TCast
    • TGameList
      • TSpawnList
        • TPlayers
        • TMobs
        • TMounts
        • TDoodads
        • TNpcs
      • TInventory
      • TSkills
      • TSlotList
      • TZoneList
      • TBuffs
      • TMail
      • TAuction
    • TChatMessage
    • TAccount
    • TAccounts
    • THistoryMessage
    • TMessages