Cstrike
2010-11-06 18:54:57
I looked through the MSI reflection walking. I'm not exactly sure how the MSI one works since it branches into gathering data from other locations or player input… but for this, if the person inputs a TileArray (or a TPA, it accepts either and works with either– I tested it), it will walk to the location unless there is an error.
It uses the principle behind Drags111's walker, where it will keep walking between points with the failsafes of checking to see whether the character walks or not to look human. Randomess is also specified by players. It does not rely off of WalkToTile (the reflection include, not the MSI one), because the reflection WalkToTile occasionally is buggy and messes up.
In addition, there is space inside of it that you could call a TProcedure argument in the function input to call your own functions inside. This would allow it to check for the pesky " >60 level " interface that crops up for lower level characters.
It is also compatible with MSI_WalktoTile.
What do you think? Criticisms always welcome. I won't be offended if it's rejected ;), I just made it to see what you guys would think.
EDIT: Yes I've tested it, no I have not tested it with lag or anything that causes it to fail, it's always worked for me thus far.
It uses the principle behind Drags111's walker, where it will keep walking between points with the failsafes of checking to see whether the character walks or not to look human. Randomess is also specified by players. It does not rely off of WalkToTile (the reflection include, not the MSI one), because the reflection WalkToTile occasionally is buggy and messes up.
In addition, there is space inside of it that you could call a TProcedure argument in the function input to call your own functions inside. This would allow it to check for the pesky " >60 level " interface that crops up for lower level characters.
It is also compatible with MSI_WalktoTile.
{******************************************************************************}
{ function MSI_WalkPath (TileArray : TTileArray; MouseRandomness, TimeoutMS : Integer) : Boolean; }
{ By: Cstrike }
{ Date: 06 November 2010 }
{ Description: Walks a defined path, returns true if target reached. The }
{ randomness is in pixels, not tiles. TimeoutMS is in milliseconds. }
{******************************************************************************}
function MSI_WalkPath (TileArray : TTileArray; MouseRandomness, TimeoutMS : Integer) : Boolean;
var
i, j, t, indexPosStart, failCount : Integer;
TP : TPoint;
begin
//if not LoggedIn then Exit; // Do you guys use this?
Result := False;
if high(TileArray) < 0 then Exit;
// If we are within 4 tiles from our target destination, then 1) true 2) exit
if DistanceFrom (TileArray[high(TileArray)]) < 5 then
begin
Result := True;
Exit;
end;
// Find tile on MM from top of the array to the bottom:
indexPosStart := -1; // Failsafe
for i := high(TileArray) downto low(TileArray) do
begin
if TileOnMM (TileArray[i]) then
begin
indexPosStart := i;
Break;
end;
end;
// If we don't find anything on the minimap, exit [will return false]
if indexPosStart = -1 then Exit;
// Start walking from that tile, and complete the path
failCount := 0;
for j := indexPosStart to high(TileArray) do
begin
// "Click the tile that is on the mainscreen" section
if TileOnMM (TileArray[j]) then
begin
TP := TileToMM (TileArray[j]);
Mouse (TP.x, TP.y, MouseRandomness, MouseRandomness, true);
end;
// "Now that we clicked, make sure we move... if we don't we are stuck" section
MarkTime(t);
repeat
wait (50);
//MSI_FindRandoms;
//Any other procedures here that you want?
until (CharacterMoving) or (TimeFromMark(t) > TimeoutMS)
// If we timed out, increase failcount
if (TimeFromMark(t) > TimeoutMS) then
begin
Inc(failCount);
Writeln ('MSI_WalkPath failed to sense character moving [Failcount = '+IntToStr(failCount)+'/3]');
end;
// If failcount is 3 or more, return false and exit
if failCount > 2 then
begin
Writeln ('MSI_WalkPath failed.');
Exit;
end;
// "Now that we are supposed to be moving, wait until we stop moving" section
MarkTime(t);
repeat
wait (50);
//MSI_FindRandoms;
//Any other procedures here that you want while walking?
if j < high(TileArray) then // So we don't try and find anything higher than the max array index
if (TileOnMM (TileArray[j+1])) then Break; // If tile is on minimap, click it
until (not CharacterMoving) or (TimeFromMark(t) > TimeoutMS)
// If we timed out, increase failcount
if (TimeFromMark(t) > TimeoutMS) then
begin
Inc(failCount);
Writeln ('MSI_WalkPath failed to sense character moving [Failcount = '+IntToStr(failCount)+'/3]');
end;
// If failcount is 3 or more, return false and exit
if failCount > 2 then
begin
Writeln ('MSI_WalkPath failed.');
Exit;
end;
wait (400+random(500)); // Act random
end;
// If we got to the end of the path, result = true
if DistanceFrom (TileArray[high(TileArray)]) < 7 then Result := True;
end; What do you think? Criticisms always welcome. I won't be offended if it's rejected ;), I just made it to see what you guys would think.
EDIT: Yes I've tested it, no I have not tested it with lag or anything that causes it to fail, it's always worked for me thus far.