SRL Archive - Reflection Development

Object finder! Dont need to enter anything!


ZaSz

2008-10-07 22:26:23

O.k this is the script just press play and walk around. It will find the id of object to 1 square over to the direction you choose.


program Findobjectid;
{.include SRL/SRL/misc/smart.scar}
{.include SRL\SRL.Scar}
{.include SRL/SRL/reflection/reflection.scar}
function findobjectid(direction:string): boolean;
var
P : TPoint;
X, Y: integer;
TileObject: UID;
begin
P := GetMyPos;
if direction = 's' then
begin
x := p.x;
y := p.y - 1;
writeln('Location X = ' + inttostr(x)+ 'Location Y = '+ inttostr(y));
TileObject := GetObjectAt(X, Y);
writeln('Object I.D is ' + IntToStr(TileObject.objType));
end;
if direction = 'n' then
begin
x := p.x;
y := p.y + 1;
writeln('Location X = ' + inttostr(x)+ 'Location Y = '+ inttostr(y));
TileObject := GetObjectAt(X, Y);
writeln('Object I.D is ' + IntToStr(TileObject.objType))
end;
if direction = 'e' then
begin
x := p.x + 1;
y := p.y;
writeln('Location X = ' + inttostr(x)+ 'Location Y = '+ inttostr(y));
TileObject := GetObjectAt(X, Y);
writeln('Object I.D is ' + IntToStr(TileObject.objType))
end;
if direction = 'w' then
begin
x := p.x - 1;
y := p.y;
writeln('Location X = ' + inttostr(x)+ 'Location Y = '+ inttostr(y));
TileObject := GetObjectAt(X, Y);
writeln('Object I.D is ' + IntToStr(TileObject.objType))
end;
end;

begin
repeat
SmartSetup('world113', True, true, False);
cleardebug;
findobjectid('w'); // change w to direction
wait(700);
until false;
end.

Ashur2Good

2008-10-09 09:53:20

Nice though this has some obvious flaws which i don't think i need to point out.

Still though, you never know when this might be handy.


(Thumbs up)

-Ashur

ZaSz

2008-10-10 17:27:11

Thanks, but what are the flaws?

noidea

2008-10-26 17:32:26

You could use cases, they would make the script look alot more advanced.