Index of pages
  Introduction
  Resources
  Windows and Controls
  The Data Base
  Scripting
  Templates
  Extensions



Rulesets contain definitions for items that are not used by themselves directly. Examples of these are graphics and fonts. They are used in various contexts, such as a frame border in a number field, and are shared between all the various elements that refer to them. These items are collectively called resources.

Icons

Icon resources define simple bitmap images, usually used to represent a symbol or a user interface element such as a button. Icon images are usually relatively small, and only change size in a smaller range of scaling.

Several image file formats are supported, but the recommeded choices are GIF, JPG and PNG. These formats are widely available and create reasonably small file sizes. PNG images also have good transparency support and do not suffer from image degradation.

Icons are defined using the icon tag.

<icon name="button_maps">icons/button_maps.png</icon>

Frames

Frames are graphical elements that draw a rectangular resizeable background image. They are typically used as window and control background graphics that are capable of adjusting to the size of the element.

How frames are built

Frames are built from blocks that comprise the corners, edges and center of the frame. The corner pieces are always drawn once, at each corner. The left, right, top and bottom edges are formed by repeating the corresponding edge piece as many times as needed to complete the frame at the specified size. The center piece is tiled, i.e. repeated both vertically and horizontally, to fill the remaining gap in the middle.

Warning
If frames are drawn smaller than the total size of the corner pieces, the resulting output may look garbled. Care should be taken when defining elements to make sure the element is not too small for a frame. Resizable elements should use a minimum size constraint to guarantee valid appearance.

Defining frame components

All frame components are rectangular portions of one bitmap image. Frames are defined using the framedef tag, specifying the bitmap to use, and the location of the components on that bitmap.

Each component definition comprises of four numbers, separated by commas. The numbers are measured in pixels and their meanings are:

  • The horizontal position of the top-left corner
  • The vertical position of the top-left corner
  • The width of the component
  • The height of the component

If any components are omitted, they are assumed to be empty and zero sized.

The following example illustrates the definition of the minisheet frame from the d20 ruleset. The bitmap image is displayed on the right along with the component division lines, present here for illustration purposes.

<framedef name="minisheet">
  <bitmap file="frames/minisheet.png" />
  <topleft rect="0,0,15,15" />
  <top rect="15,0,250,15" />
  <topright rect="265,0,16,15" />
  <left rect="0,15,15,249" />
  <middle rect="15,15,250,249" />
  <right rect="265,15,16,249" />
  <bottomleft rect="0,264,15,16" />
  <bottom rect="15,264,250,16" />
  <bottomright rect="265,264,16,16" />
</framedef>

Fonts

Font resources determine the appearance of text. Fonts have two properties, the shape of the letters and the default color used to render text in the specific font. Font colors can be overridden in some controls. An example definition of using the font tag follows.

<font name="chatfont">
  <fgffile>fonts/regular.fgf</fgffile>
  <color>#000000</color>
</font>

The FGF format used is a format specific to Fantasy Grounds. You can create FGF files by using the Font Generator utility.

Dice

Dice are used for generating random numbers, typically to determine the outcomes of actions. Die resources are used by the system for handling the 3D dice on the desktop, as well as in die values and controls, for generating die rolls based on ruleset logic.

Built-in dice

There are seven kinds of built-in dice:

  • A four sided die, with result numbers from 1 to 4
  • A six sided die, with result numbers from 1 to 6
  • An eight sided die, with result numbers from 1 to 8
  • A ten sided die, with result numbers from 1 to 10
  • A twelve sided die, with result numbers from 1 to 12
  • A twenty sided die, with result numbers from 1 to 20
  • The percentile ten digit die, with results for each multiple of 10 in the range 0 to 90. This die is not directly accessible from the desktop.

Each of the built-in dice needs to be associated with a default location on the desktop, as well as an icon resource that represents the image displayed for roll results in the chat window. This is done with the die tag.

<die name="d6">
  <icon>d6icon</icon>
  <position>310,-88</position>
</die>

Custom dice

Custom dice are die types based on one of the built-in dice, with the option to assign custom values to the die result. The built-in die on which the custom die is based is will be used as the 3D model for the roll, and the option to roll the custom die will be found in the radial menu of the associated built-in die.

A script function can be associated with a custom die. The script function receives the result of the built-in die rolled, and can apply modifications to the result before it is passed on for further processing.

The following example defines a three sided die, generating a value from 1 to 3, by dividing the result of a six sided die by two.

<customdie name="d3">
  <model>d6</model>
  <menuicon>customdice</menuicon>
  <script>
    function onValue(result)
      return math.ceil(result/2);
    end
  </script>
</customdie>

Processing die roll results

It should be mentioned that further customization on die rolls can be made using a script after the dice have been rolled. To accomplish this, use the chatwindow.onDiceLanded event.

Portraits and portraitsets

Clients can select portrait images for their identities. These images are then used to generate icon resources based on portrait set definitions. An icon so generated will be automatically updated when the identity portrait is changed. Such icons can be used as usual in any context icons resources can be used. Portrait sets are defined using the portraitset tag.

<portraitset name="charlist">
  <base>charlist_base</base>
  <mask>charlist_mask</mask>
</portraitset>

The resulting bitmap is formed by first scaling the image used as a portrait to the size of the mask icon resource. The result is then masked by copying the transparency information from the mask. Finally, the resulting image is composed with the base icon resource, using the latter as a background image.

Icons generated from portrait sets are named according to the naming scheme portrait_[identity identifier]_[portraitset name].

Portrait sets can also be used to generate tokens by adding the <createtoken /> element to the definition.


'Fantasy Grounds' is a trademark of SmiteWorks Ltd. All other trademarks are the property of their respective owners.
© 2004-2010 SmiteWorks Ltd. ALL RIGHTS RESERVED.
Privacy policy