Caption Panels

Caption panels provide dynamic and static lists of commands to a player that allow a player to click on a button and an action is performed. For example the screenshot below shows a list of actions a player can click on. If a player clicks on the 'fart' button the command 'fart' is sent to the mud.

files/captionpanel.jpg

There are two types of caption panels. One type is where you perform an action by clicking a button (such as a 'fart') and the other is where you move your mouse over a item in the caption panel and a drop down appears (eg players inventory). Both types of caption panels can either be specified in the config file or specified by the mud. For example the list of actions (eg farting) are specified in captionpanels of the config file while a players inventory is specified by the mud caption panel 3D tags.

Whenever a caption panel is displayed a button is displayed at the bottom of the mud client (eg 'combat' in the picture below). By clicking on the button the player can make the caption panel appear or disappear.

Adding a caption panel
Caption panels are added to the client by adding a CAPTIONPANEL element to the caption panels element in the config file.

In the following example there are two caption panels. One is a list of player actions and the other is the list of products available in a shop.


<CAPTIONPANEL name="act" caption="Actions" hint="Actions you can do in the game" list="actions" buttontype="button" clearonmove="false" panelwidth="140" icon="icons\actions.ico"/>
<CAPTIONPANEL name="store" caption="Trading" buttontype="button" clearonmove="true"
panelwidth="200" hidebuttonifempty="true" popuptype="everytimeone" icon="icons\swordscrossed.ico"/>

The first caption panel has 'list' attribute and it will match to the rawlists with the name 'actions' and display all the items in that list eg fart. This caption panel is entirely defined in the config file.

The second caption panel (store) on the other hand is gets its list from the mud. It is a list of store items from a mud shop so only the mud can tell the mud client the items are available.

3D Tags for Caption panels
As mentioned a store on the mud can list the items for sale thus will require 3dtags to show the list in the mud client. The caption panel tags for a caption panel starts with 'c' . The next characters before the comma is the name of the button (eg store). The rest of the sub tags give information about the caption panels such as its title, its width and the list of buttons themselves. For example:

{cstore,tTeris the Trader,ahr,avc,pw270,
i**Teris the storeman will buy from you:**,
(iYour chainmail hauberk for 1680 coins,csell chainmail hauberk),
(iYour cuirbolli greaves for 225 coins,csell cuirbolli greaves),
(iYour plate helmet for 750 coins,csell plate helmet),
(iYour apron for 1 coins,csell apron)}

The 'i' subtag is the caption of the panel and 'c' is the command. If no 'c' subtag is given then the command is assmed to be that value of the 'i' subtag.

The above set of buttons can be specified in SWLPC as follows :

THREED->query_captionpanel("store",
[
[**Teris the storeman will buy from you:**],
[Your chainmail hauberk for 1680 coins,csell chainmail hauberk],
[Your cuirbolli greaves for 225 coins,csell cuirbolli greaves] ]
[Your plate helmet for 750 coins,csell plate helmet] ]
[Your apron for 1 coins coins,csell apron] ],
0,'Teris the trader','r','c',0,270
);

Refer to caption panels for SLWPC for more information about displaying caption panels in SWLPC.

Button Caption Panels
Button caption panels are made up of a list of buttons such as the list of actions shown in the first picture. When a player clicks the button the associated action is set to the mud. Set 'buttontype' type in captionpanels to "button" to use button caption panels. Set 'list' to the rawlists you want in the list if the list is defined in the config file otherwise the list can come from the mud like in the example above with the store.

Dropdown Caption Panels
Dropdown caption panels are where you move your mouse over a button and a drop down appears. For example in a players inventory:

files/captionpaneldropdown.jpg

This type of caption panel is useful in a list like the inventory where numerous actions can be performed on an item such as dropping cheese, eating cheese, selling cheese for example. Dropdown caption panels have 'buttontype' set to "dropdown" and the 'list' attribute is the items that appear in the dropdown and not in the list itself. The inventory list comes from the mud.

Extra items in the dropdown can be specified through the 'panelcommand' attribute in object. For example edible things in the inventory might have an extra 'eat' action while non edible things wont. The 'panelcommand' attribute of object gives the rawlist that is to be added to the drop down. For example for the cheese object:

<OBJECT name="cheese" panelcommand="food">

<FREEFORM filename="models\cheese\cheese.ms3d" defaulttexturetype="@objectshadow" scalex="0.05" scaley="0.05" scalez="0.05" z="0" turn="0"/>

</OBJECT>

The 'food' rawlist will include the 'eat' action.

Caption Popup types
When you walk into a shop the list of items for sale might pop up and then disappear when you leave the room. The list of actions such as farting on the other hand will remain regardless of whether you change rooms. The different ways caption panels pop up is specified in the 'popuptype' attribute and also the 'clearonmove' attribute of captionpanels. If 'clearonmove' is true then ever time the player changes rooms the caption panel disappears. The different 'popuptypes's specifies how the caption is popped up to the user. If its set to 'none' then the user must click the caption panel button at the bottom of the screen to display the caption panel. If its 'firsttime' then the caption panel is popped up the very first time the caption panel is set by the mud (eg the first time a player walks into a shop). The other two will popup the panel every time the mud set the caption panel. captionpanels gives more detailed meanings of the popup types.


User Entered Values
In a bank you can enter the amount you wish to withdraw. The fact the user must enter a value is specified through hashes. For example the 3dtags for the caption panel that displays banking options might be:

{c,iwithdraw #,ideposit #,ibalance}

which would display the caption panel:

files/captionpanelbank.jpg

Hashes in caption panels can also be specified in rawlists. Thus you could have in the actions caption panel:

<RAWLISTITEM name="mumble $"/>

and the player would be asked what he wants to mumble.

When a player is asked to enter the amount to withdraw the mud client will ask a standard question 'Withdraw how much?' based upon the name of the action to perform. Sometimes you might want to asked a more detailed question such as 'Withdraw how many coins?'. To specify your own question captionpanels has the 'hashmatch' attribute which will match part of the caption name of the button and if there is a match will ask the question in the attribute 'hashmatchreplace'. For example

<CAPTIONPANEL caption="Bank" buttontype="button" hashmatch1="widthdraw " hashmatchreplace1="Withdraw how many coins?"/>

There are up to 4 hashatchs ie 'hashmatch1 .. hashmash4' and 'hashmatchreplace1..hashmashreplace2' thus up to four questions can be asked per caption panel.