Quest 6 - Giving rooms custom attributes, and checking them later

Anyone know how I would go about giving a room a custom attribute, and then having it checked later?
For example:

createRoom("testroom", {
	desc:"a cool description",

if ( != "bar") {
        do stuff

...While I'm here, I might as well ask if it's possible to teleport a player to another room, and store their inventory somewhere else when they do so.

game.player.loc will be a string (the name of the room).

That part would need to be w[game.player.loc].foo.

I saw something on the wiki about teleporting the player, but I can't find it now for the life of me. I can't remember the exact terminology used, but something on that wiki says what function to use when moving the player to a different room during play.


To move the player, use world.setRoom.

Thanks. I ended up actually writing my own function to teleport them:

async function teleport(dest) {
	game.player.loc = dest;
	msg(`<b>The ${w[game.player.loc].alias}</b>`);
	return true;

Log in to post a reply.