[MUD-Dev] Adjective Server

Christopher Allen gmfangs at asmrb.org
Thu Jan 14 15:10:22 New Zealand Daylight Time 1999


There has been some discussion about how to make descriptions more varied
and relevant to play. One of my favorite methods in an LPMUD derived system
called DartMUD is the adjective server.

Basically the way the adjective server works is text within curly braces is
interpreted. The first word defines the adjective, the rest of the text to
the end brace is the data for the specific adjective.

Adjectives started off as a method to solve the problem of size with
different size characters, but since it was a generic mechanism it since
has been expanded to 40+ different adjectives. For instance, it can display
differently depending on the "detail_vision" attribute, or garble some text
based on how much skill you have in a language, or different for different
times of day, etc.

>From the man files on dartmud.com:2525
>parse_string(1) -- parses string with stat/skill info with adjective server
>
>string parse_string(string str,object player);
>
>Replaces str with a new string modified by calling the adjective server
>which uses stats/skills of this_player().  player is optional, and if
>supplied, this_player() will become player.  If str is 0, parse_string()
>will also return 0.  Best described by examples:
>
>   str = parse_string("&& {size:100} sword.");
>
>might return
>
>   str == "An extremely large sword.";
>
>say if viewed by a gnome.  The function size() is called with arg 100 in
>the /std/serv/adjective server and returns (in this case) "extremely large".
>& is converted to "a" or "an". (&& for capital letters)  Instead of calling
>the adjective.c server, you can redirect to the current object by using
>{*function:arg}, e.g.
>   str = parse_string("&& {size:100} {*magic:50} dagger.");
>
>would call size(100) in /std/serv/adjective.c, and would call magic(50)
>in this_object().  Finally, the object filename to call can be given,
>e.g. {/usr/fermat/adjective:size:100} would call size(100) in the object
>/usr/fermat/adjective.c.  If a string is to be returned "unparsed", then
>a common convention for calling a function inside that object is to use
>
>   return "&& {/" + file_name() + ":size:100} dagger";
>
>Note also that to capitalize the return string, you need only capitalize
>the first letter of the function name. e.g. {Size:100}.
>NOTE: the filename has to start with a '/'!
>
>In addition to sending integer args, you can send string args as well.  If
>the first letter is non-numeric, parse_string will assume it is a string,
>also you can put strings inside "'s, example:
>
>   str = "{Personal:fermat} looks at the basket.\n";
>would call personal("fermat") in the adjective server.
>
>Look at the file /std/serv/adjective.c for available functions, and
>consult with a major creator if you want more added.
>
>There are some built-in things that parse_string() will recognize.  If a
>{w} appears in the front, then the string will be sent through word_wrap(1).
>A {u} in the front will indicate that the string should remain "unparsed".
>
>In addition, there is a special syntax for languages.  For example,
>
>   write("{w} The sign says '{L:gnomish:50:text}'\n");
>
>Everthing where the 'text' is will be put in gnomish, with "difficulty"
>at 50. (old gnomish...hard to read)  The number will default to 100,
>so just {L:gnomish:text} would suffice. 
>
>See also: adjective(7), adjectives(7), color(8), oneof(7),
>language(7), timeline(7), and word_wrap(1).


>From dartmud.com:2525
>adjective(7) -- adjective server info
>
>The adjective server is called from parse_string(1), to insert stat/skill
>varying adjectives into strings.  The following functions exist so far:
>
>size(n)     - large/small  \
>height(n)   - high/low      \
>length(n)   - long/short     }--- based on size
>width(n)    - wide/thin     /
>depth(n)    - deep/shallow /
>speed(n)    - fast/slow based on agility
>sound(n)    - loud/faint based on hearing
>number(n)   - replaces integer n with numeral ("two", "fifteen", etc)
>
>All of which reside in the file /std/serv/adjective.c.  Size() thru
>sound() each call a function describe(), which compares the size/agility/etc
>of the viewer, with n.
>
>Here is an example of size(n) for a size 100 viewer and size 50 viewer.
>                    size 100 viewer  size 50 viewer
>   extremely small   21 and below      10 and below
>   very very small   22 to  31         11 to 15
>   very small        32 to  43         16 to 21
>   small             44 to  62         22 to 31
>   somewhat small    63 to  87         32 to 43
>                     88 to 124         44 to 62
>   somewhat large   125 to 174         63 to 87
>   large            175 to 249         88 to 124
>   very large       250 to 349        125 to 174
>   very very large  350 to 499        175 to 249
>   extremely large  500 and up        250 and up
>
>Basically it is broken up into categories, based on the premise that
>doubling in size moves you down exactly two catagories.
>
>See also: adjectives(7), color(8), oneof(7), language(7),
>parse_string(1), timeline(7), and word_wrap(1).


In particular I wrote two adjectives oneof() and timeline() which I found
tremendously powerful:

>oneof(7) -- adjective for randomly selecting a phrase from list
>
>oneof() is an adjective in the adjective server "/std/serv/adjective.c" that
>allows you to add variety to your descriptions by allowing you to have
>having minor random differences each time your description is seen.
>
>Basically oneof() will randomly chose from phrases separated by vertical
>bars "|" one phrase, with each phrase given equal weight.
>
>Example:
>
>parse_string("{w}{oneof:You are standing in a|This room is a} great "+
>             "hall{oneof:full of|bustling with|jam packed with|crowded "+
>             "with} all {oneof:sorts|kinds|types|creeds|races} of "+
>             "{oneof:folk|people}.");
>
>This would generate one of 80 possible different descriptions.
>
>It is also possible to have null (blank) phrases, for example:
>parse_string("{w}{oneof:|||test|||}");
>
>This will only only return the phrase "test" one time in 6.
>
>NOTE: It is not possible to have phrases that include colons or vertical
>bars! This is because the parser uses that colons to break up arguements in
>adjectives, and oneof() only accepts one arguement and parses the vertical
>bars into separate phrases.
>
>NOTE: I haven't tested the upper bounds of how many "oneof" phrases you can
>have -- from my reading of the docs I think the standard system array size
>max for explode is the system max of 1000, so don't do more than 1000
>choices, please ;->
>
>-- Nephilim
>
>See also: adjective(7), adjectives(7), timeline(7), and parse_string(1).

>From dartmud.com:2525
>timeline(7) -- adjective giving text for different times of the day
>
>timeline() is an adjective in the adjective server
>"/std/serv/adjective.c" that allows you to add variety to your
>descriptions by allowing you to have having minor differences
>depending on the time of day as given by the time server.
>
>Basically timeline() will chose from phrases separated by vertical
>bars "|" one phrase in order LATENIGHT|SUNRISE|MORNING|NOON|
>AFTERNOON|SUNSET|NIGHT, based on current time value returned by the
>the time server.
>
>Example:
>
>return "{w}{timeline:The streetlights flicker. |The sunrise is nice. |"+
>       "You smell breakfast. |The sun is high. |Children play here. |"+
>       "The sunset is pretty.|Its a spooky night. }";
>       
>From midnight until an hour before dawn:             The streetlights flicker.
>From an hour before dawn 'til an hour after dawn:    The sunrise is nice.
>From an hour after dawn 'til hour before noon:       You smell breakfast.
>From an hour before noon 'til an hour after noon:    The sun is high.
>From an hour after noon 'til an hour before sunset:  Children play here.
>From an hour before sunset 'til an hour after sunset:The sunset is pretty.
>From an hour after sunset 'til midnight:             Its a spooky night.
>
>NOTE: It is not possible to have phrases that include colons or vertical
>bars! This is because the parser uses that colons to break up arguements in
>adjectives, and timeline() only accepts one arguement and parses the vertical
>bars into separate phrases.
>
>-- Nephilim
>
>See also: adjective(7), adjectives(7), oneof(), and parse_string(1).

A good adjective facility can be used for many things, these all from dartmud:

>From dartmud.com:2525
>
>
>		if a high value   if a small value  if a moderate value
>		---------------  ----------------  -------------------
>height    	- high         		low 		"" 
>size          - large             	small  		""
>length      	- long            	short   	""
>width         - wide             	thin    	""
>speed        	- fast         		slow 		""
>depth        	- deep            	shallow 	""
>sound    	- loud            	faint        moderate
>physical_scale  - large        	small     about your size
>                                  + compared to you
>perceived_light - 
>
>day                             - {day:daystring:nightstring}
>                                  returns the "daystring" during the 
>				    daytime, the "nightstring"
>                                  during the night
>                                
>dim                             - bright/dim/dark/""
>shadowy                 - bright/shadowy/dark/""
>dark                    - bright/dark/extremely dark/""
>dimly_lit               - brightly/darkly/dimly/lit
>dimly_lit_o             - brightly/dimly/""/lit
>
>number                  - 
>one/two/three/.../ten/eleven/twelve/.../twenty/thirty/.../hundred/.../
>                                  thousand/.../million/
>
>count                   - exactly/at least
>
>round_off               - 1/5/10/25/50/100/250/500/1000/3000/alot
>
>personal                - you
>person                  - you
>possessive              - your
>persons                 - your
>person_is               - you are
>person_was              - you were
>is_monster              - 
>
>strength        
>intelligence    
>detail_vision   
>distance_vision 
>night_vision    
>smell                           
>hearing                 
>dexterity               
>agility                 
>constitution            
>resilience              
>power                   
>will                            
>
>race
>race_handle
>
>announce_hit
>
>announce_miss
>
>rand
>
>creator
>
>weapon_name
>weapon_short
>
>exists
>
>aura
>
>ree
>
>blue
>green
>cyan
>magenta
>brown
>lt_gray
>dk_gray
>lt_blue
>lt_green
>lt_cyan
>lt_red
>lt_magenta
>white
>blink
>underline
>reverse
>
>l
>
>garble                  - 
>oneof           
>timeline
>
>
>These all have an argument of the form:
>#~string or
>#-#~string
>
>They simply return the string part of the argument if the person's stat is
>greater than the number (in the case of #~string) or if it's in the range
>(in the case of #-#~string).
>
>
>strength
>intelligence
>detail_vision
>distance_vision
>night_vision
>smell
>hearing
>dexterity
>agility
>constitution
>resilience
>power
>will
>
>See also: adjective(7), color(8), oneof(7), language(7),
>parse_string(1), timeline(7), and word_wrap(1). 
-----------------------------------------------------------------------
.. Christopher Allen                          1563 Solano Ave., #353 ..
.. <gmfangs at asmrb.org>         ;->           Berkeley, CA 94707-2116 ..
..                                                     h510/528-9899 ..
..                                       f510/649-3301 o510/649-3300 ..




More information about the MUD-Dev mailing list