! Following is a handy little routine for Hugo 2.5+ that provides exit
! descriptions for rooms. All you need to do to use it is make sure you
! use the dir.to properties to code your exits, and *don't put any other
! code in them*. For example,
!
! e_to DinkyRoom
!
! is acceptable, while something like
!
! e_to { move thingie to player : return DinkyRoom }
!
! is not. Also, each location that needs to be referred to with a preposition
! needs to be supplied with one. For example,
!
! room street "street running in front of the park"
! { ...
! prep " a"
! ...
! }
!
! Notice the leading space in the preposition property. That is reqired
! in order to allow rooms that *don't* need a preposition to print
! out properly. Now, all you need to do to make this thing work is to call
! YouCanGo() after each room's long description:
!
! room street "street running in front of the park"
! { ...
! prep " a"
! long_desc { "You are on a narrow street fronting the park."
! YouCanGo()
! }
! }
!
! That's it! Everything else is automatic, including door-handling.
! Enjoy! This document copyright (c) 2000 by Cardinal Teulbachs
array go_dirs[13]
routine YouCanGo
{
local n, p, cnt, the_dir, list_ref
if go_dirs[0] = 0 ! if nowhere to go
{ "\n\_ There are no obvious exits from here."
return true ! bail out
}
"\n\_ You can go ";
for (n=1; n<=12; n++) ! begin Exits loop
{
if go_dirs[n] ~= 0 ! skip empty array elements
{
if go_dirs[n].type = door
{
local x
for (x=1; x<=2; x++)
{
if go_dirs[n].between#x ~= location
the_dir = go_dirs[n].between#x
}
}
else
the_dir = go_dirs[n]