Apparently random bits of miscellany and functionals (b200)

b200

* Miscellaneous

GCA should no longer claim #Verbose On is a bad data file command (but still work) when it is a good command. Same for the #ModifierGroupWarnings command.

The #Clone data file command should now work with templates, and should better handle unsupported prefix tags.

Addsorincreases() didn’t correctly increase equipment counts. Now it does.

The combination attacks version of Edit Traits was crashing when trying to add a new combination. That is now fixed.

Added a system flag so I can have some system messages not go to the log when I’m doing things where they are repetitive or unnecessary. And then added support for that flag to a number of messages (such as new character and library loaded messages in randomized templates).

When handling an adds() or addsorincreases() for a trait name without an extension, and GCA only finds versions with extensions, GCA would pop up a dialog asking the user to pick one of those found. When doing a random template, this pop-up still popped up and waited for user input. That is now fixed and a random selection is made from the items found.

I have added a new engine option for verbose template processing. This option is off (False) by default. The idea is that nearly every message that gets logged during template processing is actually only useful for template writers, but not for users. Having all those messages get sent to the log cheapens the log for the typical user by filling it with what appears to be nonsense. (And much of what gets sent to the log is just noise to users, since many templates these days rely on certain behaviors to work correctly, but those behaviors also often send messages to the log). So, with this new option, just about every template processing message that used to get sent to the log now only gets sent if this new option is turned on (True). This option is available in Options, on the Program Options tab, on the Characters pane as the “Show all status messages when processing templates.” checkbox.

In Select dialogs, sometimes the options meant to be available are built from things that were chosen in previous dialogs. This sometimes means that an option may have a different name extension on the character than in the library. Previously, GCA wouldn’t find it in the library and would just give up on that item. Now, if GCA doesn’t find the specified item in the library, it will see if it can find a version on the character, and if so, use that as the template for the item in the selection list..

The new template tag setloadout() can be used to change the character’s active loadout to the loadout specified in the tag. This can be used inside triggers().

* Random Character dialog

I have restructured the order of things in the process that the Random Character dialog (called from either Randomized Template option in the Tools menu) uses when adding random templates. First it names the character, then runs the template. This will allow for templates to be built that apply random character names.

Also, the character names are no longer modified to include “- but Canceled” if it looks like the template didn’t complete properly. GCA will now wait until all the random characters have been built, then print one “Randomized template issues:” block to the Log pane, with a message about that for each such character.

I have also made the system check for the #deleteme command in the initial template, so that it will not assume a canceled template just because the initial template deleted itself once finished.

* Functions

@ItemsInLibraryGroup( GroupName )

This function returns the number of items for the GroupName specified, as found in the character’s loaded library’s Group collection. This is specifically the Library count, as currently loaded, just as it would be referenced if you were creating a group list for use in a Select dialog.

@ItemsInLibraryList( ListName )

This function returns the number of items for the ListName specified, as found in the character’s loaded library’s Lists collection.

Be aware that List usage is not the same as Group usage in GCA, as a List is just a collection of text lines, while a Group is specifically a collection of items, one per line. This means that a List may consist of many items per line, and its usage by the file author will likely not correspond to one item per line, but may result in many items in the destination output. Instead of counting the items in the List, you may want to use @ItemsInList to count the items in an equivalently constructed text list instead.

@ItemsInList( [ #codes() ] item list )

This function allows you to count the items in the given list and return that value. The #codes() special directive allows you to specify special commands to control how the list is processed.

By default, the list of items is considered to be comma separated, and each individual entry may be enclosed in quotes or braces as usual.

The only code currently supported for #codes() is #codes(sep=X) to change the separator from a comma to some other character. NOTE: If you specify multiple characters, each one individually is a separator, NOT the whole string as a single unit. You may enclose the separator in quotes or braces, such as #codes(sep=” “).

@Random( value1 [, value2] )

The @random() function returns a random integer value. Note that the values are applied differently depending on whether one or two values are supplied.

The templates for this are:

For an integer 1 to max: @random(<max>)”)
For an integer min to max : @random(<min>, <max>)”)

If only <max> is specified, then the value returned ranges from 1 to the <max> value. If both <min> and <max> are specified then the value returned ranges from the <min> to the <max>.

@Roll( number [, sides] )

The @roll() function returns the sum total for a series of random results simulating rolled dice.

The templates for this are:

For rolling Xd6: @Roll(<number>)
For rolling XdY: @Roll(<number>, <sides>)

If <sides> is not specified it uses six-sided dice. So using @roll(2,4) would ‘roll’ 2 4-sided dice, and would return the total sum of all ‘rolled’ values.

$RollValues( number [, sides] )

The $rollvalues() function returns a text value that is a sequence of values separated by + signs, representing every roll made for the given parameters

The templates for this are:

For rolling Xd6: $RollValues(<number>)
For rolling XdY: $RollValues(<number>, <sides>)

If <sides> is not specified it uses six-sided dice. So using $rollvalues(2,4) would ‘roll’ 2 4-sided dice, and would return the value as something similar to ‘1+4’, so that it can be included in a math expression.

$ListNoBlanks( [ #codes() ] item list )

This function allows you to process a list of items and remove the empty entries. The #codes() special directive allows you to specify special commands to control how the list is processed.

By default, the list of items is considered to be comma separated, and each individual entry may be enclosed in quotes or braces as usual.

You may specify #codes(hasprefix) or #codes(prefixtags) to tell the function that the entries in the list are expected to be trait names tagged with prefix tags and therefore any item that does not have both, or where either part is not specified, are considered to be blank items.

You may specify #codes(sep=X) to change the separator from a comma to some other character. NOTE: If you specify multiple characters, each one individually is a separator, NOT the whole string as a single unit. You may enclose the separator in quotes or braces, such as #codes(sep=” “).

If you specify multiple codes entries, separate them with commas.

* #Loadout() / Loadout()

Support for using the #loadout() special directive has been added to adds(), addsorincreases(), and creates().

If you use the #loadout() special directive to add an item to a loadout, then GCA will now automatically apply protection from any armor or shield items so added. This seemed to be the most likely desired action, so it was made the default. If you do NOT want that to happen, include #noarmor as part of the loadout name inside the #loadout() directive for each loadout not receive protection.

If you are adding a shield, you can use #arc() as part of the loadout name to specify the protected arc. At this time, the supported arcs are ‘none’ (the default), ‘back’, ‘left arm’, and ‘right arm’.

Example:

Loadout Tester (Adds),
displaycost(0),
cost(0),
page(User),
noresync(yes),
adds(_
{EQ:Backpack, Small #loadout(Pack)}=1,
{EQ:Blanket #loadout(Pack)}=2,
{EQ:Canteen #loadout(Pack)}=1,
{EQ:Leather Jacket #loadout(Pack, Combat)}=1,
{EQ:Heavy Leather Leggings #loadout(Pack, Combat)}=1,
{EQ:Gauntlets #loadout(Pack #noarmor, Combat)}=1,
{EQ:Small Shield #loadout(Pack #arc(back), Combat #arc(left arm) ) }=1,
{EQ:Steel Breastplate #loadout(pack #noarmor)}=1_ 
)

This template will apply all items to the ‘pack’ loadout, and some of the armor to the ‘combat’ loadout. The Steel Breastplate is not being worn, so it’s flagged as #noarmor in the ‘pack’ loadout where it resides. The Small Shield is worn on the back in the ‘pack’ loadout but on the left arm in the ‘combat’ loadout. And since gauntlets are annoying to wear casually, they’re also not being worn in the ‘pack’ loadout.

Note that the loadout() tag, which inserts the item with that tag into loadouts in a similar fashion, now also applies protection by default and also supports the #noarmor and #arc() directives.

You can also use this feature to assign protection for the virtual ‘All unassigned items’ loadout by leaving the loadout name portion blank, or by explicitly referencing a blank loadout using empty quotes “”. Note that this means using an empty loadout() tag on a trait will trigger GCA trying to assign it to a loadout and to apply protection, so don’t include empty loadout() tags unless that’s what you want to happen.

* Plugins

In compile.xml, you may now use the variable %home% in a ‘reference’ element to point at the plugin’s home install folder. This should allow for the compiler to properly find and reference additional DLLs that you may need to include with your plugin.

* Export to Roll20

A new exporter from Mad Coder that creates a json export file for importing into the Roll20 VTT.

 

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.