SRL Archive - Scripting Help

werewolf agility course / pipe obstacle.


Sjoe

2013-12-28 00:34:00


(pipes on top of the screen)

Can't seem to get the pipes accurately, colors are pretty much the same.
and my brain is failing me. Anyone got an idea?
(please write it up :p )

Olly

2013-12-28 00:50:00

Tomorrow when its not 6am :p

Sjoe

2013-12-28 00:53:47

From: Olly
Tomorrow when its not 6am :p


alright, thanks mate:p

Olly

2013-12-28 12:40:39

Didn't turn out as good as I wanted it to but meh. (img.png is your image on op)



{$i srl-6/srl.simba}

var
targ: byte;

function foo(): array of TPoint;
const
colWall: TColorData = [7770780, 3, [2, 0.15, 0.53]];
var
tpa: TPointArray;
atpa: T2DPointArray;
i, h: integer;
mid, midd: TPoint;
begin
if (not colWall.gatherIn(tpa, [0, 0, getMufasaBitmap(targ).getWidth() - 1, getMufasaBitmap(targ).getHeight() - 1])) then
exit();

atpa := tpa.cluster(3, 1);
atpa.sortFromMidPoint(point(0, 0));
atpa.filterBetween(0, 30);

h := high(atpa);

for i := 0 to (h - 1) do
begin
mid := atpa[i].getMiddle();
midd := atpa[i + 1].getMiddle();

if (distance(mid, midd) < 50) or (abs(mid.y + midd.y) > 100) then
continue();

insert(TPAFromCircle(middleTPA([mid, midd]).x, middleTPA([mid, midd]).y, 10), result);
end;
end;

begin
try
targ := loadBitmap('img.png');
setTargetBitmap(targ);

drawTPABitmap(targ, foo(), clLime);
finally
freeTarget(getImageTarget());
debugBitmap(targ);
freeBitmap(targ);
end;
end.