Can't find Exit? (Beginner)

Hi again! I'm trying to make it so that if the player hits a button in a room the exits lock, but when I use the lock exit function in the web GUI the drop down menu doesn't list any of the exits of the room?


That function will only show exits that have names. You need to put something in the "name" field for each exit if you want to use it in scripts.

(if you don't give an exit a name, it will get a name like "exit362" when the game starts; but you can't select that because it will change every time you add an exit to a room higher up in the list)


Alternatively, if you want to lock all exits from a room, you could use a piece of code like:

foreach (exit, AllExits()) {
  if (exit.parent = name_of_room) {
    exit.locked = true
  }
}

Thank you!


Alternatively, if you want to lock all exits from a room, you could use a piece of code like:

foreach (exit, AllExits()) {
 if (exit.parent = name_of_room) {
   exit.locked = true
 }
}

Or:

foreach (exit, ScopeExitsForRoom(name_of_room)) {
  exit.locked = true
}

And if you target the exits that are in the same room as the player:

foreach (exit, ScopeExitsForRoom(game.pov.parent)) {
  exit.locked = true
}

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums