Revise Configuration Form (Savage)

From HLKitWiki
Jump to: navigation, search

Context: HL KitAuthoring Examples … Savage Worlds Walk-Through 


All of the most fundamental mechanics for the game system should now be in place, so we ought to start testing everything out and adapting the visual behaviors to give us access to everything we've added. Since each character starts out on the Configuration form, that's usually the best place to begin when adapting the visuals. You'll find the default contents of the Configuration form in the file "form_config.dat".

What Can Users Customize?

The fundamental question that needs to be asked when looking at the Configuration form is: "What can users customize?" Load the Savage Worlds data files and take a look at the current Configuration form. The hero and player names at the top seem reasonable. Showing the list of enabled configuration settings on the right also seems reasonable. So we simply need to focus our attention on the various starting resources visible on the left. 

If we look at our revised "Actor" component and compare that to the options currently available to the user, the starting character points and ability slots are not applicable in Savage Worlds. In addition, there are a number of aspects of the character that should probably be exposed to the user. These include the starting cash, starting experience, and whether the character is a "wild card". We could potentially add the starting attribute and skill points to the list, but those are defined as fixed values for the game system, so it's probably best to manage any changes to those values via permanent adjustments on the "Personal" tab (which we'll deal with later).

Adding New Portals

There are two new pieces of data that we need to allow the user to specify: the starting experience and whether the character is a wild card. This new data needs to be integrated into the "cnfStart" template that is already in place. This template contains all of the portals on the left that we want to manipulate, so we'll add our new portals there.

We'll start by adding the starting experience. This requires two separate portals that work like the starting cash. One portal is the label that tells the user what the data is for and the other is an edit area where the user can type in the number to be used. The edit portal must be hooked up to the appropriate field within the "Actor" component to store the user-entered value, and we can qualify the behavior to limit it to a maximum of three characters and accept only integers. The net result is two portals that look something like those below.

    text="Starting XP:">


We also need to let the user specify whether the character is a wild card. Since this is an either-or state, we can use a variety of methods, but we're going to use a checkbox for this example. The checkbox needs to be associated with the appropriate field within the "Actor" component where the selected state is stored, and it can display text adjacent to the check area to tell the user what it's for. We can also assign "tiptext" that appears when the user pauses the mouse over the portal. The end result is shown below.

  tiptext="Check this option to designate the character as a Wild Card">
    message="Wild Card Character?">

Positioning Portals

Once the portals have been added, they all start with default dimensions and a position of (0,0), which places them in the upper left corner of the template. That's not going to do us any good, since we need to position them beneath the current portals. For positioning the starting experience, we can clone the same logic that is already used for positioning the starting cash. All we need to do is change the portal ids to operate on the "lblxp" and "xp" portals instead of "lblcash" and "cash", then position the "xp" portal relative to the "cash" portal instead of "menuabil".

Since we only have a single portal for the wild card designation, things are even simpler. The checkbox portal is automatically sized to occupy the space it needs, so we can simply center it horizontally. Then all we need to do is vertically position it beneath the "xp" portal, using the same technique as we did for the "xp" portal relative to the "cash" portal. The net result is the following lines of script code that should be added:

~position the starting xp beneath the starting cash
perform portal[xp].alignrel[ttob,cash,15]
perform portal[lblxp].centeron[vert,xp]
portal[xp].width = 50
portal[lblxp].left = (width - portal[lblxp].width - portal[xp].width - 10) / 2
perform portal[xp].alignrel[ltor,lblxp,10] 

~position the wildcard checkbox beneath the starting xp
perform portal[iswild].centerhorz
perform portal[iswild].alignrel[ttob,xp,15] 

The final adjustment is to the overall height of the template. We need to ensure that the template height extends to the bottom of the bottommost portals, and the bottom portal is now the "iswild" portal. We also need to include a little bit of extra padding space to allow for gaps around elements. So change the last line of the script as shown below and our changes should be ready to test out.

height = portal[iswild].bottom + 3

To test your changes, start by using Quick-Reload to reload them into HL, then display the Configuration form via the "Character" menu. You should see the two new pieces of information ready to be edited. If you enter new values, close the form, and then re-open it, the changes should be retained. They are being saved in the appropriate fields within the "actor" pick that is automatically added to every new character.

Delete Old Portals

We decided above that we weren't going to be keeping the two menus that came pre-built into the Configuration form, so let's get rid of them now. The first step is to physically delete the two menu portals from the template. Next, we need to delete references to them from the Position script. This amounts to deleting the two sets of lines focused on positioning the menus and modifying the starting cash to be vertically positioned relative to the "label" portal instead of the "menuabil" portal. Since we keep the positioning of each portal grouped together, removing portals is a very simple process.