[Intro] [News Files] [Help Files] [System] [Characters] [Maps] [Links] [Staff]
|
This section covers soft-coded functions of general usefulness.
|
| [ help | ooc | ic | character | jobs | mail | bbs | functions | social] |
| [ andlist | class | contest | denied | emote | forcesize | getlast | isguest | langnote | language | linfo | list | lookcon | map functions | multicolumn | th | time] |
Function: andlist(<list>, [<delimiter>], [<default>])
Uses registers: r(8), r(9)
andlist() takes a <list> and separates it with commas with an appropriate "and" at the end.
If the <list> is empty, it will print the <default> string.
If the <list> is delimited by something other than a space, <delimiter> can be specified.
E.g. say andlist(Jack Jill)
You say, "Jack and Jill"
say andlist(Tom|Dick|Harry,|)
You say, "Tom, Dick and Harry"
say andlist(,,None)
You say, "None"
Also see: help itemize()
Function: class(<dbref>)
Uses registers: NONE
class() returns the player-class for the specified dbref. It returns #-1 if <dbref> is not a player.
Possible classes are:
Guest Player is one of the publically available guest characters.
Visitor Player is a personal character, not yet approved for role-play.
Builder Player is a builder character, not used for role-play.
Player Player is a normal player, approved for role-play.
Architect Player is an architect. (see +news admin/architects)
Wizard Player is an architect with a wizard bit. (see +news as above)
God Player is #1. The God character.
Function: contest(<challenge value>,<defending value>,<advantage>)
Uses registers: None
contest() performs a contest between two values exactly as +contest does, except that if you want to add in a Multi bonus, you have to do it yourself. The challenge and defending values are integers, the <advantage> parameter is 1 if the challenger has Advantage, -1 if the defender has Advantage, and 0 (or absent) if neither side does.
It returns values as follows:
2 - automatic win for challenger
1 - win for challenger
0 - tie
-1 - win for defender
-2 - automatic win for defender
If you dont care about automatic wins, you can always use sign(contest(...)).
See also: +help character/contest
Function: denied()
Prints a permission denied message: Game> Permission denied.
Function: emote(<message>, <name>, <prefix>)
Uses registers: None
emote() expands <message> using the ';' ':' '"' rules for poses, etc. The formatted string is returned as shown in the example below. By default, (no ; or : or ") the <message> will be handled as a 'say'.
E.g.:
@pemit me=emote(:screams!, name(me), At your table:%b)
At your table: Camden screams!
Note: emote() is adapted (in syntax) from City of Darkness's emote().
Function: forcesize(<message>, <length>)
Uses registers: None
forcesize() returns <message> as exatcly <length> characters in length. It will truncate the string if too long, and pad with spaces if too short. Useful in formatting tables and such.
See also: +help func/multicolumn()
Function: getlast(<creator dbnum>,room|exit|thing|player)
Uses registers: none
getlast() will return <creator>'s most recently-created item in the requested category.
E.g., getlast(num(me),room) would return the last room you @dig'd.
Function: isguest(<dbref>)
Uses registers: NONE
isguest() returns 1 if the specified db-ref is one of the guest characters managed by the multi-guest manager. Otherwise it returns 0.
Usage: langnote(<language>, <text>)
The 'langnote()' function is designed to be used to write notes in other languages. It uses the language skill of the enactor (ie, the person reading the note). It returns "It's written in a foreign language" if the reader cant understand it, "It's written in <language>" if the reader can recognize <language>, 'In <language>, it says "<output text>"' if the reader can understand it.
If there are commas in the input text, put a backslash before each comma.
For example, a note, written in French:
@desc note=[langnote(French,I love you\, Marie)]
langtext(<who>, <language>, <text>) - process text through language system
langnote(<language>, <text>) - implement notes in other languages
The langtext() function is a full interface to the language processing. The langnote() function is a simple interface to write notes in other languages. (see '+help functions/langnote')
The 'langtext()' function can be used to determine what a player could say or understand in a given language. It returns the edited text, or one of the following special tokens:
#UNKNOWN# - means that <who> cant speak or understand <language>.
#RECOGNIZED# - means that <who> cant speak or understand <language>, but can
recognize what language it is.
If you're using this to do speaking, you must process the string twice. Once to see how well the speaker can say the string, and once to see how well the listener can understand it.
Note that you must escape commas in the input string by preceding them with backslashes or enclosing the whole string in braces.
Function: linfo(<item>) -> <attribute-name> <type>
Uses registers: 9
This function tells you what attribute on a character <item> would be
stored in. Item may be a stat, string, list-name, or list-item. It also
returns <type> to tell you which of the above the item is. It takes
wild-cards, and will return the first match it finds if they are used.
It doesnt attempt unambigous matching.
e.g:
linfo(alertness) -> 'TALENTS Stat'
linfo(demeanor) -> 'STR-RACE String'
linfo(beast-traits) -> 'BEAST-TRAITS List'
linfo(furious) -> 'BEAST-TRAITS ListItem'
Function: statlist(<obj>, <list>, <item>) -> 0 | 1 | -1
Uses registers: 9, 8
This function checks whether <obj> has <item> set in <list>. <list> may
be any of the lists valid for +setlist, namely:
inhumanities, beast-traits, stigmas, rituals
0 is returned if <item> is absent, 1 if it is present, and -1 on error.
e.g:
statlist(*calum,beast-traits,blood smell) -> '0'
list(*calum,inhumanities,blood smell) -> '-1'
Function: lookcon(<object>)
Uses registers: None
lookcon() returns the dbnums of all visible items in location <object>. Works just like lcon, but is more useful for coding objects to act like players.
See also: help lcon() Similar to: lcon(<object>,V) elsewhere.
gridname(<character>)
gridname(<character>)
gridnum(<character>)
domchar(<character>)
domroom(<room>)
gridname(<character>)
This returns the name of the outside grid room that corresponds to the &grid attribute set on the room in which the specified <character> is located. Ansi in the room's name is evaluated. If no &grid attribute is found, #-1 is returned.
gridnum(<character>)
This returns the dbref# of the outside grid room that corresponds to the &grid attribute set on the room in which the specified <character> is located. If no &grid attribute is found, #-1 is returned.
domchar(<character>)
This returns the name of the domain specified by the &domain attribute either set on a room or on a room's parent. Ansi is evaluated. If no &domain attribute is found, #-1 is returned.
domroom(<room>)
This returns the name of the domain specified by the &domain attribute set on the specified room. Ansi is evaluated. If no &domain attribute is found, #-1 is returned.
Examples:
> think gridname(me)
La Brea - Hollywood
> think gridnum(me)
#307
> think domchar(me)
Greater Downtown
> think domroom(here)
Greater Downtown
Function: multicolumn(<list>,<columns>[,<T>])
Uses registers: 9, 8, 7
multicolumn() prints the space separated <list> in <columns> columns. If <T> is specified, the columns are truncated to fit, otherwise they can push the following columns over. <columns> should be between 2 and 6 to be useful, probably.
E.g.:
multicolumn(a b c d e f g,3)
-would print the letters in 3 columns.
Note: The output starts with a newline - this is usually what you want, if not, use after(multicolumn(...),%r)
Function: th(<num>)
Uses registers: NONE
Given Returns
1 1st
2 2nd
(etc)
The +time system offers the following functions to programmers:
vsecs() - the current virtual time in the same format as secs()
vtime() - the current virtual time in the same format as time()
vsecs2secs(s) - given a virtual time in secs() format (s), convert to the
corresponding RL time. (will not be accurate outside current VR day)
secs2vsecs(s) - given an RL time in secs() format (s), convert to the
corresponding VR time. (will not be accurate outside current VR day)
lightlevel() - return LIGHT, DARK, or TWILIGHT
moonphase() - return the moonphase as a fraction of the current cycle
moon() - return the moonphase in text form
ftimeratio() - return the current VR:RL time ratio
interval(s) - given a number of seconds (s), print in the format used by
WHO for idle times (eg: 10s, 5m, 2h, 3d, etc)