<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lostsouls.org/w/skins/common/feed.css"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.lostsouls.org/w/index.php?action=history&amp;feed=atom&amp;title=Man_mentation</id>
		<title>Man mentation - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.lostsouls.org/w/index.php?action=history&amp;feed=atom&amp;title=Man_mentation"/>
		<link rel="alternate" type="text/html" href="http://wiki.lostsouls.org/w/index.php?title=Man_mentation&amp;action=history"/>
		<updated>2026-04-24T05:33:09Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.8.2</generator>

	<entry>
		<id>http://wiki.lostsouls.org/w/index.php?title=Man_mentation&amp;diff=3996&amp;oldid=prev</id>
		<title>Laine at 22:12, 11 June 2007</title>
		<link rel="alternate" type="text/html" href="http://wiki.lostsouls.org/w/index.php?title=Man_mentation&amp;diff=3996&amp;oldid=prev"/>
				<updated>2007-06-11T22:12:50Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
Ain Soph enables the handling of game functionality actuated by&lt;br /&gt;
in-character mental processes; e.g. a helm which projects flames when&lt;br /&gt;
you think a command word, a gem that heals you when you visualize a&lt;br /&gt;
caduceus.&lt;br /&gt;
&lt;br /&gt;
==Files==&lt;br /&gt;
&lt;br /&gt;
 /mod/character/mind.c&lt;br /&gt;
 /lib/thought.h&lt;br /&gt;
 /daemon/command/character/believe.c&lt;br /&gt;
 /daemon/command/character/concentrate.c&lt;br /&gt;
 /daemon/command/character/disbelieve.c&lt;br /&gt;
 /daemon/command/character/imagine.c&lt;br /&gt;
 /daemon/command/character/subvocalize.c&lt;br /&gt;
 /daemon/command/character/think.c&lt;br /&gt;
 /daemon/command/character/visualize.c&lt;br /&gt;
 /daemon/command/character/will.c&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The mentation mechanism enables wizards to implement character abilities&lt;br /&gt;
which are actuated by thought processes.  Many items and organizations add&lt;br /&gt;
various capabilities to players by using add_action() to create arbitrary&lt;br /&gt;
command structures.  Many of these capabilities are better handled through&lt;br /&gt;
speech or thought actuation; this system covers the latter.&lt;br /&gt;
&lt;br /&gt;
Thought-actuated events, or simply &amp;quot;thoughts&amp;quot;, are created using the&lt;br /&gt;
function add_thought(), which exists in all living objects.  Its syntax&lt;br /&gt;
is as follows:&lt;br /&gt;
&lt;br /&gt;
 mapping add_thought(mixed tag, string arg, int flags, int activity,&lt;br /&gt;
     closure fcan, closure fdo);&lt;br /&gt;
&lt;br /&gt;
'tag' is a string or array of strings which the thought 'keys' on, or 0&lt;br /&gt;
to key on any string.  For example, if you wanted your thought to activate&lt;br /&gt;
when someone thought of trees, you might send a value of &amp;quot;trees&amp;quot; for 'tag'.&lt;br /&gt;
If you wanted it to activate when they thought of either trees or bushes,&lt;br /&gt;
you could send ({ &amp;quot;trees&amp;quot;, &amp;quot;bushes&amp;quot; }).  It's recommended that both&lt;br /&gt;
specific and less specific tags be provided; e.g. you could have a power&lt;br /&gt;
key on both &amp;quot;visualize a triangle&amp;quot; and &amp;quot;visualize a point-up silver&lt;br /&gt;
triangle&amp;quot;, possibly triggering somewhat different versions of the power.&lt;br /&gt;
This allows the possibility of ambiguity with other powers which also&lt;br /&gt;
involve the visualization of triangles, but also lets characters who wish&lt;br /&gt;
to be careful in their use of thought-actuated powers avoid trouble.&lt;br /&gt;
&lt;br /&gt;
'arg' can be used for thoughts which take arguments, e.g. if you wanted&lt;br /&gt;
people to be able to do &amp;quot;concentrate on harming &amp;lt;target&amp;gt;&amp;quot;.  In that case&lt;br /&gt;
you would pass &amp;quot;%s&amp;quot; as 'arg', meaning a string argument following the tag&lt;br /&gt;
value.  You can also use &amp;quot;%d&amp;quot;, meaning an integer argument following the&lt;br /&gt;
tag value.&lt;br /&gt;
&lt;br /&gt;
'flags' indicates the types of mentation which the thought will key on.&lt;br /&gt;
These are defined by the macros in /lib/thought.h, and are:&lt;br /&gt;
&lt;br /&gt;
    TF_Believe              thought confirming the reality of a thing or&lt;br /&gt;
                            idea&lt;br /&gt;
    TF_Concentrate          concentration on an concept&lt;br /&gt;
    TF_Disbelieve           thought denying the reality of a thing or idea&lt;br /&gt;
    TF_Feel                 thought expressing an emotion&lt;br /&gt;
    TF_Imagine              thought about a sensory impression, real or&lt;br /&gt;
                            constructed&lt;br /&gt;
    TF_Subvocalize          mind-internal verbalization, &amp;quot;thinking words&amp;quot;&lt;br /&gt;
    TF_Think                thinking about a concept, like concentrate but&lt;br /&gt;
                            less intensive&lt;br /&gt;
    TF_Visualize            thought about a visual sensory impression,&lt;br /&gt;
                            real or constructed&lt;br /&gt;
    TF_Will                 thought oriented toward a desired effect&lt;br /&gt;
&lt;br /&gt;
You can send one of these flags as your 'flags' value to key only on that&lt;br /&gt;
type, send several joined by bitwise ORs (e.g. TF_Think|TF_Will), or use&lt;br /&gt;
the macro TF_Any to key on any mentation type.  Note that the mentation&lt;br /&gt;
types have different default activity costs ('concentrate' takes more time&lt;br /&gt;
thank 'think', for example) and different conditional requirements (you&lt;br /&gt;
cannot 'concentrate' while berserk).&lt;br /&gt;
&lt;br /&gt;
'activity' is the activity cost of actuating this thought.  Only the&lt;br /&gt;
highest activity cost from all thoughts triggered at once is used.  If no&lt;br /&gt;
triggered thoughts specify an activity cost, the activity cost will be the&lt;br /&gt;
default value for the type of mentation used (in general, 2 for think,&lt;br /&gt;
feel, subvocalize and will, 15 for the rest).&lt;br /&gt;
&lt;br /&gt;
'fcan' is the function checked for whether the thought can be actuated.&lt;br /&gt;
It is passed the following arguments:&lt;br /&gt;
&lt;br /&gt;
    object who              The person performing the mentation.&lt;br /&gt;
    mixed val               The value obtained for the thought's arguments,&lt;br /&gt;
                            if any.&lt;br /&gt;
    string what             The string value given by the player to the&lt;br /&gt;
                            mentation command; e.g. for both &amp;quot;think about&lt;br /&gt;
                            beer&amp;quot; and &amp;quot;visualize beer&amp;quot;, this value will be&lt;br /&gt;
                            &amp;quot;beer&amp;quot;.&lt;br /&gt;
    int total               The total number of thoughts which are having&lt;br /&gt;
                            their 'fcan' functions checked for this&lt;br /&gt;
                            mentation event, including this one.&lt;br /&gt;
    int type                The appropriate thought.h macro for the type&lt;br /&gt;
                            of mentation actually being performed.&lt;br /&gt;
&lt;br /&gt;
The return value from the 'fcan' closure may be:&lt;br /&gt;
&lt;br /&gt;
    1                       Success; allow the thought to be actuated.&lt;br /&gt;
    0                       Failure; do not actuate this thought.&lt;br /&gt;
    a string                Failure; do not actuate this thought.  The&lt;br /&gt;
                            string returned will be shown to the person&lt;br /&gt;
                            performing the mentation, as an error message.&lt;br /&gt;
    an array                Success; allow the thought to be actuated.&lt;br /&gt;
                            Pass the array given to the 'fdo' function.&lt;br /&gt;
    a mapping               Success; allow the thought to be actuated.&lt;br /&gt;
                            Pass the mapping given to the 'fdo' function.&lt;br /&gt;
    an error descriptor     Failure; do nto actuate this thought.  The&lt;br /&gt;
                            message in the error descriptor returned will&lt;br /&gt;
                            be shown to the person performing the&lt;br /&gt;
                            mentation, as an error message.&lt;br /&gt;
&lt;br /&gt;
'fdo' is the function called when the thought has been successfully&lt;br /&gt;
cleared for actuation; all actual game effects should be contained in&lt;br /&gt;
this function, while status checks and so forth should be contained in the&lt;br /&gt;
'fcan' function.  It is passed the following arguments:&lt;br /&gt;
&lt;br /&gt;
    object who              The person performing the mentation.&lt;br /&gt;
    mixed val               The value obtained for the thought's arguments,&lt;br /&gt;
                            if any.&lt;br /&gt;
    mixed inf               If 'fcan' returned an array or mapping value,&lt;br /&gt;
                            this is it.&lt;br /&gt;
    string what             The string value given by the player to the&lt;br /&gt;
                            mentation command; e.g. for both &amp;quot;think about&lt;br /&gt;
                            beer&amp;quot; and &amp;quot;visualize beer&amp;quot;, this value will be&lt;br /&gt;
                            &amp;quot;beer&amp;quot;.&lt;br /&gt;
    int total               The total number of thoughts which have had&lt;br /&gt;
                            their 'fcan' functions checked and are now&lt;br /&gt;
                            being actuated via 'fdo' functions, including&lt;br /&gt;
                            this one.&lt;br /&gt;
    int type                The appropriate thought.h macro for the type&lt;br /&gt;
                            of mentation actually being performed.&lt;br /&gt;
&lt;br /&gt;
Example of setting up a thought:&lt;br /&gt;
&lt;br /&gt;
    thought = character-&amp;gt;add_thought(&lt;br /&gt;
        ({&lt;br /&gt;
            &amp;quot;a triangle&amp;quot;,&lt;br /&gt;
            &amp;quot;a point-up silver triangle&amp;quot;,&lt;br /&gt;
        }),&lt;br /&gt;
        0,&lt;br /&gt;
        TF_Visualize,&lt;br /&gt;
        0,&lt;br /&gt;
        #'can_use_healing_power,&lt;br /&gt;
        #'do_use_healing_power&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
The return value of add_thought() is a mapping which contains the thought&lt;br /&gt;
information as used internally by mind.c.  You should not change the data&lt;br /&gt;
in this mapping.  What you should do with it is store it for when you want&lt;br /&gt;
to remove the thought from the character, which is done like so:&lt;br /&gt;
&lt;br /&gt;
    character-&amp;gt;remove_thought(thought);&lt;br /&gt;
&lt;br /&gt;
where 'thought' is the mapping passed back to you by add_thought().&lt;/div&gt;</summary>
		<author><name>Laine</name></author>	</entry>

	</feed>