Markus
2007-04-24 11:09:48
Hello
I've got a testscript to find the position of the Mindaltar on the MM. Please use them right of the mind altar. It uses HSL autocoloring and dynamic DTMs (am I the first one using them :rolleyes: )
If it works it should move the mouse near the Altar on the mm.
If this works, expect a mindcrafter soon….
I've got a testscript to find the position of the Mindaltar on the MM. Please use them right of the mind altar. It uses HSL autocoloring and dynamic DTMs (am I the first one using them :rolleyes: )
If it works it should move the mouse near the Altar on the mm.
If this works, expect a mindcrafter soon….
program New; //Yeah,
{.include srl/srl.scar}
var lol : TDTM;
dtm : integer;
angle : extended; //Am I the first one using dynamic DTMs?
function AutoDarkTreeColor : integer; //Based on my AutoDirtColor
var DaColors : TPointArray;
h, s, l : extended;
i, clr, time : integer;
begin
marktime(time);
FindColorsSpiralTolerance(mmcx, mmcy, DaColors, 11569, mmx1, mmy1, mmx2, mmy2, 50); //Spiral heavily increases peformance.
for i := 0 to GetArrayLength(DaColors) - 1 do //Normal: 400ms Spiral: 15ms!
begin
clr := GetColor(DaColors[i].x, DaColors[i].y); //I know it's slow, but if anyone knows a faster way...
ColortoHSL(clr, h, s, l);
if (round(h) >= 7) then
if (round(h) <= 15) then
if (round(s) >= 40) then
if (round(s) <= 100) then
if (round(l) >= 9) then
if (round(l) <= 19) then
begin
result := clr;
writeln('AutoDarkTreeColor = ' + inttostr(result) + ' found in ' + inttostr(TimeFromMark(time)) + ' ms');
exit;
end;
end;
writeln('Treecolor NOT found! Not finding took ' + inttostr(timefrommark(time)) + ' ms');
end;
begin
setupsrl;
lol.MainPoint.x := 651;
lol.MainPoint.y := 77;
lol.MainPoint.color := 1794923;
lol.MainPoint.tolerance := 50; //The mainpoint doesn't use autocoloring, maybe in another version
lol.MainPoint.areashape := 0;
lol.MainPoint.areasize := 5; //as the MM moves
SetArrayLength(lol.subpoints, 4); //4 subpoints
lol.SubPoints[0].x := 647;
lol.SubPoints[0].y := 58;
lol.SubPoints[0].color := AutoDarkTreeColor; //I wanted to practice my autocolor skills :P
lol.SubPoints[0].tolerance := 0;
lol.SubPoints[0].areashape := 0;
lol.SubPoints[0].areasize := 3;
lol.SubPoints[1].x := 659;
lol.SubPoints[1].y := 45;
lol.SubPoints[1].color := 0; //Black wildy ditch
lol.SubPoints[1].tolerance := 0; //it's a static color
lol.SubPoints[1].areashape := 0;
lol.SubPoints[1].areasize := 0;
lol.SubPoints[2].x := 647;
lol.SubPoints[2].y := 44;
lol.SubPoints[2].color := 0; //Black wildy ditch
lol.SubPoints[2].tolerance := 0; //it's a static color
lol.SubPoints[2].areashape := 0;
lol.SubPoints[2].areasize := 0;
lol.SubPoints[3].x := 664;
lol.SubPoints[3].y := 99;
lol.SubPoints[3].color := AutoDarkTreeColor;
lol.SubPoints[3].tolerance := 0;
lol.SubPoints[3].areashape := 0;
lol.SubPoints[3].areasize := 3;
dtm := AddDTM(lol);
if FindDTMRotated(dtm, x, y, mmx1+40, mmy1, mmx2, mmy2, -1.0, 2.0, 0.1, angle) then
MMouse(x, y, 0, 0) else
begin
MMouse(mscx, mscy, 50, 50);
writeln('noooo! Markus, all your work is for nothing. Screw Divi!!!');
end;
end.
It should work fine if it finds the tree color, but it's a little bit slow. But accuracy is more important then speed, right?