Teleporting command for testing purposes.

Well, I’m pretty new to Inform, and I know some of the basics but I’m still an amateur. I’ve been attempting to make a teleporting command, but I can’t seem to do it. Any help? Here’s the source text:

Teleporting is an action applying to one thing.
understand “Teleport to [any room]” as teleporting.
Carry out teleporting: now the player is in [This is where I have a problem with the teleporting text]
Report teleporting: say “You teleport to [the noun].”

Is it possible? Or not?

It’s pretty easy. Good question, though.

[code]The Lounge is a room. “Ah, the Lounge.”

The Crypt is a room. “Ugh, the Crypt.”

Teleporting is an action applying to one visible thing. Understand “Teleport to [any room]” as teleporting.

Carry out teleporting:
say “You teleport to [the noun].”;
now the player is in the noun.

Test me with “teleport to crypt / teleport to lounge”.[/code]

Note that I put the reporting output in the carry out rule. This is so the player will read a report BEFORE the description of the new room is printed. Also note the use of “visible”, which is required precisely because the destination is not, in fact, visible. (It’s an Inform thing.)

–JA

1 Like

Are you aware of the “abstract to” built-in testing command in inform7? In debug builds, you can do things like “abstract me to garden” or “abstract lamp to basement”

Aha! Thank you both for your input. :smiley:

Yes, it looks and sounds ridiculous, but I don’t know if that’s quite fair. The use of “visible” is required because “visible” is not as restrictive as “touchable,” which is the default.

Because it’s always good to have more than one way to do things…

GONEAR LOCATION works well.

You can GONEAR an item, too. And you don’t need to fill everything in. So “gonear north of the house” could be “gonear north”…

Gonear has the advantage of not using time, too.

Between that, PURLOIN, and SHOWME, I’m able to do a lot of things with the test command that save all kinds of time.

BTW, Jim, it’s neat to see how people would make this command from scratch (I didn’t know,) but I’m curious why you might favor teleporting over gonear, since I believe I learned about gonear in your Inform Handbook.