Statistics

Muds can provide information about the player such as a players health. They can also provide information about an object such as a dog. The mud client can show that a dog in the room has health is 10 out of 10 with a bar such as the picture below:

files/stats4.jpg

In the above picture the dog has perfect health and the mud would specify this with the 3dtags {odog,ih10}.

Statistics are also displayed for the player such as the players name and health:

files/stats.jpg

Statistics can be about the player or about an object that has been selected eg statistics regarding a dog you have clicked. The statistics regarding an object has three types in itself. These include statistics regarding what has been right clicked, left clicked and what has been selected with the right or left click. The following picture shows information about the player, the selected object and object left clicked:

files/stats2.jpg

The following is an example of a right click:

files/stats3.jpg

The configuration of statistics such as whether it is a statistic that uses a bar is specified in the config file under the stats element. The stats element is made up of rightclicks, leftclicks, selecteds and you elements. Each of these four elements can be made up of any combination of captions, bars, click list (drop downs like above), icons and selectobjects (eg halo around dog).

Depending on what object is clicked by the user different statistics can be displayed. For example the statistics displayed when a player clicks a book is different to the statistic if a player clicks a dog. Each object has an 'objectcommand' attribute that defines what sort of object it is (eg a book might be 'read' and a dog might be 'living'). Based upon the object command different looking statistics are displayed. For example if the 'objectcommand' is 'read' then the first SELECTED will be displayed and the 'living' SELECTED will be ignored:

<SELECTED objectcommand="read" x="400" y="20">

<ICON x="120" y="15" height="50" width="250" color="0" alpha="0.1"/>
<ICON texture="icons\object.tga" x="13" y="8" height="32" width="32" iscale="2"/>
<CAPTION name="" x="40" y="0" scale="1" color="FFFFFF" alpha="1" width="50" colorreplace="true"/>
<CLICKLIST x="230" y="-15" height="10" scale="1.2" clickscale="0.8" default="v" width="10" color="11FF11" colorreplace="true"/>

</SELECTED>
<SELECTED objectcommand="living" x="400" y="20">

<BAR name="h" width="200"/>

</SELECTED>

If the the 'read' SELECTED is matched then two icons, a caption and a clicklist will be displayed at position 400,20 on the screen.

Note that object commands can be overriden by the mud. For example {ocheese,kread} can change a piece of cheese from a piece of food into something that can be read.

3D tags for Statistics
Statistics are sent to the 3D client from the mud using the subtag 'i' in 3d tag object and 3d tag you. For example {odog,ih10} means a dog has health 10 out of 10 and likewise for yourself {uih10} means you are of perfect health.

The 'h' character after the 'i' matches to the 'name' attribute in a stat item such as a bar. For example

<SELECTED objectcommand="living" x="400" y="20">

<ICON texture="living.tga" x="20" y="20"/>
<BAR name="h" width="200"/>

</SELECTED>

In this example if a player has clicked on an object with an objectcommand 'living' and the object has a 'h' statistic of 10 (eg {odog,ih10}) then the bar will have width 200. {odog,ih5} would give a width of 100.

In case when a stat has a blank 'name' eg

<CAPTION name="" x="40" y="0" scale="1" color="FFFFFF" alpha="1" width="50" colorreplace="true"/>

it will be the name of the object that is displayed. For example if a player clicked on a dog defined by the mud as {odog/woolfy,+} the caption would be 'Woolfy'.

Statistics with names greater than 1 character can also be used. For example:

{odog,(ihealth,10)}

means the statistic 'health' is of value 10. You could use this stat to display a bar:

<BAR name="health" width="200"/>

In SWLPC the functions used to generate 3dtags stats are the functions 'query_youstat' and 'query_objectstat' from threed.

Placements of statistics on the screen
Statistics can either be placed directly above the object that has been clicked or at a fixed location on the screen. The position is specified in the statsection in the 'x' and 'y' attributes. For example the you statistic

<YOU x="20" y="20">
<ICON x="150" y="15" height="50" width="300" color="0" alpha="0.1"/>

will be placed at position 20,20 in screens coordinates.

By default x and y are -1 respectively. If -1 is used then it means that the statistic is placed above the object that is clicked. For example:

files/statminus1.jpg

Colors of Statistics
In the mud client it is possible to make statistics for a player blue while a monster is green. For example:

files/statblue.jpg

The color of an object can be changed based upon a statistic of an on object on the mud being true. For example if Dredd's 'p' statistic is true (1):

{ocitizen/Dredd,ip1}

The 'p' statistic is then matched to a colors element in stats which in turn has an color that can override the default color of the statistic. For example Dredds halo may be defined by the green halo:

<SELECTOBJECT name="halo" color="00FF00" colorreplace="true" />

If 'p' is 1 then that matches to colors (and colorreplace is true):

<COLORS>

<COLOR name="p" color="1111FF"/>

and the color of the halo will become "1111FF" instead of "00FF00".


STAT Types


The following is discussion of each of the types of stat's that can be displayed in a statsection like a rightclicks:



Caption
files/statscaption.jpg
Displays text information such as the players name. It matches a statistic such as 'title' ({u,(ititle,Axl)}) to a 'name' attribute then displays the text. If the 'name' attribute is blank then it is the name of the object eg 'Woolfy'.

Clicklist
files/statsclicklist.jpg

Displays a list of actions that can be performed on an object. For example you can 'get' a chair if you click 'get' and 'get chair' will be sent to the mud. The object command of the selected object links to an objectcommands which in turn links rawlist. The rawlists then populates the clicklist. The rawlist can use hashes such as 'get %'.

Icon
files/statsicon.jpg

Draws an icon at position x,y

Bar
files/statsbar.jpg

Displays a bar based upon the statistic that matches the 'name' attribute eg {'h' in odog,ih10}. It useful for display things like the health of a player or monster. The values of the statistic should be between 0 and 10.

Selectobject
files/statsselectobject.jpg

Draws an object at the position of the clicked object. An example is the halo drawn around the actor above. The 'name' attribute matches an object in objectlist.