Module exit

Functions for interacting with room exits.

Global functions

Exit.create (from, direction, to, both) create a new exit between two rooms.

Class Exit

exit:delete (both) delete this exit.
exit:getDescription () get the description for this exit.
exit:getKey () get the key code or object vnum for this exit.
exit:getName () get the name for this exit, either a set keyword or the directional name.
exit:getToRoom () get the room this exit leads to.
exit:hasFlag (flag) get whether a flag is set on this exit.
exit:setDescription (the) set the description for this exit.
exit:setFlag (flag, value, both) set a flag on this exit.
exit:setKey (key) set the key code or object vnum for this exit.


Global functions

Exit.create (from, direction, to, both)
create a new exit between two rooms. Be sure to fold the area if you want to control whether the exit persists in the long run.

Parameters:

  • from Room the room (or vnum) to link from
  • direction string the exit direction (e.g. north, n, or a custom string)
  • to Room the room (or vnum) to link to
  • both boolean whether to create a mirroring exit back from the target room to the source (optional, defaults to true)

Returns:

    Exit the new exit

Usage:

  • self:onCommand("lever", function(self, ch)
      ch:echoAt("You push the lever...")
      ch:echoAround("{1} pushes the lever...", ch)
      Exit.create(self, north, 12345, true)
      self:echo("A hidden passage reveals itself to the north, leading to a snowy expanse!")
      self:getInArea():fold() -- save the area now
    end)
  • Exit.create(self, "trapdoor", 12345) -- Create a custom exit named 'trapdoor'

Class Exit

Functions on exit variables
exit:delete (both)
delete this exit.

Parameters:

  • both boolean whether to delete the mirroring exit back from the target room to the source (optional, defaults to false)
exit:getDescription ()
get the description for this exit.

Returns:

    string the description for this exit.
exit:getKey ()
get the key code or object vnum for this exit.

Returns:

    integer the key code or key object vnum for this exit.
exit:getName ()
get the name for this exit, either a set keyword or the directional name.

Returns:

    string the exit name.
exit:getToRoom ()
get the room this exit leads to.

Returns:

    Room the room this exit leads to
exit:hasFlag (flag)
get whether a flag is set on this exit.

Parameters:

  • flag string The flag to check for

Returns:

    boolean True if the flag is set, false otherwise

Usage:

    if exit:hasFlag("closed") do
      ch:echoAt("The door is closed.")
    end
exit:setDescription (the)
set the description for this exit.

Parameters:

  • the string new description

Returns:

    Exit the exit, for call chaining
exit:setFlag (flag, value, both)
set a flag on this exit.

Parameters:

  • flag string The flag to set
  • value boolean The new value to set
  • both boolean If true, when the exit is two-way, the flag will be set on the other side as well.

Returns:

    Exit the exit, for call chaining

Usage:

    -- Open the door from both sides
    room:setFlag("closed", false, true)
exit:setKey (key)
set the key code or object vnum for this exit.

Parameters:

  • key integer the object vnum or key code

Returns:

    Exit the exit, for call chaining
generated by LDoc 1.5.0 Last updated 2024-10-22 16:05:00