[Package Index | Mudlib Index | Effect Index]
File /obj/handlers/random_names.c
Generates random names for whatever reason.
Werd - a perl script that generates random words according to some
simple rules (inspired by phrase structure trees in Syntax).
Based on a program by Mark Rosenfelder (markrose@spss.com)
called psrGrammar
Rewritten in perl by Chris Pound (pound@rice.edu)
Rewritten in lpc by Pinkfish@Discworld MUD.
10th of January 1996.
Added a new form of randomised names based on a start bit, middle bit
and end bit.
Includes
This class includes the following files /include/player_handler.h and /include/random_names.hClass Index
Method index
Public Functions
These are functions that everyone can access.
-
add_test_language
void add_test_language(string lang)
This method adds in a language as a test language.
- Parameters:
lang - the test language to add
-
open_file
void open_file(string f)
Read in a random name grammer from the data dir. Any line with
# at the start is considered a comment, and anything after
a # on a line is ignored. Every line in the file will have
3 fields seperated by a :. The first field is the name
the second is a one letter expansion string, the third is a
a space separeted list of things to expand it to.
The word starts off as a "W", this is looked up in the expansion
first string list. If it is found then that is expanded to
a random selection of the space seperated data elements. This
process is repeated until there are no bits in the word that can
be expanded.
- Parameters:
f - the name of the file to read
-
open_sylable_file
int open_sylable_file(string fname)
This method reads in a sylable file definition. The format of this
file is [startstav] marks the start of the first bits. [mittstav]
marks the middle bits and [slutstav] marks the end bits. Every line
between the sections is included as part of a name. [stop] marks
the end of the file, anything else in the file is ignored.
- Parameters:
file - the filename to parse
- Returns:
1 on success, 0 on failure
-
query_languages
string * query_languages()
The list of all the current languages known.
- Returns:
an array of the language names.
-
query_test_languages
string * query_test_languages()
This is the list of test rules in the handler.
- Returns:
the list of test rules
-
random_name
string random_name(string lang)
Returns a random name depending on the type of language.
- Parameters:
lang - the language to use
-
random_name_sylable
string random_name_sylable(string lang)
This returns a random name based on the sylable language type.
- Parameters:
lang - the language to use
-
random_name_werd
string random_name_werd(string lang)
Generate a random name in the given language.
- Parameters:
lang - the language to generate teh name int
- Returns:
the random name
-
remove_test_language
void remove_test_language(string lang)
This method removes a language as a test language.
- Parameters:
lang - the test language to remove
-
unique_name
string unique_name(string lang)
Return a name that is not banished or a player name already.
It is > 2 and < 11 chars, it is not banished, a player or
in the game.
- Parameters:
lang - the language to generat ethe name in
- Returns:
the generated name
Classes
These are nice data types for dealing with... Data!