SRL Archive - Test corner

Development on Camaro's Walking


Sir R. M8gic1an

2011-02-11 09:27:00

Camaro's walking is basically this:


type
TWalkPoint = record;
x, y: integer;
Color: integer;

Tol: integer;
hsl: cts2mode;
end;

//A TWalkDTM is
TWalkDTM: Array of TWalkPoint;

~RM

Nava2

2011-02-11 09:32:35

OK.

MylesMadness

2011-02-11 09:44:10

From: Nava2
OK.
Lol'd

Wizzup?

2011-02-11 11:43:32

From: Sir R. M8gic1an
Camaro's walking is basically this:


type
TWalkPoint = record;
x, y: integer;
Color: integer;

Tol: integer;
hsl: cts2mode;
end;

//A TWalkDTM is
TWalkDTM: Array of TWalkPoint;

~RM


So it's basically a DTM?

Sir R. M8gic1an

2011-02-11 12:23:18

From: Wizzup?
So it's basically a DTM?


Could be. Well yeh, it is, but people aren't used to TDTMs, and this is just work on those ;)

~RM

Gu3st...

2011-02-11 12:26:22

And?

Sir R. M8gic1an

2011-02-11 13:08:55

From: Zyt3x
And?


And I've posted my walking development ideas long time ago, that's all.

And now I've just added a lil line of code. And when I get around to scripting I'll work on this too.

~RM

Wanted

2011-02-12 01:42:35

I don't get it.

What are we supposed to take in from this thread?

I'm missing the purpose here.

Gu3st...

2011-02-12 06:52:57

From: IceFire908
I don't get it.

What are we supposed to take in from this thread?

I'm missing the purpose here.
Same.. I guess it's just yet another confusing post from RM's high or something.. :(

Sir R. M8gic1an

2011-02-12 07:00:23

No, there is nothing to take from this thread. I created this thread because I intend to work on walking. Why the hell do you guys go spamming my thread? Just leave it alone.

~RM

Gu3st...

2011-02-12 07:04:51

Why did you create the thread if it has no importance?
If you intend on doing some development, don't post a new thread about it; just make a new file on your computer / server / dropbox / whatever and work on it.

Sir R. M8gic1an

2011-02-12 07:05:32

Lol lil boy, don't go telling me what to do.

Sir R. M8gic1an

2011-02-12 07:07:29


TSymbol = record
Name : string;
color : integer;
tol : integer;
h, s : extended;
end;

TColorArea = record
color : integer;
tol : integer;
h, s : extended;
count : integer;
end;

TArea = record
Colors: array of TColorArea;
Symbols: array of TSymbol;
MinAccuracy: integer;
end;


Function FindSymbolTP(Which: TSymbol; var Where: TPoint): boolean;
var
TPA : TPointArray;
ATPA: T2DPointArray;
TBArr : TBoxArray;
i, h, t, waste, CTS: integer;
Hue, Sat: extended;
TIA: TIntegerArray;
Symb: TSymbol;
begin
RMRandoms(true);
if not FindColors(TPA, SYMBOL_OUTLINE, MMX1, MMY1, MMX2, MMY2) then
begin
srl_warn('FindSymbolThroughTPA', 'Could not find symbol', warn_AllVersions);
exit;
end;

ATPA := SplitTPA(TPA, 2);

t := 0;
h := High(ATPA);
SetLength(TIA, h + 1);
SetLength(TBArr, h + 1);

for i:= 0 to h do
begin
TBArr[i] := GetTPABounds(ATPA[i]);
if FindColor(waste, waste, SYMBOL_FILL, TBArr[i].x1, TBArr[i].y1, TBArr[i].x2, TBArr[i].y2) then
begin
TIA[t] := i;
Inc(t);
end;
end;

if (t = 0) then
begin
writeln('symbol_fill not found on any of the possible symbols');
Result := false;
exit;
end;

SetLength(TIA, t);
GetCTS(CTS, Hue, Sat);
SetCTS(2, which.h, which.s);

for i:= 0 to t-1 do
begin
h := TIA[i];
if FindColorsToleranceBox(TPA, which.color, which.tol, TBArr[h]) then
begin
Where := MiddleTPA(TPA);
Result := true;
break;
end;
end;

SetCTS(CTS, Hue, Sat);

if i = t then
writeln('Couldn''t find symbol colors: ' + which.Name);

end;

function AtSymbolArea(which: array of TSymbol; MinAcc: integer; var score: integer): boolean;
var
i, amount: integer;
TP: TPoint;
begin
for i:= High(which) DownTo 0 do
if FindSymbolTP(which[i], TP) then
inc(amount);


score := round(amount * 100 / (i + 1)); //to give a score/100

Result := score >= MinAcc;
end;

function AtColorArea(which: TColorArea; MinAcc: integer; var score: integer): boolean;
var
TPA: TPointArray;
L : integer;
begin
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(which.h, which.s);

FindColorsTolerance( TPA, which.color, MMX1, MMY1, MMX2, MMY2, which.tol);

L := Length(TPA);

score := round(Length(TPA) * 100 / which.count);

Result := score >= MinAcc;

end;

function AtArea(which: TArea): boolean;
var
TempScore,
i, ColorScore,
h, SymbolScore,
TotalScore: integer;
begin
with which do
for i := High(Colors) DownTo 0 do
if AtColorArea(Colors[i], MinAccuracy, TempScore then
IncEx(ColorScore, TempScore);

ColorScore := round(ColorScore * 100 / (i + 1));

AtSymbolArea(Symbols, which.MinAccuracy, SymbolScore);

TotalScore := round((ColorScore + SymbolScore) / 2);
//could use weights here

Result := TotalScore >= which.MinAccuracy;
end;

Thread's locked thanks to you.

~RM

Sir R. M8gic1an

2011-02-12 07:08:04


function BoxInBox(Box1, Box2: TBox; var BoxR: TBox): boolean;
begin
Result := false;

//checking if boxes overlap
if
not InRange(Box1.x1, Box2.x1, Box2.x2)
or
not InRange(Box1.x2, Box2.x1, Box2.x2)
then
exit;

if
not InRange(Box1.y1, Box2.y1, Box2.y2)
or
not InRange(Box1.y2, Box2.y1, Box2.y2)
then
exit;

Result := true;

//Getting resulting box
if Box1.x1 < Box2.x1 then
BoxR.x1 := Min(Box1.x2, Box2.x1)
else
BoxR.x1 := Min(Box2.x2, Box1.x1)

if Box1.y1 < Box2.y1 then
BoxR.y1 := Min(Box1.y2, Box2.y1)
else
BoxR.y1 := Min(Box2.y2, Box1.y1)

if Box1.x2 < Box2.x2 then
BoxR.x2 := Max(Box1.x2, Box2.x1)
else
BoxR.x2 := Max(Box2.x2, Box1.x1)

if Box1.y2 < Box2.y2 then
BoxR.y2 := Max(Box1.y2, Box2.y1)
else
BoxR.y2 := Max(Box2.y2, Box1.y1)

end;

~RM

Sir R. M8gic1an

2011-02-12 07:08:35


//Finds matching boxes between TPA1 and TPA2
function MatchTPAs(TPA1, TPA2: TPointArray; Split: (Break, Link); Dist: integer): TBoxArray;
var
i, h, mBox: integer;
ATPAs: array of T2DPointArray;
Boxes: array of TBoxArray;
SearchBox, FindBox: TBox;
MatchBox: TBox;
MatchBoxes : TBoxArray;
begin
SetLength(ATPAs, 2);

try

if Split = Break then
begin
ATPAs[0] := TPAToATPA(TPA1, dist);
ATPAs[1] := TPAToATPA(TPA2, dist);
end else begin
ATPAs[0] := SplitTPA(TPA1, dist);
ATPAs[1] := SplitTPA(TPA2, dist);
end;

except exit end;

for i := 1 DownTo 0 do
for h := High(ATPAs[i]) DownTo 0 do
Boxes[i][h] := GetTPABounds(ATPAs[i][h]);

for i := High(Boxes[0]) DownTo 0 do
begin
SearchBox := Boxes[0][i];
for h := High(Boxes[1]) DownTo 0 do
begin

FindBox := Boxes[1][h];
if BoxInBox(SearchBox, FindBox, MatchBox) then
begin
SetLength(MatchTPA, mBox + 1);
MatchBox[mBox] := MatchPoint;
Inc(mBox);
end;

end;
end;


end;

~RM

Sir R. M8gic1an

2011-02-12 07:10:11


//Colors: TIntegerArray that holds the colors of the 4*4 square

for i:= 0 to High(Colors) do
for h := 0 to High(Colors) do
if Colors[i] = Colors[h] then
Inc(TotalC[i]);

b := true;

while b do
begin
b := false;
for i:= 0 to High(TotalC) do
if TotalC[i] > Highest then
begin
HighColor := Colors[i];
b := true;
end;
end;

FindColorsTolerance(TPA, WorldMap, HighColor, Tol: 0);
TPAToATPAEx(TPA, 4, 4);
//make sure the TPA is split the right way to match the previous squares

for i:= 0 to High(ATPA) do
if not Length(ATPA) = Highest then
continue
else begin
//Match the rest of the colors
end;

~RM

Sir R. M8gic1an

2011-02-12 07:10:57

From: Feroc1ty
Had this idea a year or so back but gave up as I quit this community/runescape, here is what I had…

type path = record
node: TPointArray;
index: integer;
connection: array of integer;
end;

var paths:array of path;
curindex: integer;

function CreatePath(node:TPointArray):integer;
begin
SetArrayLength(paths, curindex+1);
paths[curindex].node := node;
paths[curindex].index := curindex;
result := curindex;
curindex := curindex + 1;
end;

procedure LinkPath(i,y:integer);
begin
SetArrayLength(paths[i].connection, GetArrayLength(paths[i].connection)+1);
paths[i].connection[High(paths[i].connection)] := paths[y].index;
end;

program Walk;

{.include paths.scar}
{.include llist.scar}

// Basic variables
var charx,chary, destx, desty:integer;
arrived: boolean;

function TPt(x,y:integer):TPoint;
begin
result.x := x;
result.y := y;
end;

// Basic math, used for path finding
function AngleBetweenPoints(x1,y1,x2,y2:integer):extended;
begin
result := Arctan2(y2-y1,x2-x1) * 180 / Pi;
if result < 0 then
result := Abs(result) + 180;
end;

// Test function, dupes move to function from reflection
function MoveTo(p:TPoint):boolean;
begin
if (charx = p.x) and (chary = p.y) then
begin
result := false;
exit;
end;
charx := p.x;
chary := p.y;
writeln('Moved to :' + inttostr(p.x) + ',' + inttostr(p.y));
result := true;
end;

// Required to create and link paths, might make the paths into an ini
// file that will update itself automatically, but this is a test version
procedure Initialize();
begin
CreatePath(path1());
CreatePath(path2());
CreatePath(path3());
CreatePath(path4());
CreatePath(path5());
LinkPath(0,1);
LinkPath(0,2);
LinkPath(0,4);
LinkPath(1,2);
LinkPath(1,3);
LinkPath(1,4);
LinkPath(2,3);
LinkPath(3,4);
end;

// Loops through all of the TPA's and checks which path has the closest average point
function FindClosestPath():integer;
var i:integer;
length: extended;
begin
length := 5000;
for i := 0 to high(paths) do
begin
if length > Distance(charx, chary, paths[i].avg.x, paths[i].avg.y) then
begin
length := Distance(charx, chary, paths[i].avg.x, paths[i].avg.y);
result := i;
end;
end;
end;

// Like previous function, but this one finds the closest point in an array
function FindClosestPointInTPA(arr:TPointArray):integer;
var i,y:integer;
z:extended;
begin
z := 5000;
for i := 0 to High(arr) do
begin
if z > Distance(charx, chary, arr[i].x, arr[i].y) then
begin
y := i;
z := Distance(charx, chary, arr[i].x, arr[i].y);
end;
end;
result := y;
end;

// Will move through the TPA, checking if it's at the destination yet, or if it finished going through the TPA
procedure AutoMoveThroughTPA(start,inc:integer; node:TPointArray);
var i:integer;
begin
i := start - inc;
repeat
i := i + inc;
if MoveTo(node[i]) = true then
wait(100);
if (node[i].x = destx) and (node[i].y = desty) then
begin
arrived := true;
exit;
end;
until (((i = 0) and (i <> start)) or ((i = high(node)) and (high(node) <> start)))
end;

// Will check if the path is accesable, because it might be only connected in the opposite side of a path
function Pathable(path:integer):boolean;
begin
result := false;
if Distance(charx, chary, paths[path].first.x, paths[path].first.y) < Distance(charx, chary, paths[path].last.x, paths[path].last.y)then
begin
if (charx = paths[path].first.x) and (chary = paths[path].first.y) then
result := true
end;
if Distance(charx, chary, paths[path].first.x, paths[path].first.y) > Distance(charx, chary, paths[path].last.x, paths[path].last.y)then
begin
if (charx = paths[path].last.x) and (chary = paths[path].last.y) then
result := true
end;
end;

// Since we don't know how the character will go through the path (increasing or decreasing) we call this function
procedure TakePath(path:integer);
begin
if Distance(charx, chary, paths[path].first.x, paths[path].first.y) < Distance(charx, chary, paths[path].last.x, paths[path].last.y) then
begin
AutoMoveThroughTPA(0, 1, paths[path].node)
end else
begin
AutoMoveThroughTPA(high(paths[path].node), -1, paths[path].node)
end;
end;

// Function that will find the farthest end of a path, takes path index
function FarthestEndX(path:integer):integer;
begin
if Distance(charx, chary, paths[path].first.x, paths[path].first.y) > Distance(charx, chary, paths[path].last.x, paths[path].last.y) then
result := paths[path].first.x
else
result := paths[path].last.x;
end;

// Function that will find the farthest end of a path, takes path index
function FarthestEndY(path:integer):integer;
begin
if Distance(charx, chary, paths[path].first.x, paths[path].first.y) > Distance(charx, chary, paths[path].last.x, paths[path].last.y) then
result := paths[path].first.y
else
result := paths[path].last.y;
end;

// Checks how far away are the angles
function DegreeDiff(A, B:extended):extended;
begin
result:= Abs(A-B);
if result>180.0 then
result:= 180.0-(result-180.0);
end;

// Dick and balls of the script, it gets the shit done
function move(x,y:integer):boolean;
var p, n, curpath, lastpath:integer;
c, cd: extended;
node: TPointArray;
begin
c := 360;
arrived := false;
destx := x;
desty := y;
lastpath := -1;
curpath := FindClosestPath;
node := paths[curpath].node;
p := FindClosestPointinTPA(paths[curpath].node);
cd := AngleBetweenPoints(charx, chary, x, y);
if (p <> 0) and (p <> high(paths[curpath].node)) then
begin
if DegreeDiff(cd,AngleBetweenPoints(charx, chary, node[p+1].x,node[p+1].y)) < DegreeDiff(cd,AngleBetweenPoints(charx, chary, node[p-1].x, node[p-1].y)) then
begin
AutoMoveThroughTPA(p+1, 1, node);
end else
begin
AutoMoveThroughTPA(p-1, -1, node);
end;
end;

while (arrived = false) do
begin
cd := AngleBetweenPoints(charx, chary, x, y);
for p := 0 to high(paths[curpath].connection) do
begin
if (c > DegreeDiff(cd, AngleBetweenPoints(FarthestEndX(paths[paths[curpath].connection[p]].index), FarthestEndY(paths[paths[curpath].connection[p]].index), x, y))) and (p <> lastpath) and (Pathable(paths[paths[curpath].connection[p]].index) = true) then
begin
c := AngleBetweenPoints(FarthestEndX(paths[paths[curpath].connection[p]].index), FarthestEndY(paths[paths[curpath].connection[p]].index), x, y);
n := p;
end;
end;
c := 360;
TakePath(paths[paths[curpath].connection[n]].index);
lastpath := curpath;
curpath := n;
end;
end;

begin
Initialize;
ClearDebug;
MoveTo(TPt(5,0));
Move(0,7);
end.


completely forgot about it didn't even look at it just copied and pasted what I had from ages ago lol


edit: I guess I had a different idea than urs, mine was to make many paths into an ini file, not any certain order or anything and link them used linked lists, than simply get characters location using reflection, find the closest path to the character, and get him moving until he hits the path, after that the script starts to move toward destination… i think i only got half way thru making it tho lol


~RM

Sir R. M8gic1an

2011-02-12 07:19:32


type
TArea = record;
color : integer;
tol : integer;
h, s : extended;
count : integer;
TPA: TPointArray;
end;

TElement = record;
TP : TPoint; // (where is the element)
color : integer;
tol: integer;
h, s: extended
end;


//thank boreas
type
TCircle = record
Center: TPoint
Radius: integer;
end;

function SortCirclesByRadius(Circles:TCircleArray): TCircleArray;
begin
//bubblesort should do if there aren't many circles
end;

{*******************************************************************************
function CircleTPA(cX, cY, r: Integer): TPointArray;
By: Nava2
Description: Creates a TPA of a circle with radius 'r' and center point cX, cY.
*******************************************************************************}
function CircleTPA(cX, cY, r: Integer): TPointArray;
var
i, j, l, tX, tY: Integer;
begin
setLength(Result, 4 * r * r);
l := 2 * r - 1;
tX := cX - r;
tY := cY - r;
for i := 0 to l do
for j := 0 to l do
Result[j + l * i] := Point(tX + i, tY + j);

Result := RemoveDistTPointArray(cX, cY, r, Result, True);
end;

function CircleMatch(Circles: TCircleArray): TPointArray;
var
TheTPA: TPointArray;
i, i2: integer;
begin
TheTPA := CircleTPA(Circles[0].Center.x, Circles[0].Center.y, Circles[0].Radius);
i := 0;
repeat
for i2 := 1 to High(Circles);
begin
if Round(Hypot(TheTPA[i].x - Circles[i2].Center.x, TheTPA[i].y - Circles[i2].Center.y)) > Circles[i2].Radius then
begin
SwapTPA(TheTPA[i], TheTPA[High(TheTPA)]);
SetLength(TheTPA, Length(TheTPA)-1);
dec(i);
break;
end;
end;
inc(i);
until i = High(TheTPA) + 1;
setlength(result, Length(TheTPA);
for i:= 0 to High(TheTPA) do
result[i] := TheTPA[i];
end;


by Heysus

program new;
{.include SRL/SRL.scar}
{.include SRL/SRL/misc/debug.scar}


type
TCircle = record
Center: TPoint;
Radius: integer;
end;


var
Circles: Array of TCircle;
TPA: TPointArray;
BMP, i, t: integer;




function CircleMatch(Circles: Array of TCircle): TPointArray;
var
x, y, x1, y1, x2, y2, i: integer;
begin
x2 := 9999999;
y2 := 9999999;
for i:=0 to High(Circles) do
begin
x1 := Max(x1, Circles[i].Center.x - Circles[i].Radius);
y1 := Max(y1, Circles[i].Center.y - Circles[i].Radius);
x2 := Min(x2, Circles[i].Center.x + Circles[i].Radius);
y2 := Min(y2, Circles[i].Center.y + Circles[i].Radius);
end;

//for debug only
for x:=x1 to x2 do
begin
FastSetPixel(BMP, x, y1, 16750899);
FastSetPixel(BMP, x, y2, 16750899);
end;
for y:=y1 to y2 do
begin
FastSetPixel(BMP, x1, y, 16750899);
FastSetPixel(BMP, x2, y, 16750899);
end;

for x:=x1 to x2 do
for y:=y1 to y2 do
begin
for i := 0 to High(Circles) do
begin
if Distance(x, y, Circles[i].Center.x, Circles[i].Center.y) > Circles[i].Radius then
break;

if i = High(Circles) then
begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[High(Result)] := Point(x, y);
end;
end;
end;

end;





begin
SetArrayLength(Circles, 4);
Circles[0].Center := Point(203, 126);
Circles[0].Radius := 100;
Circles[1].Center := Point(162, 207);
Circles[1].Radius := 100;
Circles[2].Center := Point(281, 171);
Circles[2].Radius := 100;
Circles[3].Center := Point(173, 284);
Circles[3].Radius := 100;

ClearDebug;
BMP := LoadBitmap('C:\Users\Zach\Desktop\Untitled.bmp');

MarkTime(t)
TPA := CircleMatch(Circles);
Writeln('Took ' + IntToStr(TimeFromMark(t)) + ' ms');

DrawTPABitmap(BMP, TPA, 59900);
DisplayDebugImgWindow(400, 400);
DrawBitmapDebugImg(Bmp);

end.

by Bad Boy JH

type
TColorPoint = record
X, Y: Integer;
Color, R, G, B: Integer;
end;

TColorPointArray = Array of TColorPoint;

function rs_OnMinimap2(x, y: Integer): Boolean;
begin
Result := InCircle(x, y, MMCX, MMCY, 76);
end;

procedure SimplifyColors;
var
TheBitmap, ArrC, R, G, B, I, X, Y: Integer;
Box: TBox;
Colors: TColorPointArray;
begin
Box := MMBox;
SetLength(Colors, (Box.x2 - Box.x1) * (Box.y2 - Box.y1));
For X := Box.x1 to Box.x2 do
For Y := Box.y1 to Box.y2 do
if RS_OnMinimap2(X, Y) then
begin
Colors[arrC].Color := GetColor(X, Y);
Colors[arrC].X := X;
Colors[arrC].Y := Y;
ColorToRGB(Colors[arrC].Color, Colors[arrC].R, Colors[arrC].G, Colors[arrC].B);
Colors[arrC].Color := RGBToColor((Colors[arrC].R div 64) * 64, (Colors[arrC].G div 64) * 64, (Colors[arrC].B div 64) * 64);
Inc(ArrC);
end;
SetLength(Colors, ArrC);

TheBitmap := CreateBitmap(Box.x2 - Box.x1 + 1, Box.y2 - Box.y1 + 1);
CopyClientToBitmap(TheBitmap, Box.x1, Box.y1, Box.x2, Box.y2);

for I := 0 to High(Colors) do
FastSetPixel(TheBitmap, Colors[i].X - Box.x1, colors[i].y - Box.y1, Colors[i].Color);

DrawBitmapDebugImg(TheBitmap);
DisplayDebugImgWindow(Box.x2 - Box.x1 + 1, Box.y2 - Box.y1 + 1);
FreeBitmap(TheBitmap);
end;

And there's more. I'll search for it and unlock the thread once I'm done finding.

Sir R. M8gic1an

2011-02-12 07:24:10


Sir R. M8gic1an

2011-02-12 07:27:18

There's more, but that's all I'm releasing for now.

So if you wanna post, it better not be spam. Questions are acceptable tho :)

~RM

Gu3st...

2011-02-12 07:42:04

Now this looks much better, RM :)
If you had posted that in the start, no-one would've spammed your thread in the first place, you know.. Sorry for spamming your thread.

Wizzup?

2011-02-12 07:48:39

This is by far the longest record of posts by a single person in a row. And that what purpose? Create it all locally, when you're done, post it together.

Sir R. M8gic1an

2011-02-12 08:01:45

Posted here because this is stuff that was posted all around the forums (staff, SSRL, JM Dev) and now I posted it here so people can see the development happening.

As simple as that, that's the point of a development section Wizzup? ;)

~RM

Wizzup?

2011-02-12 08:12:16

No, that's not the point of a development section. You don't post your progress every 10 minutes. Why does everyone have to see you're working on something?

Sir R. M8gic1an

2011-02-12 09:07:55

From: Wizzup?
No, that's not the point of a development section. You don't post your progress every 10 minutes. Why does everyone have to see you're working on something?


This is just the work that had already been done >.<

If it bothers you that much merge the posts, otherwise just let it be! It's code, it's development, it has other people's contributions and I want somewhere clear to look at it while I work on it. is that ok?

And I might want to ask for help or ask for development, (as has been done before) and so I need this thread.

I'm doing nothing wrong except maybe posting 5 posts instead of one, which is really not all that harmful because it keeps things organized by stages.

As I'm doing nothing wrong, could you please leave me alone? I'd've thought that simba + script manager + SRL 5 would keep you busy enough already, no need for you to worry about color walking too. You've done your share already.

What I next want to do is analyse the pure colors of the minimap.

~RM

Markus

2011-02-12 13:25:18

Infracted for tripleposting, lol.
I'll also post my TWalkPath, made this somewhere in 2008 when rewriting my air crafter (it was completed and flawless when Jagex moved the altar to varrock -.-)
Oh, well commented btw.

type
TDDTMHandler = record //Record for universal (D)DTM handling
DaDTM : integer; //The (D)DDTM
Modi : TBox; //What to mod to X1, Y1, X2, Y2 etc
end; //I.E. Modi.x1 = 10 will search in mmx1+10, mmy1, mmx2, mmy2 etc.
TWalkStep = record //Record for walking stuff, contains all information in order to click one time
DDTM : TDDTMHandler; //The DDTM, first priority :)
Backuptype : (None, Radialwalking, Coords, Polar); //The backuptype, in case the DDTM fails. None, Radialwalk, Coords or Polar coords
RadiPoint : TPoint; //What are the Start/End radials, or the Coords in cae of Coord failsafe
OtherInfo : TPoint; //The radius and colour, or in case of coords, the randomness.
end;
TWalkRoute = array of TWalkStep; //Looks neater then array of TWalkStep imo ^^

There are the records.

////////////////////////////////////////////////////////////////////////////////
// function WalkTheRoute(route : TWalkRoute) : boolean; //
// Highlevel walking function. Enter a TWalkRoute, and it'll walk. Has built- //
// in failsafe handling. //
////////////////////////////////////////////////////////////////////////////////
function WalkTheRoute(route : TWalkRoute) : boolean;
var
i : integer;
x, y : integer;
begin
result := false; //ALWAYS initialize the result
if (not(loggedin)) then
exit;
for i := 0 to high(route) do //Repeat code below for every step we need to walk
begin
debug('Walking step '+inttostr(i), 0);
if (not(loggedin)) then //Default "failsafe"
exit;
//WaitWhilstLoading;
if DTMRotated(route[i].DDTM.DaDTM, x, y, //Ok, so first we search for the (D)DTM
mmx1+route[i].DDTM.Modi.X1, mmy1+route[i].DDTM.Modi.Y1,
mmx2-route[i].DDTM.Modi.X2, mmy2-route[i].DDTM.Modi.Y2) then
begin
Debug('FOUND STEP '+inttostr(i), 0);
MFF(x, y, 1, 1); //If we found it click
FFlag(0); //Wait
FindNormalRandoms; //And find Randoms ofcourse :p
Wait(500 + random(500)); //Then wait a little bit longer
end else
begin
debug('Failsafe! step '+inttostr(i), 1);
case route[i].BackupType of //If not found, we got a few backup types:
None :
begin
MyTakeScreenz('Failed to walk to step '+inttostr(i));
logout;
exit;
end; //We got none, in that case we'll stop
Radialwalking :
begin
if not RadialWalk(HandleColour(route[i].OtherInfo.y), route[i].RadiPoint.x, route[i].RadiPoint.y, route[i].OtherInfo.x, 1, 1) then
begin
logout;
exit; //We got radialwalk, just handle the radialwalk
end;
end;
Coords: //And we got coords
begin
if (not(CoordFailsafe)) then //For coord-click paranoia people, we got constant they can set :)
begin
logout;
exit;
end;
MFF(route[i].RadiPoint.x, route[i].RadiPoint.y, route[i].OtherInfO.x, route[i].OtherInfo.y);
end;
end;
FFlag(0);
FindNormalRandoms;
Wait(500 + random(500));
end;
end;
result := true;
debug('Walked the route completely :)', 1);
end;

MFF is afaik removed from SRL (so is DTMRotated?). It also uses a debugging function, a screenshottaker and the HandleColour function (which basically is case color of 1: result := findroadcolor; etc.)

Example walking step (just fill in the entire record etc)

ToAltarDDTM[0].Mainpoint.x := 611; //1
ToAltarDDTM[0].Mainpoint.y := 145;
ToAltarDDTM[0].Mainpoint.color := 0;
ToAltarDDTM[0].Mainpoint.tolerance := 423; //Max tol

SetArrayLength(ToAltarDDTM[0].subpoints, 3);
ToAltarDDTM[0].SubPoints[0].x := 581;
ToAltarDDTM[0].SubPoints[0].y := 69;
ToAltarDDTM[0].SubPoints[0].color := TreeColor;
ToAltarDDTM[0].SubPoints[0].areasize := 3;

ToAltarDDTM[0].SubPoints[1].x := 611;
ToAltarDDTM[0].SubPoints[1].y := 39;
ToAltarDDTM[0].SubPoints[1].color := TreeColor;
ToAltarDDTM[0].SubPoints[1].areasize := 3;

ToAltarDDTM[0].SubPoints[2].x := 693;
ToAltarDDTM[0].SubPoints[2].y := 97;
ToAltarDDTM[0].SubPoints[2].color := LadderColor;
ToAltarDDTM[0].SubPoints[2].areasize := 3;

ToAltar[0].BackupType := Radialwalking;
ToAltar[0].RadiPoint := IntToPoint(225, 180);
ToAltar[0].OtherInfo := IntToPoint(65, -1);
225, 180 = start/end radial
the 65 = radius
-1 = the colour (as in handlecolour, -1 results fallyroadcolor).

Sir R. M8gic1an

2011-02-12 14:28:01

Great, cheers :)

Gu3st...

2011-02-12 19:09:05

From: Sir R. M8gic1an
What I next want to do is analyse the pure colors of the minimap.

~RM
PosterizeBitmap(); would work good for that :)

Sir R. M8gic1an

2011-02-13 05:54:03

From: Zyt3x
PosterizeBitmap(); would work good for that :)


It's not a BMP and I intend to use SmartColors algo, but sure, might have a look at that.

e: Just properly read through Markus' code, great, cheers, and the work I'll be doing here is at the DDTM level, so hopefully taking what you've done further :)

A bit like the pdf u posted somewhere else.

~RM

Gu3st...

2011-02-13 08:45:17

From: Sir R. M8gic1an
It's not a BMP and I intend to use SmartColors algo, but sure, might have a look at that.

~RM
What's not a BMP?

Sir R. M8gic1an

2011-02-13 08:48:16

From: Zyt3x
What's not a BMP?


When I've never mentioned any BMPs, so I have no clue why you'd go mentioning them except if you were considering the idea of grabbing a BMP of the MM and using posterize BMP on that.

Anyway, I'll be purifying the MM, not posterizing it.

Which might come down to the same thing, but differently.

~RM

Gu3st...

2011-02-13 09:05:02

So how will you purify it without getting the colors?

Sir R. M8gic1an

2011-02-13 09:08:06

From: Zyt3x
So how will you purify it without getting the colors?


I'll work on this when I'm on break, I've said this a million times :rolleyes:

I'll use the SmartColors Algorithm, said that too.

I'll paint the maps the way they are painted in the picture on the first page.

I'll do the DDTMs in the suggested shapes like in the pictures.

etc, etc, etc.

And what I'll do to test is debug it onto the MM.

~RM

Daniel

2011-02-14 00:26:50

From: Sir R. M8gic1an
I'll work on this when I'm on break

Wut?

Santa_Clause

2011-02-14 02:16:30

What's with everyone giving Rasta a hard time…? Just leave him in peace…

This code is just way over my head, but the minimap debugging thing you've got on the first page looks interesting so I just had to post xD