Teeny tiny little bit

b66

There is a bug somewhere causing parents to sometimes lose track of some of their children. I have not been able to determine how or where this happens. To address it for the time being, I’ve written a pair of routines that will hopefully reconnect children with parents when one has forgotten the other.

When drawing shown but normally hidden traits in the Unified View or Classic View trait lists, the text is now drawn with some transparency, which has the effect of ‘graying them out’ regardless of the actual color they’re drawn in. The options related to adjusting the transparency level are in the Display box in Program Options.

Even more bits of cleanup

b65

Compact View has been renamed Unified View.

* Bug fixes

Added a trap for an instance where mismatched parens might crash GCA more ugly than usual.

Added a bit of code so that hopefully otherwise untrapped exceptions can still send related data to the log and to the debug.run file.

Adjusted the in-column editor in the Classic View Attributes list to allow entry of a decimal point. GCA will generally round that off once entry is done, unless the value actually supports decimals.

Adjusted the calculation order of skills/spells to apply modifiers, and then to include any child point costs. This is consistent with the calculation order of other traits, and avoids total included child costs being unintentionally affected by any modifiers applied to the parent skill.

Library modifiers being read from book files were losing the group they were meant to be a part of if the group was assigned passively by the group heading rather than by a group() tag. This has been fixed. The FastLoad version number has been updated to force a reload-from-source for all libraries to address this issue, but that won’t fix character data that may have carried through this issue (GCA does put Read Validation Error warning in the log when loading a character file that has missing XML data, so you should see a message about the Modifier element if that’s the case; it just won’t be a very helpful message beyond that).

Fixed a couple minor issues in the trait lists in Unified View that resulted from a couple routines not having been updated when support for symbols was added.

* Advanced Edit

Changed the edit control for grid cells to a standard text box.

Changed the context menu option for Paste Modifiers to use the CTRL+SHIFT+V key combo. This will allow CTRL+V to once again work as intended within the text editor for pasting normal values. If whole tags have been copied, using CTRL+V will still work to paste them into the whole grid, as that handler still exists, so long as you’re not inside a cell editor at the time (because that will paste the tag info into the editor, instead).

* Other features

Added support to run GCA in ‘portable’ mode. Run GCA with the /p command line option and GCA will use the folder it’s launched from as the base folder for program data, app data, and as the root folder under which it will create the /GURPS Character Assistant 5/ folder tree for all the user data. (GCA will set the window title to include “(Portable Mode)” when this mode is being used.)

When the Verbose Book Processing option is on, GCA will now print the line number where a warning was encountered during processing of traits and modifiers. This line number is printed in blue just after the warning in the log. That should speed up locating such things in the data files. Note: be aware that for items that cross multiple lines, the line number will always be the last line of the set, not necessarily the exact line of that set with the issue.

* ColorBlockSheet

Weapons are now included normally in the equipment list. Not including them was an oversight from recycled code.

Adjusted how the protection block shades body part headers and the colors it uses for text.

Adjusted the protection block’s armor/shield listings text to use the Equipment color settings like the rest of the block.

Tiny bit of cleanup

b64

* Bug fixes

A previous fix that addressed the issue of equipment items not raising notification that they’d changed, and therefore not triggering recalcs, surfaced a bug that it had hidden. Certain items that didn’t have their own base values, such as equipment parent items, could now trigger an endless recalc loop. This should now be fixed.

* ColorBlockSheet

Obliquely noted in b63, but this was updated in b63 to support the character’s selected trait grouping options.

Fixed a bug.

* OfficialCharacterSheet

Now has a couple of options (Yes by default) which will attempt to reduce overflowing of the weapon tables by allocating  available free space from one table to the other.

Added an option to print the Protection paper doll on page two, bumping the Equipment listing to the overflow pages (No by default).

Added support for trait grouping.

Fixed a bug.

Scrub them bits

b63

* Export

As with print plugins for character sheets, GCA now offers default/current character settings for export sheets. These options follow the existing ones for the character sheets in Options, and work the same way.

There is now an Export button on the toolbar, between the Close button and the Print button. I found it less confusing to put it before the Print/Preview buttons, rather than after them. The Export button works like the Print/Preview buttons, with a drop-down portion to provide access to any alternative sheets that may have been set, and the primary button launching the primary export sheet selection.

GCA will save/load/track all these new options.

* Misc fixes and clean-up

Restored ability to type in the Description & Notes dialog without accidentally closing the dialog by pressing Enter. You’ll need to activate the OK button in another way, such as ALT+O, the mouse, or tabbing to the button.

GCA will now save/load the character settings for the trait list grouping options in the character file.

GCA will now recalculate the character when leaving the Loadouts window.

Added the StorePortraitsInCharacterFiles option. When True (default setting) it saves character portrait image data encoded as Base64 within the character file. The option for this in Options is currently in the Experimental Features block on the Program Options tab.

Fixed a bug that prevented Equipment items from correctly reporting that they’d changed when various things that change them were applied or adjusted. This prevented related items and $ cost totals from being correctly and automatically recalced.

Fixed a bug in displaying grouped traits using a tag matching a specific tag value.

* Other features

GCA now loads an internal copy of the character’s portrait, which is kept in the PortraitImage property. If the character has the image file saved to the character file, that image will be loaded from the saved data in the file. If the character does not have the saved data in the file, the image should be the one set by having loaded the file reference, instead. (That is, the file reference is loaded and the image set if possible, and then the saved data is loaded to overwrite the reference-created data.) This way, the image is available, even if the referenced file is not. This does mean that if you change the original reference file, you’ll need to re-load it in the Portrait dialog to re-set the internal image data, whereas the old behavior would always be loading the current version of the source file, if found.

GCA now supports retrieving the campaign’s base TL through the character’s TagItem property, which means you can now use char::basetl or char::campaigntl to get the TL for the overall campaign, rather than only for the character.

Created the GroupedTraitListBuilder class, which should simplify allowing sheets to support the trait list grouping options by doing the work of breaking a trait list into grouped sub-lists (as specified by the character’s options) for the sheet author. The author can then take the generated lists and output them as the user would like to see them. Example usage in the ColorBlockSheet plugin.

* SheetOptionsManager

Added functions for retrieving typed Values for specific options.

Some generic functions:

Public Function ValueBoolean(Index As String) As Boolean
Public Function ValueInt(Index As String) As Integer
Public Function ValueULong(Index As String) As ULong
Public Function ValueDouble(Index As String) As Double
Public Function ValueString(Index As String) As String
Public Function ValueBooleanArray(Index As String) As Boolean()

And by optType:

Public Function ValueColor(Index As String) As Color
Public Function ValueFont(Index As String) As Font
Public Function ValueList(Index As String) As String
Public Function ValueListArray(Index As String) As Boolean()
Public Function ValueListOrdered(Index As String) As String
Public Function ValueListFlag(Index As String) As ULong
Public Function ValueListNumber(Index As String) As Integer
Public Function ValueText(Index As String) As String
Public Function ValueVar(Index As String) As String
Public Function ValueTrueFalse(Index As String) As Boolean
Public Function ValueYesNo(Index As String) As Boolean

* GCA5.xsd

Added some nodes to allow for saving export sheets and trait list grouping options.

Clean up the bits

b.62

* Misc fixes and clean-up

Fixed drawing/redrawing bug with Compact View trait lists, which would cause them to periodically disappear entirely when the option for multi-line display was turned on.

Changed default color of SheetOptionDisplayFormat.CaptionLocalBackColor to Color.Transparent to allow for expected behavior when changing SheetOptionDisplayFormat.BackColor but not SheetOptionDisplayFormat.CaptionLocalBackColor.

Fixed Sheet Options dialog to no longer redraw options when window is moved, or when sized only vertically.

Added a number of new constructors to the SheetOption class. Fixed bug that prevented existing alternate constructors from assigning the Name value.

Added a couple more tags to the list of tags not written to the file when saving a trait to file.

* Exports

Altered the order of operations a little bit for exporting characters, and added support for the PreviewOptions function of export sheets, so that the options settings are available to them before they’re asked to supply any requested data.

Changed the suggested default file name for exports to be based on character file name.

Changed the default starting target folder for exports to the gca5 folder, rather than the gca5\characters folder.

* Interfaces

Added Function PreferredFilterIndex() As Integer to the IExportSheet Interface for export sheets. Given the filter specified in SupportedFileTypeFilter(), this is the 0-based index into that filter list for the filter that should be selected by default.

Added Function PreviewOptions(Options As GCA5Engine.SheetOptionsManager) As Boolean to the IExportSheet Interface. This function is called after options are loaded, to give the sheet a chance to do any unusual housekeeping before the Filter functions are called. Return FALSE only if the export should be canceled.

* FileWriter

Added Write(ByVal Text As String) and WriteLine(ByVal TextLine As String) as the preferred ways to write text or text with appended newline, respectively. Deprecated AddText() and Paragraph(); removed LinePrint() and FilePrint().

Added WriteLine() without params to just write a NewLine to the file.

Added ReadOnly Property NewLine As String, which returns the string used for line termination/new line markers (currently fixed at CR+LF).

Updated to not emit BOM for the UTF-8 encoding.

* GCA5.xsd

Added ‘itemnotes’ node to GCATrait ‘ref’ node.

* Plugins

Simple Text Export sheet updated to implement new Interface functions, and recompiled.

Dense bits

This is a dense one, as a lot of interrelated stuff got done. In summary, two major new features got added in this build: the ability to group character traits by category or tag, and the display of trait symbols/flags (those markers for Physical, Exotic, and such).

* Grouping

I have added a UI in Options to allow specifying how the trait lists in Compact View should, if desired, group traits by category or by arbitrary tag. These options are tracked and managed within the GCACharacter, so the options are on the Current Character tab. Note that these options are in the character so that print/export sheets can make use of them, if desired.

NOTE: GCA currently does NOT save the grouping options to the character file, or provide the Default Character options version of them. I want to make sure they appear to work for people before doing that.

To support grouping in the Compact View trait lists, some rewriting of the internal handling of traits and fields within the list was required (since multiple copies of each trait might now appear).

Standard grouping behavior works like this: If grouping by all values of a tag or category, each trait will appear under any and all such groupings to which it belongs. However, if grouping by specific values only, then traits will appear under any and all groups to which they belong, but will not be listed in the ‘ungrouped’ section at all, unless it appears in none of the specified groups. Groups will appear in ascending alphabetical order (or ascending numerical order if grouped by an numeric-values-only tag) regardless of the list’s current ordering options.

A couple common examples of grouping would be grouping just the Techniques category in Skills, or just a particular college category in Spells.

* Symbols, System

I have settled on the term ‘symbols’ for the icons/images/symbols/flags/whatever that mark traits with icons for Physical, Mental, Social, Supernatural, and Exotic. Its just easiest, seems clear enough, and is what SJGames apparently calls them anyway. (Note that there is a symbol() tag for attributes, which represents the math symbol or abbreviation to use in math expressions for that attribute. I don’t think there’ll be much confusion over this, but it is possible that it might happen.) Where confusion may occur in docs or GCA, I may use ‘symbols/flags’ to refer to these trait symbols.

GCA will now display trait symbols (if any are defined) in the system trait lists. It displays them right-justified inside the Name column of library trait lists in Compact and Classic view.

System traits have been updated to support tracking the symbols that apply to them.

GCALibrary has been updated to support loading and managing trait symbols.

I have added support for a [Symbols] block in the data files. This allows specifying images for the symbols representing various flags within GURPS (such as those for Supernatural, Physical, or Exotic advantages and disadvantages; see B32), as well as how to apply them.

The one in the GCA5 Changes.GDF looks like this:

[Symbols]
 Mental Advantage, mental_16.png, Ads where cat listincludes Mental
 Mental Disadvantage, mental_16.png, Disads where cat listincludes Mental
 Physical Advantage, physical_16.png, Ads where cat listincludes Physical
 Physical Disadvantage, physical_16.png, Disads where cat listincludes Physical
 Social Advantage, social_16.png, Ads where cat listincludes Social
 Social Disadvantage, social_16.png, Disads where cat listincludes Social
 Exotic Advantage, exotic_16.png, Ads where cat listincludes Exotic
 Exotic Disadvantage, exotic_16.png, Disads where cat listincludes Exotic
 Supernatural Advantage, supernatural_16.png, Ads where cat listincludes Paranormal
 Supernatural Disadvantage, supernatural_16.png, Disads where cat listincludes Paranormal

There are three sections per line, separated by commas.

The first section is the name of the symbol. This is so that every symbol can be unique internally, which will allow for using the same name in another file to replace it if defined earlier, such as with a new image or a new rule. The name should not include commas or other punctuation.

The second section is the name of the image to use as the icon for the symbol. It should be in one of the image bins, so that GCA can find it. (Note that GCA will check the User image bin before the System image bin, so that users can change the default system images, if desired, simply by adding replacement images with the same name to their own image bin.)

The last section is the rule for application of the symbol, which works like what you’d find in a #BuildSelectList:

TYPE where TAG [ is | isnot | includes | excludes | listincludes | listexcludes ] TAGVALUE

Note that the system allows for specifying whole new types of symbols, should users wish to make use of the system for custom tagging their traits. Custom images should be 16 pixels tall (because GCA will not resize them to fit, and 16 pixels is the standard height for other icons in trait lists), but may vary in width. The best image type for them is PNG, with alpha channel transparency if desired, but solid backgrounds are okay if you like them. BMP files may also be used.

The [Symbols] block supports two commands at this time, which must be within the block to work:

#Clear

#Clear stands alone, and when encountered causes GCA to delete all currently defined symbols, so that any defined after that point will be the only ones used.

#Delete <list of names>

#Delete specifies a list of symbols to be deleted. This should be a comma separated list of the names of the symbols as defined in the data files.

I have changed the FastLoad file structure and version number to add support for the new symbols/flags, so all FastLoad files will be rebuilt.

I have added support for adding the various trait symbols to the file touchlist tracking. Because the symbols can be defined anywhere, and later definitions can replace earlier ones, symbols are assigned to system traits after all the files have been loaded, so the touchlist will track the assignments as “Post Processing.” Note that touchlist tracking will not help you see when one symbol is replaced by another; for that you’ll need to watch the log messages with Verbose logging turned on.

* Symbols, Character

GCACharacter now maintains its own collection of symbols. This is initialized with whatever Library is used to create the character, but will later need to be resynchronized to update for any changes.

GCATrait now maintains a collection of strings called SymbolNames which contains the names of any symbols that are determined to apply to the trait. GCA will use the SymbolNames to index the character’s Symbols collection to display the correct symbols for each trait in the UI.

GCA will now display character trait symbols right-justified inside the Name column of trait lists in Compact and Classic Views.

Added support to GCATrait.TagItem to get the list of applied symbols using the ‘appliedsymbols’ tag name. This returns the comma separated list of symbol names, if any, that apply to the trait. (GCA will determine applicable symbols automatically, so there is no Set variant of this.) This is a ‘courtesy’ tag, so it’s not contained by the tag dictionary, as SymbolNames is its own collection.

Character symbols can now be resynced in the Resynchronize dialog.

* Other Stuff

Fixed a bug in reading the <categories> block in the GCA5 XML reader. This didn’t impact anything since that was the last block in the file up until now.

Fixed some bugs where system traits and modifiers didn’t always know what library owned them.

Fixed a bug that crashed GCA when an item wasn’t actually added in a Selection dialog due to the user not completing, or Canceling out of, a text entry request.

Updated the GCA5 XML writer to output the portrait image file (if there is one) as a Base64 encoded text string in a CDATA in the <portraitimage> element. GCA doesn’t currently read/track it any differently otherwise, but that’ll be added eventually.

Updated the GCA5 XML writer to output the ‘appliedsymbols’ element of GCATrait. (This contains the contents of the SymbolNames collection.)

Updated the GCA5 XML writer and reader to support the character’s new Symbols collection. GCA will now read and write these, including image data.

Added two routines to modHelperFunctions to serialize/deserialize internal images as Base64 strings:

 Public Function BitmapToBase64String(ByVal SourceImage As System.Drawing.Image) As String
 Public Function Base64StringToBitmap(ByVal Source As String) As System.Drawing.Bitmap

Added options to Options dialog for displaying symbols in Library or Character lists. Displaying in Library lists is a general display setting, while displaying in Character lists is a character managed setting, so there are settings on the Default Character Options tab as well as the Current Character Options tab for that one.

Characters now save/load their symbol option setting.

* GCA5.xsd

Added a <portraitimage> element to the <vitals> element to support storing the character’s portrait image as a Base64 encoded string inside the XML file. The string should be enclosed in a CDATA block. I do not yet load this image, because the GCACharacter doesn’t currently handle the actual image; that’s more work elsewhen.

Added GCASymbolsBlock and GCAFlagSymbol types, and added support for GCASymbolsBlock to GCACharacter.

Added ‘appliedsymbols’ element to the ‘ref’ block of GCATrait, which is a list of all the character’s Symbols that apply to it. (This contains the contents of the SymbolNames collection.)

Added ‘showcharactertraitsymbols’ elements to the GCACharacter settings block.

Premature bits

Fixed issue where GCA would pop-up a ‘changed TL’ dialog even if no traits were affected.

Made a couple changes to the SheetOption object’s existing constructors, and added a new one.

I have added code to allow the trait lists in Compact View to group traits by category. I have not yet hooked up any UI for that.

Recompiled plugins.

More exported bits

Moved calculation of charparry() up in the order of calculations for secondary characteristics, because it, too, is used in the calculation of some values in the routine that does charskillused, charskillscore, and charparryscore.

Added another special case check for trickle-through issues related to failing to meet minimum ST for a weapon.

Fleshed out the SimpleTextExport output.

Updated GCA5.Interfaces again: updated the RequestRunSpecificOptions event of IExportSheet; added the DialogOptions_RequestedOptions class. Shouldn’t affect print sheets.

Updated GCA5 to handle RequestRunSpecificOptions event handling for export plugins.

Added a form to display and process the selection of RunSpecificOptions by users.

Updated SimpleTextExport to raise the RequestRunSpecificOptions event if the user requests it in Options. (My current implementation would probably be better served with a simple message box, but I hope that it shows that much more sophisticated options could be requested, such as providing a character list and having only the selected characters exported.) Plus, added some more options for output handling.

Plug in these bits

Adjusted quick pick dialog a tiny bit.

Changed the GCA5.Interfaces structure as I broaden the plugin support. This necessitated creating a basic, minimal interface for the shared plugin features, and having the other interfaces inherit it. You will need to recompile any plugins you have, but you shouldn’t need to change anything else.

Added IBasicPlugin and IExportSheet to GCA5.Interfaces.

Created the SimpleTextExport plugin, which, as the name suggests, exports characters to a text file. This is still a work in progress, but does export stuff.

Added an Export… option to the File menu.

Added the Select Export Sheet dialog, which is what comes up when you select Export… from the File menu. This dialog allows you to select the Export Sheet you want to use for exporting purposes, and allows you to proceed through the export process if a sheet is selected.

Adjusted how GCA tracks plugins and Print Sheets, given that there are now more types of plugins and the other types are not suitable for printing/previewing.

NOTE: Export Sheets are not automatically compatible with Print Sheets, as they were for GCA4. This is due to the fact that the system now used by the print engine does an absolutely abysmal job of converting to other types of data, most of which is absolutely useless (PDF is okay, and is currently supported from Print Preview). Therefore, there’s no good way to translate the printer output to other output types automatically any more.

All included plugins have been recompiled due to interface changes.

Some fancy bits

Implemented a work-around for redrawing the Character lists correctly in Classic View when wrapping is used and the form is resized to change the widths of the lists.

Fixed a drawing bug in displaying traits in most character lists when there isn’t actually room to display the trait name.

Added support for saving traits to a data file from the Edit and Advanced Edit dialogs. Templates and meta-traits are not supported, and parents will not save children.

Added a Save to File… button to the Edit dialog for traits.

Added a Save to File… button to the Advanced Edit dialog. You can save Modifiers as well.

To address some issues, I have rebuilt/rearranged some things on the Advanced Edit dialogs, and altered how some of the features worked. While doing that, I added some icons to the Add Tag and Remove Tag buttons, and relocated all the grid-oriented buttons to a new row just under the grid. (To be specific, those buttons are now a part of the per-item grid control, rather than part of the overall form itself.)

Compact View trait lists now support multi-line (text wrapped) trait lines. Updated Options text to reflect this change.

Removed some calls that printed things to the splash dialog, as they were redundant with the Working dialog that appears anyway.

Simplified a bit of the ConfigEngine and GCASystem inter-relationship, to simplify handling, to promote more modularity, and to allow for better handling of multiple possible GCASystem objects.

With the change to GCASystem, GCA now just creates a new GCASystem for the Build Campaign Book dialog, which ensures that even when using the same Library as might be loaded in GCA already, any changes will be made to a different copy. This means it can now use the standard FastLoad files, if available for the starting Library, without having to load everything from scratch.

Fixed a problem around since GCA4, where bonuses to Block or Parry (as in Enhanced Block or Enhanced Parry) did not correctly spark a recalc/update of traits that had blockat() or parryat() values.

I have added support for “user targetable” bonuses, which will allow the user to choose the targets to which the bonus is meant to apply. Items that grant this new type of bonus will use %chosentarget% as the Target part of the bonus, such as gives(+1 to %chosentarget%). GCA will manage the new chosentargets() tag, which will keep the names of the target items, and provide a UI for it through the use of a new button on the Edit Traits dialog, which will pop up a pick list from which they can choose target items. When bonuses are generated by the trait, GCA will create one bonus for each target, in each case replacing the %chosentarget% with the name of the target item.

File authors can limit the available targets presented to the user by using the targetlistincludes() tag on the item, which includes one or more criteria for adding traits to the list, using a structure similar to that in the #BuildSelectList directive. It’s structured like this:

targetlistincludes( <Type> [ where <tag> [ is | isnot | includes | excludes | listincludes | listexcludes ] <tagvalue> ][, <etc.>] )

which allows for specifying just the list type in <Type> if that’s the only limit required. If more restriction is needed, see the docs for #BuildSelectList to see how the Where block works. Note: GCA will never include locked or hidden traits as valid targets. In addition, <Type> may be Any or All to specify selecting from all traits, not just one type.

As an example, instead of requiring users to add a Weapon Master Damage Bonus modifier to every weapon that gets the bonus, the bonus can be included with the Weapon Master advantage, and can use the new %chosentarget% target instead. The user can then select or modify the weapons that apply whenever they need to do so in the Edit window.

Here’s the modified version of Weapon Master:

Weapon Master (Targets), 20/25/30/35/40/45, levelnames(one specific weapon, two weapons normally used together, a small class of weapons, a medium class of weapons, a large class of weapons, all muscle powered weapons), page(B99), upto(6), cat(Mundane, Physical),
   x(_
      #InputToTagReplace("Please specify the weapon, weapons, or class of weapons you have Mastery of:", nameext, , "Weapon Master")_
   ),
   gives(_
         =+@if(_
               $modetag(charskillscore) = ST:DX+1 _
              THEN @textindexedvalue($modetag(dmg), ("thr", char::basethdice), ("sw", char::baseswdice), ELSE $solver(me::dmg)) _
               ELSE @if(_
                        $modetag(charskillscore) > ST:DX+1 _
                        THEN @textindexedvalue($modetag(dmg), ("thr", 2 * char::basethdice), ("sw", 2 * char::baseswdice), ELSE 2*$solver(me::dmg)) _
                        ELSE 0 _
                        )_
               ) to %chosentarget%::damage$ listas Weapon Master Damage Bonus _
      ),
   targetlistincludes(_
         Equipment where charreach isnot "", 
         Equipment where charrangemax isnot ""_
         )