Heres a skeleton I made when I was going to make one, but I noticed there were way too many bots there already haha! Feel free to use it if anyone wants to, its just an outline really.
program new;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
var
DepositID, CollectID, VeinID, BankID, WheelOnID, WheelOffID: Integer;
VeinIDs: TIntegerArray;
DepositTile, CollectTile, MiningTile, BankTile, WheelTile: TPoint;
MiningArea, BankArea, DepositArea, CollectArea, WheelArea: TPointArray;
collectTime: boolean;
procedure setVars;
begin
VeinIDs := [];
VEINID := 0;
end;
procedure doObjectOffset(objtyp, xTile, yTile, xOffset, yOffset, objID: integer; uptext, option: String);
var
tp, tpp: tpoint;
chest : TRSObject;
begin
tp.x := xTile;
tp.y := yTile;
chest := R_GetObjectAt(objtyp, tp);
if (chest.id = objID) then
begin
if R_DistanceFromTile(chest.Tile) >= 5 then
begin
R_WalkToTileMM(chest.Tile);
while R_IsWalking do wait(1);
end;
tpp := R_tiletoms(chest.tile);
if not (PointInBox(tpp, IntToBox(MSX1, MSY1, MSX2, MSY2))) then
begin
R_RotateCameraToTile(chest.Tile);
tpp := R_tiletoms(chest.tile);
end;
Mmouse(Tpp.x + xOffset, Tpp.y + yOffset, 5, 5);
if R_WaitUptext(uptext, 200) then
begin
if R_IsUpText(option) then
ClickMouse2(Mouse_left)
else
begin
ClickMouse2(Mouse_right)
wait(200 + random(100));
R_ChooseOption(option);
end;
end;
while (R_IsWalking or R_isAnimating) do wait(1);
end;
end;
procedure doObject(objtyp, xTile, yTile, objID: integer; uptext, option: String);
begin
doObjectOffset(objtyp, xTile, yTile, 0, 0, objID, uptext, option);
end;
function R_ObjectInPolygon(obj: TRSObject; Area: TPointArray): Boolean;
var
xnew, ynew, xold, yold, x1, y1, x2, y2: Cardinal;
i, numpoints, inside, X, Y: Integer;
begin
numpoints := Length(Area);
X := obj.Tile.x;
Y := obj.Tile.y;
if (numpoints < 3) then
Exit;
xold := Area[numpoints - 1].X;
yold := Area[numpoints - 1].Y;
for i := 0 to (numpoints - 1) do
begin
xnew := Area[i].X;
ynew := Area[i].Y;
if (xnew > xold) then
begin
x1 := xold;
x2 := xnew;
y1 := yold;
y2 := ynew;
end
else
begin
x1 := xnew;
x2 := xold;
y1 := ynew;
y2 := yold;
end;
if (((xnew < X) = (X <= xold)) and ((Y - y1) * (x2 - x1) < (y2 - y1) * (X - x1))) then
inside := not inside;
xold := xnew;
yold := ynew;
end;
Result := inside <> 0;
end;
//slightly modified to find multiple object ids
function R_FindObjectsDistance(var TheObj: TRSObject; IDs: TIntegerArray; ObjType, Distance: integer): Boolean;
var
BaseX, BaseY, X, Y, i: integer;
Position: TPoint;
Locations: TpointArray;
Temp: TRSObject;
temp1:TRSObjectArray;
begin
BaseX := SmartGetFieldInt(SmartCurrentTarget, 0, client_baseX) * client_baseX_Multiplier;
BaseY := SmartGetFieldInt(SmartCurrentTarget, 0, client_baseY) * client_baseY_Multiplier;
Position := R_GetTileGlobal;
Position := Point(Position.X - BaseX, Position.Y - BaseY);
Distance := Round(Distance / 2);
for X := Position.X - Distance to Position.X + Distance do begin
for Y := Position.Y - Distance to Position.Y + Distance do begin
Temp := R_GetObjectAt(ObjType, Point(BaseX + X, BaseY + Y));
if (Temp.Tile = Point(0, 0)) or (not (InLocalArray(IDs, Temp.ID))) then
continue;
SetLength(temp1, Length(temp1) + 1);
temp1[i] := Temp;
SetLength(Locations, Length(Locations) + 1);
Locations[i] := Temp.Tile;
inc(i);
end;
end;
Result := Length(Temp1) > 0;
if Result then
begin
SortTpaFrom(Locations, R_GetTileGlobal);
TheObj := Temp1[0];
end;
end;
function R_SortObjs(Objs: TRSObjectArray): TRSObjectArray;
var
i,i2, L: integer;
tpa: TPointArray;
begin
L := GetArrayLength(Objs);
if L < 1 then begin;
Result := Objs;
exit;
end;
SetArrayLength(TPA, L);
SetArrayLength(Result, L);
for i := 0 to L-1 do
TPA[i] := Objs[i].Tile;
SortTPAFrom(TPA, R_GetTileGlobal);
for i := 0 to L-1 do
for i2 := 0 to L-1 do
if (TPA[i].x=Objs[i2].Tile.x) and (TPA[i].y=Objs[i2].Tile.y) then
Result[i] := Objs[i2];
end;
function _bankscreen: boolean;
var
bankDTM, x, y : integer;
begin
bankDTM := DTMFromString('mggAAAHicY2NgYHjGyMDwCIpfAfELIH4KxBpAORUg1oViVSDWYwABRgwc6WvJgA3oYlUNwRAAAAj+B34=');
Result := FindDTM(bankDTM, x, y, 475, 12, 498, 34);
FreeDTM(bankDTM);
end;
procedure bankChest;
begin
doObject(OBJ_GAME, BankTile.X, BankTile.Y, BankID, 'Bank', 'Bank');
if (_bankScreen) then
Deposit(1, 27, true); //bank items
end;
function reached3Loads: boolean;
begin
Result := FindBlackChatMessage('I dont know what it says when its full'); //or counter = 3
end;
function wheelON: boolean;
var
hwheel: TRSObject;
begin
hwheel := R_GetObjectAt(OBJ_GAME, WheelTile);
Result := (hwheel.ID = WheelOnID);
end;
procedure fixWheel;
begin
doObject(OBJ_GAME, WheelTile.x, WheelTile.y, WheelOffID, 'Fix', 'Fix');
end;
procedure collect;
begin
doObject(OBJ_GAME, collectTIle.x, collectTile.y, CollectID, 'Take-from', 'Take-from');
end;
procedure depositOresIntoThing;
begin
doObject(OBJ_GAME, DepositTile.x, DepositTile.y, DepositID, 'Deposit', 'Deposit');
end;
procedure doMining;
var
i: integer;
veins: TRSObjectArray;
begin
if (R_IsAnimating or R_IsWalking) then exit;
veins := R_SortObjs(R_GetObjectsDistance(OBJ_BOUNDARY, 15));
for i := 0 to High(veins) do
begin
if (veins[i].ID = VEINID) and (R_ObjectInPolygon(veins[i], MiningArea)) then
begin
doObjectOffset(OBJ_BOUNDARY, veins[i].Tile.x, veins[i].Tile.y, 0, 0, veins[i].ID, 'Mine', 'Mine');
exit;
end;
end;
end;
procedure walking(which: integer);
begin
{case(which) of
2: //bank to collection box
3: //bank to mining
4: //collection box to bank
7: //deposit to wheel
8: //deposit to collection box
9: //deposit to mining
11://wheel to collection box
12://wheel to mining
13://mining to deposit
end;}
end;
function getState: integer;
begin
if (R_InPolygon(BankArea)) then
begin
if (R_InvFull) then //bank it
Result := 1
else if (collectTime) then //go collect more
Result := 2
else
Result := 3; //back to mining
exit;
end;
if (R_InPolygon(CollectArea)) then
begin
if (R_InvFull) then //walk to bank chest
Result := 4
else
Result := 5; //collect ores from box
exit;
end;
if (R_InPolygon(DepositArea)) then
begin
if (R_InvFull) then //check if wheel works, deposit into box
Result := 6
else if (not wheelOn) then //fix wheel if broken
Result := 7
else if (reached3Loads) then
Result := 8 //gather from the box
else
Result := 9; //back to mining
exit;
end;
if (R_InPolygon(WheelArea)) then
begin
if (not wheelOn) then
Result := 10 //fix the wheel
else if (reached3Loads) then
Result := 11 //gather from the box
else
Result := 12; //back to mining
exit;
end;
if (R_InPolygon(MiningArea)) then
begin
if (R_InvFull) then
Result := 13 //to the deposit box!
else
Result := 14; //do mining
exit;
end;
end;
procedure loop;
begin
{case(getState) of
1: bankChest;
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
end;}
end;
begin
setupsrl;
SetupReflection;
mousespeed := 14;
repeat
doMining;
until(false);
end.