Incrementer Behavior (Savage): Difference between revisions
No edit summary |
|
(No difference)
|
Revision as of 04:11, 18 December 2008
Context: HL Kit … Authoring Examples … Savage Worlds Walk-Through
Overview
One glaring facet of the interface is that the incrementers used for attributes and skills are too narrow. While there is enough space to show the die type, any roll adjustment gets cut off. In addition, the interactive behavior of the incrementers is problematic in one respect. So we need to address these aspects.
Define a New Style
The Skeleton files provide an assortment of pre-defined styles that we can build upon. However, for Savage Worlds, we need a special style that is ideal for showing and manipulating the die types of attributes and skills. All of the styles that are used within the user-interface are defined in the file "styles_ui.aug", so open that file. Locate where the various styles are defined for incrementers - there are three of them pre-defined for us.
What we need is a customized version of the "incrSimple" style, so we'll start by copying that style. We need an appropriate id for our new style, so we'll use "incrDie" to clearly indicate that this style is intended for use in managing die types. The color and font details are fine, but we need to widen the incrementer a bit. In addition to increasing the full width of the incrementer, we also need to increase the area for showing text and we need to adjust the position where the "plus" behavior is positioned. This means we need to adjust three of the attributes: "fullwidth", "textwidth", and "plusx". All three values should be adjusted by the same amount, and we'll use 20 as a reasonable increase. Why so much? Because the style is used for skills, where we need to handle the display of "d12+2", and that requires about 20 extra pixels of width.
A convenient feature of incrementers is that clicking within the text region allows the user to directly edit the contents as a textual value. For simple numbers, this feature is quite handy. However, we're multiplying the value by two and potentially including a roll adjustment, so a value displayed as "d8+1" would show the value "4" when the user tries to edit it. That's going to be quite confusing to users, so we're better off disabling this feature for our incrementer. This is accomplished by specifying the "editable" attribute with a value of "no". Putting it all together yields an incrementer style that looks similar to the one below.
<style id="incrDie"> <style_incrementer textcolor="f0f0f0" font="fntIncrSim" editable="no" textleft="13" texttop="0" textwidth="44" textheight="20" fullwidth="70" fullheight="20" plusup="incr_plus" plusdown="incr_pldn" plusoff="incr_plof" plusmask="incr_plmk" plusx="59" plusy="0" minusup="incr_minus" minusdown="incr_mindn" minusoff="incr_minof" minusmask="incr_minmk" minusx="0" minusy="0"> </style_incrementer> </style>
Use the Style
Once our new style is defined, we need to put it to use. There are only two places where we need to let the user manipulate the die type via an incrementer. The first is on the "Basics" tab where we manipulate attributes, so open the file "tab_basics.dat" and locate the "baAttrPick" template. Change the style of the incrementer used within it to "incrDie". The other location is on the "Skills" tab, so open the file "tab_skills.dat", locate the incrementer used for skills, and change that style as well. Re-loading the data files should now result in more appropriate behaviors for manipulating die types.