Move thing to a room [at random]

Hi all,

I want to move a thing to a random room, but I want to do that at random and not purely at random. I mean whenever the thing is moved I don’t want it to be moved to the room when it was before, like with random text.

How can you do that?

1 Like

One possibility would be to state that the random room should not be the location of the item, here’s a short example:

The Lab is a room.

Room A is a room. Room B is a room.

The widget is in the lab.

After jumping:
	let destination be a random room which is not the location of the widget;
	move the widget to destination;

Every turn:
	say the location of the widget;

Actually, it doesn’t work. It says that it can’t understand which is not the location because it’s looking for a description odf directions.

1 Like

Hm, my code above works for me (in Inform 7 6M62), and since I’m moving the widget directly to a room, not in a direction (like north or something), it should accept the location qualification. There must be something different in your code.

1 Like

Yes, I am using 6L38 because of an extension only supported in this version. Maybe this is causing the error.

1 Like

Ah, it seems to be a version difference indeed. I tried 6L38 from the settings tab in the IDE and got the error you describe.

Here’s an alternative which works for me in 6L38:

let destination be a random room which does not enclose the widget;