Man language
From LSWiki
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Files
/lib/language.h /mod/character/language.c /mod/character/communication.c
Description
The language system mediates ordinary communication between intelligent beings. The languages usable are defined in language.h, as well as the different levels of comprehension possible with them.
Wizards automatically understand all languages and are 100% comprehensible to all who hear them, no matter what language they use. With normal communication commands, one may append "in <language>" to the end of the string to be spoken.
Functions
string language_status();
Returns a natural-language string outlining the living's linguistic capabilities.
void add_language(string lang);
Adds a language at base (no comprehension) level to the target's languages data. Must be a valid language from language.h
string query_native_language();
Returns the subject's native language. The native language is the one spoken by default if none is specified; also, if a message heard is in this language, no text such as "in Anglic" or "in Sperethiel" will be appended to the end.
string set_native_language(string lang);
Sets the subject's native language. He must at least be able to recognize this language.
void set_language_level(string lang, string level);
Sets the subject's comprehension level with 'lang' to 'level'. 'level' must be a valid comprehension level from language.h; if the subject does not already have the language in its data mapping, it will be added.
void set_comprehend_func(object obj);
Sets a comprehend_func object for purposes of tongues/babel spells and the like. comprehend_func in obj will be sent three arguments: the player attempting to comprehend something, the language the message is in, and the appropriate comprehension type flag (see the section on query_language_comprehension()). It should return a percentile modifier to the person's chance of understanding a given word.
status query_recognize_language(string lang);
Returns whether or not the person will recognize the name of the language specified. If it is in their data mapping at all, they will recognize it by name.
status query_speak_language(string lang);
Returns whether or not the person understands enough of the language to attempt to speak it.
string query_language_level(string lang);
Returns the person's base comprehension level with the language.
int query_language_comprehension(string lang, int type);
Returns the person's percentile comprehension level with the language. This is computed using the base comprehension level, their intelligence bonus, their linguistics skill if any, and any comprehend_func present. The value returned is their chance of understanding any given word of the language. The 'type' variable should be one of six macros from language.h: Comp_Speak for ability to speak, Comp_Hear for deciphering spoken language, Comp_Read for understanding written language, Comp_Write for writing, Comp_Send for telepathic transmission that uses language, and Comp_Receive for similar telepathic reception. If the type is Comp_Read or Comp_Write, then the comprehension level is limited to 1.5 times the character's Literacy skill before any comprehend_func modifiers are applied.
string message_comprehension(string text, string lang, int type, int mod);
Processes the string 'text' according to the subject's comprehension of 'lang', modified percentile-wise by 'mod'. If the person cannot understand any of it, No_Comprehension from language.h will be returned. The 'type' argument is the same as is used by the function query_language_comprehension() above, and has the same effects.