MODULE
vwindows
SYNOPSIS
#include <vitems.h>
inherit "/std/room";
DESCRIPTION
The windows support the actions 'open', 'close',
'climb', 'enter', 'clean' and 'smash'. The various defines can be
found at /sys/vitems.h
FUNCTIONS
varargs string AddWindow( mapping props );
varargs string AddWindow( string short, mapping props );
varargs string AddWindow( string short, string long, mapping props );
varargs string AddWindow( string short, string long, string path,
mapping props );
With AddWindow you can add a window to the room. 'short' is the
windows short description and will be used for all actions done
with the window. Besides it is splitted into ids and adjectives
for identification. 'long' is the windows long description.
'path' is the path to another room which can be seen by looking
through the window and reached by entering it. The 'props' mapping
provides additional properties for the window, see examplanation of
the PV_WINDOW defines later on. Also supported are P_IDS, P_ADS
and P_PREPS.
AddWindow(...) returns a virtual item id, which can be ignored for
normal usage.
PROPERTIES
PV_WINDOW_SHORT : <string>
The window short description, AddWindow()s 'short'
parameter is used to init this value.
PV_WINDOW_LONG
The window long description (not look through!), AddWindow()s
'long' parameter
PV_WINDOW_OTHERLONG
For windows that have no room that can be seen through the window,
i.e. PV_WINDOW_PATH is 0 this property holds the description that
can be seen with 'look through'.
PV_WINDOW_DIRTYMSG
If the window gets dirty at room resets, i.e. PV_WINDOW_TRANS is not
set to WINDOW_ALWAYS_TRANS this (optional) property holds the
message that is written to the room. string or ({ string, string })
is supported, for the last the message is done with MMSG_SEE. If not
defined a default message will be used.
PV_WINDOW_REPAIRMSG
If the window is smashed and repaired during room reset this
(optional) property holds the room message. Format is the same as
PV_WINDOW_DIRTYMSG. If not defined, default message
PV_WINDOW_PATH
This property holds the path of the room that is seen by looking
through the window and which can be reached by entering it. Can
be set to 0 (resp. omited), see P_WINDOW_OTHERLONG.
PV_WINDOW_CHECKFUN:
This can eiter be a string, an array or a closure. Beeing a string
the function is called with call_other( this_object, <string>, ...),
a closure is called with funcall and an array is always evaluated
with apply enable you to give extra paramters. The array either be
in the form ({ <stringfun>, ... }), ({ <object>, <stringfun>, ... })
or ({ <closure>, ... }), given extra parameters will be appended to
the call.
The checkfun itself has to return WINDOW_CHECK_OK if the action is
permitted and WINDOW_CHECK_FAIL or a string/array if it is denied.
string will be written to the current user, string array will be
written to user([0]) and room([1]), it is possible to give string-
arrays for [0] and [1], then MMSG_SEE is used.
The function is called with the following paramters:
check_fun( string action, string v_id [, extra] );
with action beeing on of the WINDOW_ACTION_-values and v_id the
windows vitem id. Check is always done for this_player()
Checkfuns are called only if the action would take place, which means
that if someone tries to open an already open window he will get the
normal failure message and the checkfun won't be called.
PV_WINDOW_STATE (INTERNAL!)
This holds the window state and can be WINDOW_STATE_OPEN, WINDOW_
STATE_CLOSED and WINDOW_STATE_SMASHED.
PV_WINDOW_TRANS
This holds wether the window is dirty or not. 0 means clean. It can
be set to WINDOW_ALWAYS_TRANS during AddWindow at 'props' to have a
window that never gets dirty.
PV_WINDOW_ISWINDOW (INTERNAL!)
This is always 1 and used to identify virtual windows among the
other vitems a room may have.
PV_WINDOW_OTHERID (INTERNAL!)
This holds the vitem-id of the window at the room specified by
PV_WINDOW_PATH.
SEE ALSO
vitems(C)