Remotely view object location Inform 6

I’ve been trying to resolve this for a couple of days and can’t seem to get it to work.

In a room I have a series of monitors which are intended to monitor the location of certain objects within the game. When the player examines those monitors I want the description to say something like:-

Object A is currently in the (location), object b is in the (location) etc… But I can’t seem to get it to work, I’ve tried the following:-

Nearby monitors “monitors”
with name “monitors” “monitor” “screens” “displays”,
description
[; if (monitors has controlled)
Print "The monitors are showing video feeds from the freighter’s maintenance drones, Drone 1 is currently in “,(location.drone1), " Drone 2 is in “,(location.drone2), " and Drone 3 is in " ,(location.drone3),”.”;

],
has static controlled;

When I play this it returns numbers in the description rather than the location names, am I anywhere near getting this right?

Charlie

To print an object reference in I6 you have to use one of the forms:

print (object) location.drone2;
print (the) location.drone2;
print (The) location.drone2;
print (a) location.drone2;

The (object) form leaves off the article; the others add “the”, “The”, or “a/an”.

Hi Zarf,

Thanks for your reply, I still can’t work out how to implement this into my existing code, what exactly do I need to change in the above example for the text returned to player to advise which location each drone is in and to update accordingly should the drones move and the monitor be examined again?

Any help would be greatly appreciated.

Charlie

Untested … and be warned, my I6 is quite rusty. First of all, though it makes me very nervous to suggest that Zarf might have given a wrong example, shouldn’t it be drone2.location, not location.drone2? The room class doesn’t have a property drone1 or drone2 that can be accessed in this way. I can’t find anything in the DM4 that uses either syntax, and I’m pretty sure drone2.location is TADS syntax, not Inform.

What I’m fairly sure would be reliable would be something like this:

local rm; print "The monitors are showing video feeds from the freighter's maintenance drones. Drone 1 is currently in "; rm = parent(drone1); print (object) rm; print ", Drone 2 is in "; rm = parent (drone2); print (object) rm; print ", and Drone 3 is in "; rm = parent(drone3); print (object) rm; ".";
…except that I think “local” is TADS syntax too. You need to define the variable rm at the top of the code block:

description [rm;

You’ll note that I’ve tidied up your commas, so that they’ll print, and that the code block ends with an implicit print_ret.

At any rate, maybe that code, even if it’s faulty, will help you get moving in the right direction.

Much appreciated Jim, I’ll give this a go today, thanks for your help.

Charlie

Still no luck getting this working I’m afraid.

Is anyone able to advise if there is a simple way to print the location of an object in the game. If I could get that syntax correct I’m sure I could work out the rest.

Charlie

Sorry – I was assuming you had a “location” object with properties that you had set up for the three drones.


Print "The monitors are showing video feeds from the freighter's maintenance drones, Drone 1 is currently in ", (object) parent(drone1), " Drone 2 is in ", (object) parent(drone2), " and Drone 3 is in " , (object) parent(drone3),".";

Thanks Zarf, I still can’t seem to get this to work, but I’m sure that’s my fault.

Charlie

The final code I came up with was:-

So thanks for all your help, got there in the end.

Charlie