SRL Archive - Reflection Development

DumpInteractableAt


Bad Boy JH

2010-10-10 06:23:29

I don't really know if this is commit worthy or not, but it was very useful for me. You input the tile, and it prints out the ID of the object (must be interactable, you can mod it to be non-interactable) and writes the 'newobject' procedure for it.

Procedure DumpInteractableAt(TheTile: TTile);
var
TheObject: TRSOBject;
begin
TheObject := GetInteractableAt(TheTile);
Writeln('ID: ' + IntToStr(TheObject.ID));
Writeln('NewObject(' + IntToStr(TheObject.ID) + ', ' + IntToStr(TheObject.objType) + ', Tile' ToStr(TheObject.Tile) + ');');
end;

Cstrike

2010-10-10 10:40:49

This is good code too, we need debugging code ;)


Here is mine, anyone can use it in a loop around them:
procedure FindObjNear;
var myObj : TRSObject;
myTile, newTile : TTile;
i : Integer;
begin
if not LoggedIn then exit;
myTile := GetMyPos;
writeln ('[--Objects--]');
newTile := Tile((myTile.x-1),myTile.y);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(W)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.Tile.y)+')');
end;

newTile := Tile((myTile.x),myTile.y-1);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(S)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.Tile.y)+')');
end;

newTile := Tile((myTile.x+1),myTile.y);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(E)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.Tile.y)+')');
end;

newTile := Tile((myTile.x),myTile.y+1);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(N)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.Tile.y)+')');
end;
end;
Gets any objects N/S/E/W that are interactable objects