AND | &&
{and:expr1,expr2...}
Returns true if expr1
and expr2
evaluate as
true. Otherwise, this returns false. If expr1
was false,
this doesn't bother to evaluate expr2,
as it does C-style
shortcutting. If there are more than two arguments, then this will
evaluate all of them until either one returns false, in which case this
function returns false, or until it has evaluated all of the arguments.
This function returns true only if all the arguments evaluate as true.
[top]
ATTR | ATTRIBUTE
{attr:attr1,attr2...,text}
This formats text
with color and formatting attributes
specified as attr1,
attr2,
etc. You may specify up
to 8 attributes. Example, to format the string `WARNING!
' in
bold red letters, use {attr:bold,red,WARNING!
}. Nesting
attributes is not recommended. (fb6.0+) [top]
CENTER
{center:string}
{center:string,fieldwidth}
{center:string,fieldwidth,padstring}
Takes a string and pads it to fit the given fieldwidth, with the
string center justified. If no padstring is given, it assumes that it
will pad the string with spaces. If no fieldwidth is given, it assumes
that the field width is 78 characters. Example:
{center:Hello,10,1234567890}
would return the string
"123Hello12"
[top]
COMMAS
{commas:list}
{commas:list,lastsep}
{commas:list,lastsep,var,expr}
Takes a list and returns a plain english comma delimited string with
the items in it. For example,
{commas:{mklist:Tom,Dick,Harry}}
will return "Tom, Dick and
Harry". If you specify the lastsep argument, you can replace the "and"
with something else, such as "or" to get a result like "a, b or c".
Note: You need to be careful to include spaces around the "or" or else
you might get a result like "a, borc".
Example:
{commas:{mklist:a,b,c}, or }
If the var and expr arguments are passed, then for every item in the
list, it will set the value of the given variable name (which it will
declare) to the item, then evaluate expr, and use the result in the
string it outputs. Example: {commas:{contents:here},\, or
,v,{name:{&v}}}
will return the name of every object in the room in a
comma separated list, using ", or " as the final conjunction. ie: "Tom,
Can of SPAM, Dick, or Harry."
[top]
CONCAT
{concat:listname}
{concat:listname,obj}
Returns a string, containing the concatenated lines of a property
based list. It concatenates the list semi-intelligently, putting a
single space between lines normally, and two spaces between lines when
the previous one ended with a period, exclamation mark, or question
mark. A property based list is a series of properties that are
consecutively numbered. The server understands several different
formats, and can also read in property lists in either the propnameX
format, or the propname#/X
format. It does not
evaluate the contents of the list for embedded MPI
commands. If no obj
argument is supplied, then it looks for
the list somewhere down the environment from the trigger object.
Otherwise, it looks for the list down the environment from the given
object.
[top]
CONTAINS
{contains:obj1}
{contains:obj1,obj2}
Returns true if obj1
is within obj2,
or
within anything it contains, or within anything they contain. If
obj2
is not given, then it checks to see is
obj1
is held by the player, or by anything they hold, etc.
Basically, this just sees if obj1
is within the locational
environment of obj2.
[top]
CONTENTS
{contents:obj}
{contents:obj,type}
Returns a list of the contents of the given object. If a second
argument is passed to it, it restricts the listing to only those objects
that are of the given type. Either the object must be nearby the trigger
object, or else the owner of the trigger object must control the object.
Otherwise this will error out with a Permission Denied
error. The valid object type values are Room,
Thing,
Exit,
Player,
Program,
and Bad.
Hint: If you need
to get a list of two types of objects from the room, just concatenate
the lists from two calls to this function, with each object type you
want. For example:
{mklist:{contents:here,player},{contents:here,thing}}
- or -
{contents:here,player}{nl}{contents:here,thing}
[
CONTROLS
{controls:obj}
{controls:obj,player}
If one argument is given, then this returns true ("1") if the trigger
object's owner controls the given object. If two arguments are given,
then it returns true if the given player controls the given object.
Otherwise, this returns false. ("0") Wizards control everything
[top]
DEC | DECREMENT
{dec:var}
{dec:var,val}
Decrements the value of the given variable by one, returning the
result. If a value argument is given, then it will subtract that from
the variable, instead of the value 1.
[top]
DELAY
{delay:secs,expr}
Evaluates the given expression, then puts the result of that on the
timequeue, to execute after the given number of seconds. At that time,
the string is evaluated again, and displayed to the user, or to the
room, depending on whether it was run from a regular message such as
@succ,
or from an omessage such as @osucc.
Since the expression is evaluated both before and after being delayed,
you need to put MPI
code that is to run after the delay
within a {lit:expr}
command. If a {delay}
evaluation is a null string, then the notify or notify_except will not
be done. {Delay}
will return the process ID of the event
it puts on the timequeue.
[top]
DELPROP
{delprop:propname}
{delprop:propname,object}
This function will remove a property and all of its subsidiary
properties in the case that it is a propdir. This will delete the
property on the trigger object, unless an object argument is specified.
If one is, then it will delete the property on that given object. This
function returns a null string. If you specify a propname that is
protected, you will get an error of Permission Denied
. You
are only allowed to delete properties from objects that are owned by the
owner of the trigger object.
[top]
DICE
{dice:X}
{dice:X,Y}
{dice:X,Y,Z}
Given one parameter, picks a random number between 1
and
X.
(1dX)
Given two parameters, it randomly
generates Y
numbers between 1
and
X,
and adds them together. (YdX)
A third
parameter, if given, is just added to this sum as a modifier.
(YdX+Z)
[top]
DIST | DISTANCE
{dist:x,y} Returns distance from 0,0 that x,y
is.
{dist:x,y,z} Returns distance from 0,0,0 that x,y,z
is.
{dist:x,y,x2,y2} Returns distance between x,y and x2
,y2.
{dist:x,y,z,x2,y2,z2} Returns distance between x,y,z and x2,y2
,z2.
Given two arguments, this calculates the distance of a 2D point from
the origin. Given three arguments, this calculates the distance of a 3D
point from the origin. Given four arguments, this calculates the
distance between a pair of 2D points. Given six arguments, this
calculates the distance between a pair of 3D points.
[top]
DIV | DIVIDE
{div:expr1,expr}
{div:expr1,expr2,expr3...}
Returns the value of expr1
divided by
expr2.
Division by zero will return zero. If more than two
arguments are given, then the first argument is divided by the second,
and the result is divided by the third, etc, for all of the arguments.
For example: {div:180,6,3,5}
would be read like 180
/ 6 / 3 / 5
, and a result of 2 would be returned.
[top]
EQ | EQUALS | ==
{eq:expr1,expr2}
If expr1
and expr2
evaluate out to the same
value, then this returns true. Otherwise, this returns false. If both
expressions evaluate out to numbers, then this compares them
numerically.
[top]
EXEC
{exec:propname}
{exec:propname,obj}
Returns the string value of the given property, after having
evaluated any embedded MPI
commands that it contained. If
no object parameter is passed to it, it looks for the property somewhere
down the environment from the trigger object. Otherwise, it looks down
the environment from the object specified. If the property is not found,
this returns an empty string. If the property that it tries to access is
read restricted and the owner of the trigger object does not own the
object that the property is found on, then the MPI
script
stops with a Permission denied
error.
[top]
EXEC!
{exec!:propname}
{exec!:propname,obj}
Returns the string value of the given property, after having
evaluated any embedded MPI
commands that it contained. If
no object parameter is passed to it, it looks for the property on the
trigger. Otherwise, it looks for the property on the object specified.
If the property is not found, this returns an empty string. If the
property that it tries to access is read restricted and the owner of the
trigger object does not own the object that the property is found on,
then the MPI
script stops with a Permission
denied
error.
[top]
FILTER
{filter:var,list,expr}
{filter:var,list,exp,sep}
{filter:var,lst,exp,sep,s2}
This evaluates expr
for each and every item in the given
list. On each evaluation, the temporary variable var
will
contain the value of the item under scrutiny. This function returns a
list containing all of the items from the input list, for which
expr
evaluated true. Var
will only be defined
for the duration of expr,
and will be undefined after the
{filter}
construct finishes. If sep is given, then it uses
that string as the item seperator in the input list, instead of the
usual carriage return character. If s2
is defined, then it
will use that string to seperate the items in the list it returns,
instead of the normal carriage return. Sep
and
s2
can be multiple characters long.
[top]
FOLD
{fold:var1,var2,list,expr}
{fold:var1,var2,lst,expr,sep}
This takes a list and stores the first two items in var1
and var2,
then evaluates expr.
The value
returned by expr
is then put in var1,
and the
next list item is put in var2.
Expr
keeps
being evaluated in this way until there are no more list items left.
This returns the last value returned by expr.
If a sep
argument is given, the input list is assumed to have its individual
items delimited by that string, otherwise it assumes a carriage return.
[top]
FOR
{for:varname,start,end,increment,command}
Acts as a counting loop, like BASIC's for
loops. The
varname
is the name of the variable that it will create and
use to store the count value. The start value will be the initial value
of the variable, and the end value will be the value that the variable
is working towards. The increment is how much the variable will be
incremented by in each loop. The command will be evaluated for each
value of the variable between the beginning and ending values. For
example: {null:{for:i,10,1,-1,{tell:{&i}}}}
will echo a
countdown from ten to one, inclusive, to the user.
[top]
FORCE
{force:object,command}
Forces the given player or thing to do the given command. The thing
forced must be @flock
'ed to the trigger object, or the
trigger object's owner, and it must be set Xforcible, or else
this function will get a Permission denied
error. This
function returns a null string. {Force}
cannot force a
thing-object to do something, if it is set Dark,
is in a
room set Zombie,
if it has the same name as a player, or is
owned by a player set Zombie.
[top]
FOREACH
{foreach:var,list,expr}
{foreach:var,list,expr,sep}
This evaluates expr
for each and every item in the given list. On each evaluation, the temporary variable var
will contain the value of the item under scrutiny. Var
will only be defined for the duration of expr,
and will be undefined after the {foreach}
construct finishes. If sep
is given, then it uses that string as the item seperator in list, instead of the usual carriage return character. Sep
can be multiple characters long. This structure returns the result of the last evaluation of expr.
Example: {foreach:thing,{contents:here},{store:1,_seen}}
[top]
FTIME
{ftime:format}
{ftime:format,tz}
{ftime:format,tz,secs}
Returns a time string in the format you specify. See the MUF
Reference entry on timefmt for the
%subs
that you can use in the format string. If specified,
tz
is the number of hours offset from GMT. If specified,
secs
is the systime to use, instead of the current time.
{ftime:%x %X %Y,8,0}
will return the date and time for
systime 0, for the Pacific time zone.
[top]
HOW | &HOW
{&how}
The {&how}
variable is a short string telling what ran
the MPI
command. It can have the values `(@desc)',
`(@succ)',
`(@osucc)',
etc. for when it is run
from an @desc,
an @succ,
an
@osucc,
or whatever. It can also have the value
`(@lock)'
for when it is run from a lock test.
[top]
IF
{if:check,true}
{if:check,true,false}
This is a simple conditional command. It evaluates the
check
argument and if it is true, then it evaluates the
true
argument and returns its result. If check
does not evaluate as true, then it will evaluate the false
argument, if there is one, and returns its result. If there is no false
argument, and check
evaluated false, then it returns a null
string. Example:
Your computer is {if:{eq:2,3},broken!,All right.}
[top]
INC | INCREMENT
{inc:var}
{inc:var,val}
Increments the value of the given variable by one, returning the
result. If a value argument is given, then it will add that value to the
variable, instead of the value 1.
[top]
INDEX
{index:propname}
{index:propname,obj}
Returns the string value of the property whose name is stored in the
given property. This sounds confusing, but it's basically just the same
as {prop:{prop:propname}}
. If no object parameter is passed
to it, it looks for both the index property and the referenced property
somewhere down the environment from the trigger object. Otherwise, it
looks down the environment from the object specified for both of them.
If either property is not found, this returns an empty string. If the
property that it tries to access is read restricted, and the owner of
the trigger object does not own the object that the properties are found
on, then the MPI
script stops with a Permission
denied
error.
[top]
INDEX!
{index!:propname}
{index!:propname,obj}
Returns the string value of the property whose name is stored in the
given property. This sounds confusing, but it's basically just the same
as {prop!:{prop!:propname}}
. If no object parameter is
passed to it, it looks for both the index property and the referenced
property on the trigger object. Otherwise, it looks on the specified
object for both of them. If either property is not found, this returns
an empty string. If the property that it tries to access is read
restricted, and the owner of the trigger object does not own the object
that the properties are found on, then the MPI
script stops
with a Permission denied
error.
[top]
KILL
{kill:0}
{kill:processID}
Kills a process on the timequeue, that was possibly created by
{DELAY}.
If the process ID it is given is 0, then it will
kill all processes done by that trigger object. If the process to be
killed was not set off by that trigger, and was not set off by any
object that the owner of the trigger owns, then this will error out with
Permission denied
. If no process is found, this returns 0.
If a process was found, and the permissions were okay, then the process
is killed, and {kill}
returns the number of processes
killed. Usually one.
[top]
LEFT
{left:string}
{left:string,fieldwidth}
{left:string,fieldwidth,padstring}
Takes a string and pads it to fit the given fieldwidth, with the
string left justified. If no padstring is given, it assumes that it will
pad the string with spaces. If no fieldwidth is given, it assumes that
the field width is 78 characters. Example:
{left:Hello,10,_.}
would return the
string "Hello_._._"
[top]
LEXEC
{lexec:listname}
{lexec:listname,obj}
This takes a property based list, and concatenates all its lines
together, stripping spaces from the beginning and end of each one. It
then evaluates the result for MPI
commands, and returns the
resulting string. A property based list is a series of properties that
are consecutively numbered. The server understands several different
formats, and can also read in property lists in either the
propnameX
format, or the propname#/X
format.
If no obj
argument is supplied, then it looks for the list
somewhere down the environment from the trigger object. Otherwise, it
looks for the list down the environment from the given object.
[top]
LIST
{list:listname}
{list:listname,obj}
Returns a string, containing a carriage-return delimited list of
individual lines from a property based list. A property based list is a
series of properties that are consecutively numbered. The server
understands several different formats, and can also read in property
lists in either the propnameX
format, or the
propname#/X
format. It does not
evaluate the
contents of the list for embedded MPI
commands. If no
obj
argument is supplied, then it looks for the list
somewhere down the environment from the trigger object. Otherwise, it
looks for the list down the environment from the given object.
[top]
LISTPROPS
{listprops:propdir}
{listprops:propdir,object}
{listprops:propdir,object,pattern}
This function will return a list that contains the full names of all
the sub-properties contained by the given propdir. If not given,
object
defaults to the trigger object. If a pattern is
given, the sub-properties in the propdir are each compared against the
smatch wildcard pattern, and only those that match are returned in the
list. This comparison is only done on the last part of the property name
after the last /.
See also propdir
and smatch.
[top]
LMEMBER
{lmember:list,item}
{lmember:list,item,delimiter}
Returns 0
if the given item is not in the given list,
otherwise, it returns the item's position in the list. The first list
item in the list would return 1,
and the third would return
3,
for example. If the delimiter argument is given, then it
treats the list as if it were delimited by that string, instead of by
carriage returns. (\r
's) Example:
{lmember:{mklist:a,b,c,d,e,f},d}
would return
4.
[top]
LSORT
{lsort:list}
{lsort:list,var1,var2,expr}
Returns the sorted contents of list.
If 4 arguments are
given, then it evaluates expr with a pair of values, in
var1
and var2.
If expr
returns
true, then it will swap the positions of the two values in the list. It
runs this comparison on every pair of items in the list, so it will be
evaluated N*N times, where N is the number of items in the list. This
method can also be used to randomize a list. Example:
{lsort:{&list},v1,v2,{gt:{dice:100},50}}
[
LTIMESTR
{ltimestr:secs}
Given a time period, in seconds, this will return a string, including
a breakdown of all the time units of that period. For example, given a
number of seconds, it might return "1 week, 2 days, 10 mins, 52
secs".
[top]
MKLIST
{mklist:value...}
Returns a list with all the given values as list items, seperated by carriage returns. (\r
's) Example: {mklist:Tom,Dick,Harry}
returns "Tom\rDick\rHarry"
. Note: A maximum of nine items can be passed to the {mklist}
function. If you need more, you can chain {mklist}s
together. Example:
{mklist:{mklist:a,b,c,d,e,f,g,h,i},j,k,l,m,n,o,p}
[
MIDSTR
{midstr:str,pos}
{midstr:str,pos1,pos2}
Returns the substring that starts at pos1
within
str.
If no pos2
is given, then the returned
string is only the character at the given pos1
position. If
a pos2
position is given, then it returns the substring
beginning at pos1
and ending at pos2,
inclusive. If pos1
or pos2
are negative, then
they represent the position that is that absolute number of characters
from the end of the string. The first character in str
is
1, and the last one can always be referenced by -1. If a position would
be before the beginning of the string, it is assumed to be at the
beginning of the string. If it would be beyond the end of the string, it
is assumed to be at the last character. If the starting position is
later in the string than the ending position, then the returned string
has the characters in reverse order. If either pos1
or
pos2
are 0, then this returns a null string.
(""
)
[top]
MOD | MODULO
{mod:expr1,expr2}
Returns the leftover remainder of expr1
divided by
expr2.
If more than two arguments are given, then the first
arguments is modded by the second, then the result of that would be
modded by the third, and so on and so forth. For example:
{mod:91,20,3}
would be read as 91 % 20 % 3
,
and a result of 2
would be returned.
[top]
NE | NOTEQUALS | != |
<>
{ne:expr1,expr2}
If expr1
and expr2
evaluate out to the same
value, then this returns false. Otherwise, this returns true. If both
expressions evaluate out to numbers, then this compares them
numerically.
[top]
NEARBY
{nearby:obj}
{nearby:obj,obj2}
If one argument is given, then this returns true ("1") if the given
object is nearby to the trigger object. If two arguments are given, then
it returns true if the two objects are nearby one another. Otherwise,
this returns false. ("0") Nearby is defined as: 1) The two objects are
in the same location, or 2) One object contains the other, or 3) the two
objects are in fact the same object.
[top]
NL | \r
{nl} or \r
Returns a carriage return character. This can be used to seperate items in a list, or can split the string at that point, starting a new line. Example: the string:
This is\ran example{nl}of using newlines.
would print out like:
This is
an example
of using newlines.
[
OTELL
{otell:string}
{otell:string,room}
{otell:string,room,player}
This will tell the given string to all the players in the room,
except for the given player. If no room argument is given, it is assumed
to be the room that the triggering player is in. If no player is given,
then it assumes that you want to skip sending the message to the
triggering player. If you pass it a player of #-1, it will send the
message to all the players in the room. This returns the message that
was sent. If the trigger isn't a room, or an exit on a room, and if the
message doesn't already begin with the user's name, then the user's name
will be prepended to the message.
[top]
PARSE
{parse:var,list,expr}
{parse:var,list,expr,sep}
{parse:var,list,expr,sep,s2}
This evaluates expr
for each item in the given list. On
each evaluation, the temporary variable var
will contain
the value of the item under scrutiny. This function returns a list
containing the output of expr
for each item within the
list. This lets you do direct translation of a list of dbrefs, for
example, into a list of names. var
will only be defined for
the duration of expr,
and will be undefined after the
{filter}
construct finishes. If sep
is given,
then it uses that string as the item seperator in the input list,
instead of the usual carriage return character. If s2
is
defined, then it will use that string to seperate the items in the list
it returns, instead of the normal carriage return. Sep
and
s2
can be multiple characters long.
[top]
PROP
{prop:propname}
{prop:propname,obj}
Returns the literal string value of the given property. If no object
parameter is passed to it, it looks for the property somewhere down the
environment from the trigger object. Otherwise, it looks down the
environment from the object specified. If the property is not found,
this returns an empty string. If the property that it tries to access
is read restricted and the owner of the trigger object does not own the
object that the property is found on, then the MPI
script
stops with a Permission denied
error.
[top]
PROP!
{prop!:propname}
{prop!:propname,obj}
Returns the literal string value of the given property. If no object
parameter is passed to it, it looks for the property on the trigger.
Otherwise, it looks for the property on the object specified. If the
property is not found, this returns an empty string. If the property
that it tries to access is read restricted and the owner of the trigger
object does not own the object that the property is found on, then the
MPI
script stops with a Permission denied
error.
[top]
PROPDIR
{PROPDIR:propname,obj}
If the given property on the given object is a propdir, containing
sub-properties, then this returns true. Otherwise it returns false.
Object will default to the trigger object, if not given.
[top]
RIGHT
{right:string}
{right:string,fieldwidth}
{right:string,fieldwidth,padstring}
Takes a string and pads it to fit the given fieldwidth, with the
string right justified. If no padstring is given, it assumes that it
will pad the string with spaces. If no fieldwidth is given, it assumes
that the field width is 78 characters. Example:
{right:Hello,10,_.}
would return the string
"_._._Hello"
[
SELECT
{select:value,listname}
{select:value,listname,object}
Returns the value of a single list item from a sparse property list. The item chosen is the one who's line number is the largest one that is less than or equal to the given value. If the list is missing any items, then {select}
will return the item in the list with the highest line number that is less than or equal to the given value. For example, if the list has the following entries:
_junk#/1:one
_junk#/5:two
_junk#/16:three
_junk#/20:four
Then {select:9,_junk}
will return "two",
{select:16,_junk}
will return "three",
and
{select:25,_junk}
will return "four".
[top]
SMATCH
{smatch:str,pattern}
Matches str
against the wildcard pattern. If there is a
match, this returns true, or "1".
If it doesn't match, this
returns a value of "0",
or false. In wildcard patterns, the
following characters have the following meanings:
|
* |
matches any number of any character |
|
? |
matches one character, of any type |
|
[abcde] |
matches one char, if it is a, b, c, d, or e |
|
[a-z] |
matches on char, if it is between a and z, inclusive |
|
[^abd-z] |
matches one char if it is NOT a, b, or beteen d and z |
|
{word1|word2} |
matches one word, if it is word1, or word2 |
|
{^word1|word2} |
matches one word, if it is NOT word1 or word2 |
|
\ |
escapes any of the prev chars, making it not special |
STIMESTR
{stimestr:secs}
Given a time period, in seconds, this will return the most
significant time unit of that time period. For example, a number of
seconds, that is equivalent to 9 days, 23 hours, 10 minutes, and 52
seconds, will be have the value 9d
returned, as the
abbreviated most significant time unit.
[top]
STORE
{store:val,prop}
{store:val,prop,obj}
Stores a string value in a given property. If no obj parameter is
given, then it stores the property on the trigger object. Otherwise, it
will store it on the given object. If you specify a propname that is
protected, you will get a Permission denied
error. You are
only allowed to store properties on objects controlled by the owner of
the trigger object. The trigger object is the object that triggered the
evaluation of the MPI
commands. This function returns the
string that is stored as the prop value. If you store a null value in
the property, then it will remove the property if it is not a propdir.
It will clear the value of the prop if it is a propdir.
[top]
SUBLIST
{sublist:list,pos1}
{sublist:list,pos1,pos2}
{sublist:list,pos1,pos2,sep}
Takes a list, and returns a subset of the list items within it. The
subset is all the list items between list item pos1,
and
list item pos2,
inclusive. If the pos2
argument is omitted, it assumes that pos2
is the same as
pos1.
If pos2
is less than pos1,
then all the list items between pos2
and pos1
are returned, in reversed order. If pos1
or
pos2
are negative, it counts that many list items back from
the end of the list, so -1
is the last list item, and
-5
would be the fifth from last list item. The input list
is assumed to be delimited by carriage returns (\r
) unless
the sep argument is given.
[top]
SUBST
{subst:str,old,new}
Returns a copy of str
with all substring instances of
old
replaced by the text specified by new.
Basically just substitutes the new text for the old text in
str.
Example: {subst:Hello World!,l,r}
would
return "Herro Worrd!"
[top]
SUBT | SUBTRACTION
{subt:expr1,expr2}
{subt:expr1,expr2,expr3...}
Returns the difference of the values expr1
and
expr2.
If more than two args are given, all values are
subtracted from the first value in sequence. For example:
{subt:10,3,2,4}
would be read as 10 - 3 - 2 -
4,
and it would return a result of 1.
[top]
TELL
{tell:string}
{tell:string,player}
If passed only a string, tells the user that string. If passed both a
string, and a player dbref, it will tell the given player the message.
This returns the message that was sent. If the trigger isn't a room, or
an exit on a room, and if the message doesn't already begin with the
user's name, then the user's name will be prepended to the message. The
two exceptions to this are that if the messages is being sent to the
owner of the trigger, or to the user, then the user's name will not be
prepended.
[top]
TESTLOCK
{testlock:obj,prop}
{testlock:obj,prop,who}
{testlock:obj,prop,who,def}
Tests the lock property prop,
on obj
against the given player who.
If no who
argument is given, then it checks the lock against the using player. If
a def
argument is given, then the lock will default to that
value, if there is no lock property of the given name on the given
object. Returns true if the lock is locked against the player.
[top]
TIMESUB
{timesub:period,offset,listname}
{timesub:period,offset,listname,object}
This is sort of like {list},
except that it will only
return one line of the given named property list. The line it chooses
depends on the time. The period is the length of time, in seconds, that
it takes for {timesub}
to cycle through the entire list.
The offset is the number of seconds to offset into the time period, if
you actually need to synchronize the {timesub}
with
something. The offset usually is just left at zero. If the object
argument is not passed, it looks for the list on the trigger. What this
all means, is that if you have, for example, a period of 3600 (one
hour), an offset of zero, and a property list that has six items in it,
then {timesub}
will return the first line of the property
list during the first ten minutes of the hour, the second line during
the next ten minutes, and so on, until it returns the last line during
the last ten minutes of the hour. Then it returns the first line for the
beginning of the next hour. Here's an example:
{timesub:86400,0,_sunmoon}
This example will show different property list lines, depending on
the time of day. The period is 86400 seconds, which is one day. If the
property list has 24 items in it, then a different line will be returned
for each hour of the day.
[top]
WITH
{with:var,val,expr..}
This defines a new variable with the given name, and sets its value
to the given val.
Up to 7 expr's
are allowed,
but the only value returned to {with}'s
caller, is the
value returned by the evaluation of the last expr.
If there
is already a variable of the same name, then this command will override
that variable, for the duration of the {with:}
command. The
new variable is only valid to use within the confines of the
{with:}
command, and it will go away after the command
completes. This provides scoped variables quite effectively.
Note: There can be no more than 32 variables defined at any
one time, total. This includes variables that are defined within macros,
or properties or lists that are executed with {exec:}
or
{lexec:}.
Here's an example to illustrate the scope of
variables inside of {with:}
commands:
{prop:_mydesc} <- {&people} not defined
{with:people,{contents:here,players}, <- Defining. Not available yet
{if:{count:{&people}}, <- It's usable now
The players awake here are
{lit: } <- just puts in a space
{commas:{&people},{lit: and },
who,{name:{&who}} <- uses {&who} as temp var
} <- {&who} no longer defined
}
} <- {&people} no longer defined
[