Hoodz
2013-11-07 14:41:56
i need to know if this gate is closed or open. i have no ideas anymore…
here are some pics of the gate, its located at edvillage dungeon.



here are some pics of the gate, its located at edvillage dungeon.



2013-11-07 14:41:56



2013-11-07 14:44:56
2013-11-07 14:50:56
From: Ashaman88
If you click on the other side of the door via the minimap does it walk you up to the door and stop? Or does the flag just disappear?
There are ways to do it with the MS, but I think it may be easier to do via minimap the how the flag interacts with obstacles.
2013-11-07 15:02:22
program new;
var
img1, img2: integer;
function DownloadToFile(const URL, Filename: string): boolean;
var
FileI: LongInt;
FileC, FileH: string;
begin
Result := False;
FileI := InitializeHTTPClient(False);
try
FileC := GetHTTPPage(FileI, URL);
FileH := GetRawHeaders(FileI);
if ((FileC = '') or (FileH = '')) then
begin
WriteLn('Error downloading "' + URL + '".');
Exit;
end;
FileH := Copy(GetRawHeaders(FileI), 10, Pos(#13, FileH) - 10);
if (FileH <> '200 OK') then
begin
WriteLn('Couldn''t download "' + URL + '", Error Code: ' + FileH + '.');
Exit;
end;
finally
FreeHTTPClient(FileI);
end;
try
if not FileExists(Filename) then
FileI := CreateFile(Filename)
else
FileI := OpenFile(Filename, False);
CloseFile(FileI);
FileI := RewriteFile(Filename, False);
Result := WriteFileString(FileI, FileC);
finally
CloseFile(FileI);
end;
end;
procedure init();
begin
DownloadToFile('http://imageshack.us/a/img191/4739/rqck.png', '1.png');
DownloadToFile('http://imageshack.us/a/img542/6435/qh5p.png', '2.png');
img1 := loadBitmap('1.png');
img2 := loadBitmap('2.png');
end;
procedure isGateOpen(img: integer);
var
w, h: integer;
tpa: TPointArray;
atpa: T2DPointArray;
i, posts: integer;
b: TBox;
begin
setTargetBitmap(img);
getBitmapSize(img, w, h);
setColorToleranceSpeed(2);
setToleranceSpeed2Modifiers(0.14, 0.13);
findColorsTolerance(tpa, 8684943, 0, 0, w-1, h-1, 15);
atpa := clusterTPAEx(tpa, 6, 6);
posts := 0;
for i := 0 to high(atpa) do
begin
b := getTPABounds(atpa[i]);
if (length(atpa[i]) < 30) then
continue;
if ((b.y2 - b.y1) < 50) then
continue;
if ((b.x2 - b.x1) > 30) then
continue;
inc(posts);
end;
case posts of
4: writeln('gate is open!');
3: writeln('gate is closed!');
end;
end;
begin
init();
isGateOpen(img1);
isGateOpen(img2);
freeBitmap(img1);
freeBitmap(img2);
end.
2013-11-07 15:20:19
From: Olly
Just count the grey gate posts.program new;
var
img1, img2: integer;
function DownloadToFile(const URL, Filename: string): boolean;
var
FileI: LongInt;
FileC, FileH: string;
begin
Result := False;
FileI := InitializeHTTPClient(False);
try
FileC := GetHTTPPage(FileI, URL);
FileH := GetRawHeaders(FileI);
if ((FileC = '') or (FileH = '')) then
begin
WriteLn('Error downloading "' + URL + '".');
Exit;
end;
FileH := Copy(GetRawHeaders(FileI), 10, Pos(#13, FileH) - 10);
if (FileH <> '200 OK') then
begin
WriteLn('Couldn''t download "' + URL + '", Error Code: ' + FileH + '.');
Exit;
end;
finally
FreeHTTPClient(FileI);
end;
try
if not FileExists(Filename) then
FileI := CreateFile(Filename)
else
FileI := OpenFile(Filename, False);
CloseFile(FileI);
FileI := RewriteFile(Filename, False);
Result := WriteFileString(FileI, FileC);
finally
CloseFile(FileI);
end;
end;
procedure init();
begin
DownloadToFile('http://imageshack.us/a/img191/4739/rqck.png', '1.png');
DownloadToFile('http://imageshack.us/a/img542/6435/qh5p.png', '2.png');
img1 := loadBitmap('1.png');
img2 := loadBitmap('2.png');
end;
procedure isGateOpen(img: integer);
var
w, h: integer;
tpa: TPointArray;
atpa: T2DPointArray;
i, posts: integer;
b: TBox;
begin
setTargetBitmap(img);
getBitmapSize(img, w, h);
setColorToleranceSpeed(2);
setToleranceSpeed2Modifiers(0.14, 0.13);
findColorsTolerance(tpa, 8684943, 0, 0, w-1, h-1, 15);
atpa := clusterTPAEx(tpa, 6, 6);
posts := 0;
for i := 0 to high(atpa) do
begin
b := getTPABounds(atpa[i]);
if (length(atpa[i]) < 30) then
continue;
if ((b.y2 - b.y1) < 50) then
continue;
if ((b.x2 - b.x1) > 30) then
continue;
inc(posts);
end;
case posts of
4: writeln('gate is open!');
3: writeln('gate is closed!');
end;
end;
begin
init();
isGateOpen(img1);
isGateOpen(img2);
freeBitmap(img1);
freeBitmap(img2);
end.
SRL Compiled in 0 msec
Successfully executed. 2013-11-07 15:27:53
repeat
ClickMinimapBehindGate;
While flagpresent or ismoving do wait();
If CurrentPosition.x > PositionOfGate then
break;
OpenGate;
until CurrentPosition.x > PositionOfGate
2013-11-07 16:22:11
From: Nebula
If you're using sps then
repeat
ClickMinimapBehindGate;
While flagpresent or ismoving do wait();
If CurrentPosition.x < PositionOfGate then
break;
OpenGate;
until CurrentPosition.x < PositionOfGate
2013-11-07 16:34:38
From: NebulaAh okay thank you
If you're using sps then
repeat
ClickMinimapBehindGate;
While flagpresent or ismoving do wait();
If CurrentPosition.x < PositionOfGate then
break;
OpenGate;
until CurrentPosition.x < PositionOfGate
2013-11-08 11:34:55
function isGateOpen():Boolean;
var
w, h: integer;
tpa: TPointArray;
atpa: T2DPointArray;
i, posts: integer;
b: TBox;
begin
//setTargetBitmap(img);
//getBitmapSize(img, w, h);
setColorToleranceSpeed(2);
setToleranceSpeed2Modifiers(0.14, 0.13);
findColorsTolerance(tpa, 8684943, MSX1, MSY1, MSX2, MSY2, 15); // changed search co-ords
atpa := clusterTPAEx(tpa, 6, 6);
posts := 0;
for i := 0 to high(atpa) do
begin
b := getTPABounds(atpa[i]);
if (length(atpa[i]) < 30) then
continue;
if ((b.y2 - b.y1) < 50) then
continue;
if ((b.x2 - b.x1) > 30) then
continue;
inc(posts);
end;
case posts of
4: begin
writeln('gate is open!');
result:=True;
end;
3: begin
writeln('gate is closed!');
result:=False;
end;
end;
end;