Some bits may have been harmed in this build (b119)

b119

* Bug Fixes

Fixed a crash bug related to trying to draw library list items that don’t have prereqs met when creating a random character and the option for dimming system traits with unmet prereqs is turned on.

Fixed a logic error in the code that determines if one trait is affected by another, if the only connection might be an attribute affecting the trait through the skill type (seriously don’t know how this went unnoticed for so long).

Fixed an issue with Sheet view, where some event handlers existed twice, causing unexpected behavior, such as drag-and-drop adding traits twice.

When you hit the Enter key when editing a tag in the Advanced Edit dialog, it should now save the changes to that tag before closing the dialog.

* Bonus Builder

I did some work on this, but I broke something somewhere with a cascading effect. I had to revert the code to last build, because I couldn’t figure out what the heck was going on. I’ll revisit expanding this next build.

* Miscellaneous

Since the Show Dirty feature has been functional and apparently stable for a while, I’ve made that a saved setting and moved the toolbar button for it to the section of the toolbar next to the Hidden and Component display options.

During Check for Updates, GCA will now print the various timecode folder names to the Working dialog as it checks for previous update data. Since this may take a while, printing these will let users know it is still working.

Noticed that the View Info pane output looks kinda crappy at higher zooms, especially when the fonts are sized up or styled, so I changed most of the Info pane output to use Arial instead of the default font.

Added “displayname” as a valid tag to get returned from a system trait’s tagitem().

I generalized the selection-by-tag features of #DeleteByTag so that they could be used in future commands. This rendered most of that function, and the functions supporting it, obsolete, so they were refactored or removed.

* Lists

I built a new manager for Lists in libraries, since they were using Groups and wasting space on things that Lists didn’t handle. FastLoad files have to be rebuilt because of this change.


* Data File Commands

We have some new ones related to lists.

#DeleteFromList

To remove entries from Lists.

#DeleteFromList “LI:ListName” Whatever, “Whatever (Three)”, Buncha Stuff
#DeleteFromList ListName Whatever, Whatever (Three), Buncha Stuff

This is like #DeleteFromGroup, with the name of the List first, then a space, and then a comma separated list of items to delete from the List. For the targeted List, the LI: is optional, as are enclosing quotes or braces unless the name includes a space. Quotes around each item in the target list are optional, unless the item text includes a comma. Unlike DeleteFromGroup, there is no ALL keyword.

#AddToList

To add entries to Lists.

#AddToList “LI:ListName” Whatever, “Whatever (Three)”, Buncha Stuff
#AddToList ListName Whatever, Whatever (Three), Buncha Stuff

Everything about the structure except the actual command name is the same as #DeleteFromList above.

Note that normal List behavior is to aggregate [Lists] entries, so #AddToList may be redundant, but does allow adding outside of a [Lists] block.

#AddToListByTag

To add entries to Lists based on Library Traits already loaded and the value of a tag.

#AddToListByTag “LI:ListName” [template(text)] , Text|Num,

The first thing on the line is the name of the list that you’re targeting. The LI: is optional, as are enclosing quotes or braces unless the name includes a space. Follow with a space to separate it from the template() tag or the selection criteria.

The template() tag is optional. This should be separated from the list name and the selection criteria by spaces. Since this option is in tag format, the parens should protect it from parsing issues, but you do have to ensure that you don’t mismatch quotes, parens, or braces.

Finally is the comma separated list of selection criteria. This uses the same select-by-tag syntax as #DeleteByTag. Please reference that for the details.

The template() tag makes use of some templating support that I wrote to allow for customizing the Info display in the GUI. This means that it knows what trait it’s looking at, and just needs to potentially fill in values. You can reference any tags from the current trait by enclosing them in % characters, such as %nameext% for name extension, or %points% for points. There are a few special case variables that require extra processing and are therefore enclosed in double %% signs, such as %%costprog%%, but most of those apply only to character traits, not system traits.

An example template might be template(%name%, %type%) for a skill, which would become ‘Accounting, IQ/H’ for the Accounting skill.

As an experimental addition, I’ve hooked up the TextFunctionSolver, so you have some additional power available. This is an experiement because most of the Solver features were designed to operate on character traits, so some things just won’t work correctly. I’ve added some to allow for functions that don’t depend on character traits to work and not cause problems, so I think we’re good there, but actively using such a feature will still probably crash something.

The TextFunctionSolver will normally run after the template variables are replaced by the trait tag values. However, if the very first piece of your template() text is ‘$first’, then GCA will remove that flag and call the TextFunctionSolver first, then replace variables, and then do the normal pass through TextFunctionSolver if it looks like there might still be text functions in there.

An example using text functions might look like this:

template($if(@len(%nameext%)=0 then “%name%” else “%name% (%nameext%)”))

That’s pointless as it’s replicating just using %fullname%, but it’s a functional example.

If template() is left out, what is added to the list is the selected trait’s FullName property.

Example:

#AddToListByTag “LI:TestingStuffList” Advantages, Text, name isnotempty echolog

This command will select every Advantage and add the full name for each one to the TestingStuffList, because every valid Advantage has a name that is not empty. (It will also spit some processing info into the log as it works.)

* View Info

I’ve made it so that you can customize the trait information that is displayed to you in the Info panel. This will allow users to customize the displayed information to their own preference. The Info panel uses RTF, so it’s not necessarily the easiest thing to read and deal with, but I include the default templates with GCA so at least there’s something to start from.

All modifier or trait tags for which you want to check the value must be enclosed in percent (%) characters. This applies anywhere within the template to retrieve that value from the trait or modifier being viewed, whether in a command or just as part of template output.

There are also a few special variables that provide additional support to display things that may be wanted. Since these aren’t tags, but are still intended to be treated like tags, we format them similarly, but use double % characters to tell GCA they need extra handling.

%%costprog%% returns the ad-type trait’s cost progression.
%%keeper%% returns the item that owns this one, if this one is a component of another trait.
%%modscount%% returns the number of applied modifiers.
%%appliedmods%% returns a captioned listing of the applied modifiers (short names and values)
%%appliedmodifierss%% returns a fully expanded listing of the applied modifiers

Template Commands

There are currently two slightly different ways to insert commands into your template. There are two because I didn’t care for the way I initially did the commands, so I did them again, and then decided to keep both because one is easier in a code editor, and the other is easier in an RTF editor.

Regardless of method, when a command is processed the text of the command itself is never supposed to end up in the display, only the specified output. If you see your commands in the display, you probably have an error of some kind (probably missing brackets).

Standard Method

I’m going to talk about the ‘standard’ way first, which is easier when you are coding by hand and using a code editor that will highlight matching sets of containers (parenthesis, braces, and brackets). This method also relies on the open/close nature of matched brackets.

Here are all the currently defined commands for this method.

[Lib ]
[Char ]
[NotEmpty %tag%=]
[Size[+|-|*]]
[DebugMode]

All of these commands are self-contained; that is, all of them start with an opening bracket and end with a closing bracket, and everything that they might do or change is contained within those brackets.

For each command with , that can be plain text, RTF codes, tag variables, or other commands.

%tag% in these commands is the name of the tag that you are checking. It must be enclosed in % characters as shown, just as tags must be enclosed in % marks anywhere within the template to retrieve that value. You can also use special variables there.

[Lib ]

The Lib command tells GCA to include only if the trait or modifier being looked at is from a library. If it is not from a library, the entire command block is removed from display.

[Char only if the trait or modifier being looked at is from a character. If it is not from a character, the entire command block is removed from display.

[Empty %tag%=]

The Empty command tells GCA to include only if the %tag% is empty or has a value of 0. Notice that the and the %tag% are separated by an = sign, which is required. If %tag% is empty or 0, the entire command is replaced by the contents of .

[NotEmpty %tag%=]

The NotEmpty command tells GCA to include only if the %tag% is not empty or 0. Notice that the and the %tag% are separated by an = sign, which is required. If %tag% is not empty or 0, the entire command is replaced by the contents of .

[Size[+|-|*]]

Size allows for adjusting the relative font size of the output.

Normally you would have every font size specified outright in the RTF. This is fine if you want your output fixed, and don’t want it to resize based on the user’s zoom factor.

However, if you want the output to change based on Zoom, you can make adjustments with the Size command. You would include this command in place of the font size value in a normal RTF \fsXX size tag. So \fs[Size+10] would increase the size of the font by 10 points relative to the default font size, and \fs[Size*1.25] would increase the size by 25 percent.

(To me, the default TrueType fonts I’ve set feel a little small compared to other interface elements, so my default templates upsize them all a little bit.)

[DebugMode]

[DebugMode] is a special marker that can be anywhere in the template. I usually just tack it on the end where it’s out of the way.

[DebugMode] tells GCA to run this template in Debug Mode, which will cause GCA to reload the template from the source file every time it is requested, which is pretty much every time you click on a trait. This will allow you to easily adjust your templates and see immediate results inside GCA.

Without this marker, GCA would load the templates only during the initialization process when you first launch the program.

Here’s an example of a template coded using this method. In plain text, it can be a bit hard to follow until you get used to RTF, but it’s much easier in a decent code editor.

Example A

\pard\f0\fs[Size*1.1]
{\cf2\b\fs[Size*1.3] %DisplayName%}\par
[LIB
{\f1\fs[Size*1.2] Library Item (%TraitType%)}\par
]
[NotEmpty %inactive%={\f1\cf1 This trait is Inactive.}\par]
\par
{\f1\b Page:} %page%\par
\par
{\f1\b Type:} %type%\par
{\f1\b Cat.:} %cat%\par
\par
[NotEmpty %upto%={\f1\b Upto:} %upto%\par]
[NotEmpty %needs%={\f1\b Needs:} %needs%\par]
[NotEmpty %taboo%={\f1\b Taboo:} %taboo%\par]
[NotEmpty %default%={\f1\b Default:} %default%\par]
[NotEmpty %gives%=\par{\f1\b Gives:} %gives%\par]
\par
[NotEmpty %description%={\f1\b Desc.:} %description%\par]
[NotEmpty %notes%={\f1\b Notes:} %notes%\par]

[CHAR
\par
{\b\f1\cf2 Character Info}\par

[NotEmpty %locked%={\f1\cf1 Trait is locked, and can’t be edited.}\par]
[NotEmpty %gms%={\f1 Include on GM Sheet.}\par]
[NotEmpty %keep%={\f1\b Component Of:} %%keeper%%\par]
[NotEmpty %deffrom%={\f1\b Defaulted From:} %deffrom%\par]

[NotEmpty %%modscount%%=
{\f1\b Modifiers Applied:} %%appliedmods%%\par
{\f1\b Modifiers Applied:} %%appliedmodifiers%%\par]

[NotEmpty %tabootext%=
{\f1\cf1 Current Taboos:}\par
{\cf1 %tabootext%}\par]

[NotEmpty %bonuslist%=
{\f1\b Bonuses:}\par
%bonuslist%\par]
[NotEmpty %conditionallist%=
{\f1\b Conditionals:}\par
%conditionallist%\par]

{\f1\b User Notes:} %usernotes%\par
][DebugMode]

Alternate Method

Now I’ll cover the alternative method.

These commands are very similar to those in the standard method, but some of the commands are not entirely self-contained, and instead rely on other commands to mark the end of a defined block.

Here are all the currently defined commands for this method.

[Lib][EndLib]
[Char][EndChar]
[Empty %tag%][End]
[NotEmpty %tag%][End]
[Size[+|-|*]]
[DebugMode]
[AlternateMode]

[Lib][EndLib]

These together mark the start and end of a Lib block.

If you are looking at a trait in the Library listing, then will be included in the display. If not, eveything in that block is removed. You can

You may include NotEmpty and Empty commands within Lib or Char blocks..

[Char][EndChar]

These together mark the start and end of a Char block.

If you are looking at a trait in the Character listing, then will be included in the display. If not, eveything in that block is removed.

You may include NotEmpty and Empty commands within Lib or Char blocks..

[Empty %tag%][End]
[NotEmpty %tag%][End]

Empty and Notempty commands both end at the next found End command. Because of this, you can never successfully include one of these commands within the of one of these commands; is limited to plain text, RTF commands, and variables.

Empty will include the text between the Empty command and the next End command only if the %tag% value IS nothing or 0. If the %tag% is not nothing or 0, then that block from Empty through End is not displayed.

NotEmpty will include the text between the NotEmpty command and the next End command only if the %tag% value IS NOT nothing or 0. If the %tag% is nothing or 0, then the entire block from NotEmpty through End is not displayed.

[Size[+|-|*]]
[DebugMode]

Size and DebugMode are the same as above.

[AlternateMode]

[AlternateMode] is another special marker. Put it anywhere, it’s removed during loading. When found, it sets a flag telling GCA that the commands in this template should be processed using the alternate method.

Working with RTF

Here are two examples of the same simple template, formatted differently, using Alternate Mode to make commands stand out a bit:

Example 1

\pard\f0\fs[Size*1.1]
{\cf2\b\fs[Size*1.3] %DisplayName%}\par
[Lib]
{\f1\fs[Size*1.2] Library Item (%TraitType%)}\par
[EndLib]
\par
{\fs[Size+10] {\f1\b Page:} %page%}\par
\par
{\f1\b Type:} %type%\par
{\f1\b College:} %cat%\par
[NotEmpty %upto%]
{\f1\b Upto:} %upto%\par
[End]
[NotEmpty %needs%]
{\f1\b Needs:} %needs%\par
[End]
[Empty %needs%]
{\f1\b Needs:} Yay! No prereqs!\par
[End]
[NotEmpty %taboo%]
{\f1\b Taboo:} %taboo%\par
[End]
\par
{\f1\b Prereq Count:} %prereqcount%\par
{\f1\b Casting Cost:} %castingcost%\par
{\f1\b Casting Time:} %time%\par
{\f1\b Duration:} %duration%\par
\par
{\f1\b Desc.:} %description%\par
{\f1\b Notes:} %notes%\par
[DebugMode][AlternateMode]

This example uses the RTF grouping grouping with curly braces, so that a change you make, such as to bolding, only applies within the braces. This is my preferred method, as I find it easier to read and code by hand. I also put each command on its own line to improve readability when using the chunky commands.

Example 2

\pard
\cf2\b\f0\fs[Size*1.3] %DisplayName%\cf0\b0\fs\par
[Lib]\f1\fs[Size*1.2] Library Item (%TraitType%)\fs[Size]\par [EndLib]
\par
\f1\fs[Size+10]\b Page: \f0\b0 %page%\fs[Size*1.1]\par
\par
\f1\b Type: \f0\b0 %type%\par
\f1\b College: \f0\b0 %cat%\par
[NotEmpty %upto%]\f1\b Upto: \f1\b0 %upto%\par [End]
[NotEmpty %needs%]\f1\b Needs: \f0\b0 %needs%\par [End]
[Empty %needs%]\f1\b Needs: \f0\b0 Yay! No prereqs!\par [End]
[NotEmpty %taboo%]\f1\b Taboo: \f0\b0 %taboo%\par [End]
\par
\f1\b Prereq Count: \f0\b0 %prereqcount%\par
\f1\b Casting Cost: \f0\b0 %castingcost%\par
\f1\b Casting Time: \f0\b0 %time%\par
\f1\b Duration: \f0\b0 %duration%\par
\par
\f1\b Desc.: \f0\b0 %description%\par
\f1\b Notes: \f0\b0 %notes%\par
[DebugMode][AlternateMode]

This example uses the RTF commands like switches, so each time you change bolding or color, you have to switch it back again when you are done. I also show using the commands inline with the text.

The RTF coding can make it a bit hard to read, but you can see the use of the commands and the required enclosing of tag names in % signs. Notice that there are two possible outputs for needs(), depending on whether it’s empty or not. GCA also knows to hook up the page() data for the jump links to PDFs.

It’s also usually a good idea to explicitly set what you consider the default font values right up front, especially if you prefer to use the braces method of isolating the RTF commands. Don’t assume that the ‘default’ font size is automatically set, for example, or that font 0 is set if you didn’t set it.

RTF codes

Each RTF tag begins with a \ and must be followed by either another RTF tag or a space. Also, font sizes specified are *double* the point size you actually want, so \fs20 means a 10 point font size.

RTF doesn’t allow you to specify inline color coding or fonts. Instead, you define a font table and a color table in the header, which is something that GCA does for you behind the scenes. GCA has defined two different fonts in the table: \f0 switches to Times New Roman and \f1 switches to Arial. If either isn’t available, a similar system font should be substituted automatically. GCA defines six colors: red, green, blue, gray, purple, and whatever color you’ve specified in Options for page links. These colors are selected in the order given with the \cfX tag, so \cf2 selects green. Restore black text using \cf0.

The RTF box included with GCA handles a lot of RTF commands, but not everything, and documentation for it isn’t great. However, you can find RTF references online, and many of the character and line formatting codes will work.

Using an RTF Editor

If you’d like to use an RTF editor, don’t use Word, because it fills the file with tons of crap. I’ve found WordPad works pretty well as a basic RTF editor, and the files it writes are pretty lean.

Here is an example of a template as it might appear within WordPad. I don’t have formatting showing because most of my notes are plain-text. However, aside from that, take a look at how I formatted the various blocks.

Example 3

%DisplayName%
[LIB]Library Item (%TraitType%)
[ENDLIB][NotEmpty %inactive%]This trait is Inactive.
[END]
Page: %page%
Cost: %%costprog%%
Cat.: %cat%

[NotEmpty %upto%]Upto: %upto%
[END][NotEmpty %gives%]Gives: %gives%
[END][NotEmpty %needs%]Needs: %needs%
[END][NotEmpty %taboo%]Taboo: %taboo%
[END][NotEmpty %description%]Description: %description%
[END][NotEmpty %notes%]Notes: %notes%
[END]
[CHAR]Character Info
[NotEmpty %locked%]Trait is locked, and can’t be edited.
[END][NotEmpty %gms%]Include on GM Sheet.
[END][NotEmpty %keep%]
Component Of: %%keeper%%
[END][NotEmpty %deffrom%]Defaulted From: %deffrom%
[END][NotEmpty %%modscount%%]Modifiers Applied:
%%appliedmodifiers%%
[END][NotEmpty %tabootext%]Current Taboos:
%tabootext%
[END][NotEmpty %bonuslist%]Bonuses:
%bonuslist%
[END][NotEmpty %conditionallist%]Conditionals:
%conditionallist%
[END]User Notes: %usernotes%
[ENDCHAR]
This is from the full RTF file.[DebugMode][AlternateMode]

Notice that I have each [End] command actually starting the line after the command started? That’s so that when GCA removes inapplicable blocks, the paragraph markers go away as well. This helps to avoid the problem I mentioned above with extra blank lines appearing in the Info pane.

The Files

There is a template for every trait type and modifiers. The template files go into the \plugins\ bin, for lack of anywhere better. The file names that GCA looks for are these:

viewinfo_template_attributes.rtf
viewinfo_template_advantages.rtf *
viewinfo_template_perks.rtf *
viewinfo_template_disadvantages.rtf *
viewinfo_template_quirks.rtf *
viewinfo_template_cultures.rtf *
viewinfo_template_languages.rtf *
viewinfo_template_features.rtf *
viewinfo_template_templates.rtf *
viewinfo_template_skills.rtf
viewinfo_template_spells.rtf
viewinfo_template_equipment.rtf
viewinfo_template_modifiers.rtf
viewinfo_template_adtypes.rtf

The viewinfo_template_adtypes.rtf file can substitute for any, or all, of the advantage-style traits if their file is missing. All the files for which this one can serve as backup are marked with a * in the list.

Note that these files don’t have to be full RTF, even though they have that extension. The Examples above are sufficient for GCA’s use, and would be what you could find in these files. Opening a file like that with a standard RTF editor will most likely not treat such a file as valid RTF, and would likely treat it as plain text instead.

You can, however, use a full RTF file. If you do so, you don’t have to worry about hand-coding your RTF tags, but you’ll get fixed font sizes, because that’s what the file will write in the background. Also, you may find that the formatting in GCA often results in apparently extra blank lines. That is because GCA removes blocks that don’t apply, and paragraph/line-breaks often fall outside of the related tags.

* Files

Updated targettags.xml to match the text in the documentation.

Included the following info templates in the \plugins\ install folder:

viewinfo_template_adtypes.rtf
viewinfo_template_attributes.rtf
viewinfo_template_equipment.rtf
viewinfo_template_modifiers.rtf
viewinfo_template_skills.rtf
viewinfo_template_spells.rtf
viewinfo_template_templates.rtf

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.