Position Recognition/Walking:Now we are getting to the better stuff.
We need to know how to get tiles now right? Well the answer is GetMyPos, which assigns the tile you are on as a TPoint.
A good procedure to write your point to a debug box would be.
procedure writepos;
var
myposition: TPoint;
begin
MyPosition := GetMyPos;
writeln('Our tile is: '+inttostr(MyPosition.x)+','+inttostr(MyPosition.y));
end;
Ok. So lets say you are making a Catherby docks fisher, and you want to make sure you are near the docks, And you just got your point you want from above. Well we should use TileOnMM.
//Lets say the point of the position of where we want to be is 3032,3420
procedure checkposition;
var
atdocks : boolean
begin
if(TileOnMM(3032,3420))then
begin
atdocks := true;
end;
if(atdocks)then
begin
writeln('We are at the docks. We do not have to kill anyone for today');
end else
writeln('Not at docks. Time to let the mob do its thing.');
end;
Checking if in a perimeter:Pretty much we want to start at the top left of the perimeter and mark the point, then the bottom right and mark the point.
Then we want to check if our point is in the perimeter. Usage:
// lets say 1010,2020 = top left and 3030,4040 = bottom right.
procedure WriteIfInBank;
PlayerPosition : Tpoint;
begin
PlayerPosition := GetMyPos;
if PointInBox(PlayerPosition , IntToBox(1010,2020, 3030,4040)) then
begin
writeln('You are in the bank!');
end;
end;
The Walking:Walking is good for well, walking. We are going to make a fake death walker.
We should learn about WalkToTile.
WalkToTile will do what it says, walk to the specified tile. An example:
//Lets Say 5555,6666 is a tile in draynor bank.
Procedure WalkInBank;
var
banktile: TPoint;
begin
BankTile := Point(5555,6666)
WalkToTile(BankTile, 2, 1); //2 is the randomness of tiles, 1 is flagd. (I would suggest to keep at 1).
end;
Creating Paths:Its best to declare them as a result of a function. An example.
function DeathWalkPath:TPointArray;
begin
setlength(result,4); // 4 = (scar counts from 0) (logic is 0, 1, 2, 3)
result[0] := point(0001,1000);
result[1] := point(0002,2000);
result[2] := point(0003,3000);
result[3] := point(0004,4000);
end;
Now Lets make it do a deathwalk.
//Lets say it checked if we were in a perimeter like we did earlier. (and that procedure made a variable called InLumbyCastle.
Procedure DeathWalk;
begin
If(Not(InLumbyCastle))then
exit;
For I := 0 to High(DeathWalkPath) do
Begin
If(WalkToTile(DeathWalkPath[I], 2, 1))Then
R_Flag;
Flag;
R_FindRandoms;
FindNormalRandoms;
Wait(550+Random(300));
end;
end;
Objects:UID's
UID = Record
objType: Integer;
UID: Long;
End;
Breaking it down:OBJType - The I.D of an object. Mostly used for Identifying things on screen.
UId - Not sure really.
Useful FunctionsGetObjectAt(TileX, TileY: Integer)Procedure TellObjectAtTile(Tileof:Tpoint);
MyObject: UID;
begin
MyObject := GetObjectAt(Tileof.x,Tileof.y);
writeln('The Objects I.D is: '+inttostr(MyObject.objType));
end;
FindObject(Var Tile: TPoint; objType: Integer) - Declares the tile objects on to a tpoint;
Clicking an Object.
Procedure ClickABankBooth;
Var
BoothTile :TPoint;
begin // Lets pretend the bank booths I.D = 666.
If(FindObject(BoothTile, 666))then
begin
Writeln('Found a Booth, Clicking!');
BoothTile := TileToMS(BoothTile, Random(5));
mouse(BoothTile.x,BoothTile.y,2,2,True);
end;
end;
Ground Objects:Type
TGroundItem = Record
MS, Tile: TPoint;
ID, StackSize: Integer;
End;
Breaking it Down:Ms - MainScreen Point. Tile - The tile of the item. Id - The I.D of the Item. StackSize - The StackSize of the item.
Picking Up A Ground Object:If you don't know a Items Position:
Procedure PickupBones;
var
I : integer;
Items : TGroundItemArray;
ItemPos : TPoint;
begin // Lets say Reg Bones is 536
FindGroundItems(Items,[536],10);
//Your If your position is a certain length away, walk to tile stuff.
//^
for I := 0 to High(Items) do
begin
ItemPos := TileToMs(Items[I].Tile, Random(5));
Mouse(ItemPos.x, ItemPos.y,2,2,false);
wait(500+random(500));
R_ChooseOption('ake Bon');
end;
end;
If you do know a Items Position:
Procedure PickupRespawningRunes;
Var
Items : TPointArray;
TempPoint : TPoint;
PP : Integer;
begin
//Lets say the position of a respawning air rune is 3030,3021.
//Also, lets say 320 is an air rune id.
Items := GetGroundItems(3030,3021);
//Since Its a Tpoint. X = The I.D. Y = The Stack Size
for PP := 0 to High(ItemTempPoint) do
begin
If(Items[PP].x=320)then
begin
writeln('There are: ' +inttostr(Items[PP].y+' Air Runes at point'); // .y = Stack Size Remember?
//Your If certain length away, then walk stuff'
// ^^
TempPoint := TileToMs(Point(3030,3021),random(4));
Mouse(TempPoint.x,TempPoint.y,2,2,false);
wait(500+random(500));
R_ChooseOption('Take Air');
flag;
wait(2000+random(600));
end;
end;
end;
Interfaces:I like to use them for chat options.
Here's an example of……………………..
More will come later.
Post all suggestions