Show the Derivation of Values (Savage): Difference between revisions

From HLKitWiki
Jump to navigationJump to search
New page: {{context|Authoring Examples|Savage Worlds Walk-Through}} ===Overview=== There are a number of refinements that we can make to the interface, and this is probably a good time to do it. W...
 
No edit summary
Line 6: Line 6:


===Using Bitmaps for Dice===
===Using Bitmaps for Dice===
The contents of the attribute and skill incrementers currently show the die type and any adjustment using the format "d6+2". It would be ideal if we actually showed a bitmap for each die type, since it would tailor things much more closely to how Savage Worlds works. Fortunately, doing this is quite easy.
The Skeleton data files include an assortment of bitmaps for the various die types. There are bitmaps for use on the screen and within character sheet output. All of these bitmaps are automatically copied into place for your use when you create a new game system. All you need to do is reference them.
We've already centralized all of the handling for what gets displayed into a single place. The field "trtDisplay" contains the text to be output, and the procedure "FinalRoll" handles synthesizing this text. So all we need to do is modify the "FinalRoll" procedure to incorporate the bitmaps instead of using simple text.
Open the file "procedures.dat" and locate the "FinalRoll" procedure. Within this procedure, there is a line that generates the die type for display by combining the letter "d" with the numeric value. We can easily change this to use the appropriate bitmap instead.
You can insert the bitmap into the text via the use of encoded text. The syntax for inserting a bitmap via encoded text is "{bmp filename}", where ''filename'' is the base name of the file to be inserted. Since the die-type bitmaps intended for use on screen are named in the form "d6_screen.bmp", the corresponding encoded text for a d6 should be "{bmp d6_screen}". This means that we can change one line of script code and get the die type appearing as a bitmap. The new line of code should be the following.
<pre>
finaltext = "{bmp d" & dietype & "_screen}"
</pre>
After a little bit of testing, though, the results aren't quite optimal, and we should probably refine the handling a bit. For example, if there is an adjustment made to the final roll (e.g. "d6+2"), the "+2" is a bit too small now. So we'll start by increasing the font size.
The incrementers for showing die types all use the "incrDie" style, so we'll need to modify it. Open up the file "styles_ui.aug" and locate the style. It currently uses the "fntincrsim" font resource, which is also used by another incrementer, so we can't simply change it. Instead, we need to define a new font resource, which we'll call "fntincrdie". We can define the new resource as part of the style, and we'll pick a size like 54 as a good balance that hopefully won't overshadow the die type bitmap. This yields a revised style definition like the one below.
<pre>
<style
  id="incrDie">
  <style_incrementer
    textcolor="f0f0f0"
    font="fntincrdie"
    editable="no"
    textleft="13" texttop="0" textwidth="44" textheight="20"
    fullwidth="70" fullheight="20"
    plusup="incplusup" plusdown="incplusdn" plusoff="incplusof"
    plusx="59" plusy="0"
    minusup="incminusup" minusdown="incminusdn" minusoff="incminusof"
    minusx="0" minusy="0">
    </style_incrementer>
  <resource
    id="fntincrdie">
    <font
      face="Arial"
      size="54">
      </font>
    </resource>
  </style>
</pre>

Revision as of 21:24, 12 January 2009

Context: HL Kit &#133; Authoring Examples &#133; Savage Worlds Walk-Through 

Overview

There are a number of refinements that we can make to the interface, and this is probably a good time to do it. We've got all the fundamental mechanics in place now, so we might as well start pulling everything together more solidly.

Using Bitmaps for Dice

The contents of the attribute and skill incrementers currently show the die type and any adjustment using the format "d6+2". It would be ideal if we actually showed a bitmap for each die type, since it would tailor things much more closely to how Savage Worlds works. Fortunately, doing this is quite easy.

The Skeleton data files include an assortment of bitmaps for the various die types. There are bitmaps for use on the screen and within character sheet output. All of these bitmaps are automatically copied into place for your use when you create a new game system. All you need to do is reference them.

We've already centralized all of the handling for what gets displayed into a single place. The field "trtDisplay" contains the text to be output, and the procedure "FinalRoll" handles synthesizing this text. So all we need to do is modify the "FinalRoll" procedure to incorporate the bitmaps instead of using simple text.

Open the file "procedures.dat" and locate the "FinalRoll" procedure. Within this procedure, there is a line that generates the die type for display by combining the letter "d" with the numeric value. We can easily change this to use the appropriate bitmap instead.

You can insert the bitmap into the text via the use of encoded text. The syntax for inserting a bitmap via encoded text is "{bmp filename}", where filename is the base name of the file to be inserted. Since the die-type bitmaps intended for use on screen are named in the form "d6_screen.bmp", the corresponding encoded text for a d6 should be "{bmp d6_screen}". This means that we can change one line of script code and get the die type appearing as a bitmap. The new line of code should be the following.

finaltext = "{bmp d" & dietype & "_screen}"

After a little bit of testing, though, the results aren't quite optimal, and we should probably refine the handling a bit. For example, if there is an adjustment made to the final roll (e.g. "d6+2"), the "+2" is a bit too small now. So we'll start by increasing the font size.

The incrementers for showing die types all use the "incrDie" style, so we'll need to modify it. Open up the file "styles_ui.aug" and locate the style. It currently uses the "fntincrsim" font resource, which is also used by another incrementer, so we can't simply change it. Instead, we need to define a new font resource, which we'll call "fntincrdie". We can define the new resource as part of the style, and we'll pick a size like 54 as a good balance that hopefully won't overshadow the die type bitmap. This yields a revised style definition like the one below.

<style
  id="incrDie">
  <style_incrementer
    textcolor="f0f0f0"
    font="fntincrdie"
    editable="no"
    textleft="13" texttop="0" textwidth="44" textheight="20"
    fullwidth="70" fullheight="20"
    plusup="incplusup" plusdown="incplusdn" plusoff="incplusof"
    plusx="59" plusy="0"
    minusup="incminusup" minusdown="incminusdn" minusoff="incminusof"
    minusx="0" minusy="0">
    </style_incrementer>
  <resource
    id="fntincrdie">
    <font
      face="Arial"
      size="54">
      </font>
    </resource>
  </style>