-
-
Notifications
You must be signed in to change notification settings - Fork 75
Export Templates
As of GCS v5.15, GCS introduced two new ways of exporting textual versions of character sheets, while retaining the old (and now deprecated) method used in previous releases:
- GCS Text Template v1, which makes no effort to make the output HTML-friendly (i.e. escaping what would be HTML directives in user-provided content, etc.).
- GCS HTML Template v1, which does try to escape user-provided content so that it will display correctly in a web page.
The first line of the file is used to determine the type of processing to perform on it. When the first line is "GCS Text Template v1", without the surrounding quotes, and nothing else, the text templating facilities will be used. If, instead, the first line is "GCS HTML Template v1", the HTML templating facilities will be used. If neither of those is found, GCS will assume it is an old format pre-dating this change and use that processor instead. In a future release (most likely sometime in 2024 or later), that old processor will be removed and those old templates will no longer give the desired results.
Both of these new formats are based on the Go language's templating facilities. Details about GCS-specific functionality is provided below and much more detail about Go's templating facilities and how they work can be found on the https://go.dev site. Specifically, https://pkg.go.dev/text/template for the text template and https://pkg.go.dev/html/template for the HTML template.
When the template is called, it will be given a Sheet value (the various data types are described below).
There are a number of top-level, GCS-specific, functions that have been made accessible within a template. These are
divided into two general categories, those that manipulate GCS's internal fixed-point numbers (Number) and those that
manipulate strings.
-
numberFrom— Returns the equivalentNumbervalue ofvalue- Parameter:
value(int, float64, or string that contains a number)
- Parameter:
-
numberToFloat— Returns the equivalent floating-point number value ofvalue- Parameter:
value(Number)
- Parameter:
-
numberToInt— Returns the equivalent integer value ofvalue- Parameter:
value(Number)
- Parameter:
-
caselessEqual— Returns true ifleftandrightare the same when case isn't considered- Parameter:
left(string) - Parameter:
right(string)
- Parameter:
-
contains— Returns true ifstrcontainssubstr- Parameter:
str(string) - Parameter:
substr(string)
- Parameter:
-
hasPrefix— Returns true ifstrstarts withprefix- Parameter:
str(string) - Parameter:
prefix(string)
- Parameter:
-
hasSuffix— Returns true ifstrends withsuffix- Parameter:
str(string) - Parameter:
suffix(string)
- Parameter:
-
indexStr— Returns an index intostrwheresubstrstarts, or -1 ifsubstrisn't contained instr.
NOTE: This was namedindexprior to GCS v5.33.0, but was renamed due to conflicts with built-in functions that Go supplies.- Parameter:
str(string) - Parameter:
substr(string)
- Parameter:
-
join— Returns a new string by concatenating the elements ofelemsto create a single string, placingsubstrbetween each element in the resulting string- Parameter:
elems, ([]string) - Parameter:
sep(string)
- Parameter:
-
lastIndexStr— Returns an index intostrwhere the lastsubstrstarts, or -1 ifsubstrisn't contained instr.
NOTE: This was namedlastIndexprior to GCS v5.33.0, but was renamed to be consistent withindexStr.- Parameter:
str(string) - Parameter:
substr(string)
- Parameter:
-
lower— Returns the lowercase version ofstr- Parameter:
str(string)
- Parameter:
-
repeat— Returns a new string consisting ofcountcopies ofstr- Parameter:
str(string) - Parameter:
count(int)
- Parameter:
-
replace— Returns a copy ofstrwith all non-overlapping instances ofoldreplaced bynew- Parameter:
str(string) - Parameter:
old(string) - Parameter:
new(string)
- Parameter:
-
split— Returns a slice of sub-strings by splittingstrinto all sub-strings separated bysep- Parameter:
str(string) - Parameter:
sep(string)
- Parameter:
-
splitN— Returns a slice of sub-strings by splittingstrinto at mostcountsub-strings separated bysep-
str(string) -
sep(string) -
count(int)
-
-
trim— Returns a copy ofstrwith all leading and trailing white space removed- Parameter:
str(string)
- Parameter:
-
trimPrefix— Returns a copy ofstrwithout theprefixat the beginning- Parameter:
str(string) - Parameter:
prefix(string)
- Parameter:
-
trimSuffix— Returns a copy ofstrwithout thesuffixat the end- Parameter:
str(string) - Parameter:
suffix(string)
- Parameter:
-
upper— Returns the uppercase version ofstr- Parameter:
str(string)
- Parameter:
The remainder of this document details the various data types that the data is made up of.
-
.Carried([]Equipment) -
.CarriedValue(Number) -
.CarriedWeight(string) -
.Other([]Equipment) -
.OtherValue(Number)
-
.CombinedName(string) -
.FullName(string) -
.ID(string) -
.Name(string) -
.Points(Number) -
.Value(Number)
-
.Pools([]Pool) -
.PoolsByID(map[string]Pool)
NOTE: This did not exist prior to v5.33.0 -
.Primary([]Attribute) -
.PrimaryByID(map[string]Attribute)
NOTE: This did not exist prior to v5.33.0 -
.Secondary([]Attribute) -
.SecondaryByID(map[string]Attribute)
NOTE: This did not exist prior to v5.33.0
-
.Locations([]HitLocation) -
.Name(string)
-
.ID(string) -
.Situation(string) -
.Sources([]Source) -
.Total(Number)
-
.Dodge(int) -
.IsCurrent(boolean) -
.Level(int) -
.MaxLoad(string) -
.Move(int) -
.Name(string) -
.Penalty(int)
-
.Cost(Number) -
.Depth(int) -
.Description(string) -
.Equipped(boolean) -
.ExtendedCost(Number) -
.ExtendedWeight(string) -
.ID(string) -
.LegalityClass(string) -
.MaxUses(int) -
.ModifierNotes(string) -
.Notes(string) -
.PageRef(string) -
.ParentID(string) -
.Quantity(Number) -
.Tags([]string) -
.TechLevel(string) -
.Type(string) -
.UnsatisfiedReason(string) -
.Uses(int) -
.Weight(string)
-
.Depth(int) -
.DR(string) -
.Notes(string) -
.Penalty(int) -
.RollRange(string) -
.Where(string)
-
.Basic(string) -
.CarryOnBack(string) -
.OneHanded(string) -
.RunningShove(string) -
.ShiftSlightly(string) -
.Shove(string) -
.TwoHanded(string)
-
.Cast(string) -
.Maintain(string)
-
.Bottom(string) -
.Left(string) -
.Right(string) -
.Top(string)
-
.Block(string) -
.Damage(string) -
.Description(string) -
.Level(Number) -
.Notes(string) -
.Parry(string) -
.Reach(string) -
.Strength(string) -
.Usage(string)
-
.Depth(int) -
.Description(string) -
.ID(string) -
.PageRef(string) -
.ParentID(string) -
.Type(string)
A special type of number that uses a fixed number of decimal digits for calculations, unlike traditional floating-point numbers.
-
.Abs— Returns the absolute value of this value -
.Add— Returns the result of adding this number tovalue- Parameter:
value(Number)
- Parameter:
-
.Ceil— Returns the value rounded up to the nearest whole number -
.Comma— Returns the string representation of this value, but with commas for values of 1000 and greater -
.CommaWithSign— Same as.Comma, but prefixes the value with a '+' if it is positive -
.Dec— Returns the value decremented by 1 -
.Div— Returns the result of dividing this number byvalue- Parameter:
value(Number)
- Parameter:
-
.Inc— Returns the value incremented by 1 -
.Max— Returns the maximum of this value orvalue- Parameter:
value(Number)
- Parameter:
-
.Min— Returns the minimum of this value orvalue- Parameter:
value(Number)
- Parameter:
-
.Mod— Returns the remainder after subtracting all full multiples of the passed-invaluefrom this number- Parameter:
value(Number)
- Parameter:
-
.Mul— Returns the result of multiplying this number byvalue- Parameter:
value(Number)
- Parameter:
-
.Round— Returns the nearest integer value, rounding half away from zero -
.String— Returns the string representation of this value -
.StringWithSign— Same as.String, but prefixes the value with a '+' if it is positive -
.Sub— Returns the result of subtractingvaluefrom this number- Parameter:
value(Number)
- Parameter:
-
.Trunc— Returns a value which has everything to the right of the decimal place truncated
-
.Height(string) -
.Margins(Margins) -
.Width(string)
-
.Advantages(Number) -
.Ancestry(Number) -
.Attributes(Number) -
.Disadvantages(Number) -
.Quirks(Number) -
.Skills(Number) -
.Spells(Number) -
.Total(Number) -
.Unspent(Number)
-
.CombinedName(string) -
.Current(Number) -
.FullName(string) -
.ID(string) -
.Maximum(Number) -
.Name(string) -
.Points(Number)
-
.Accuracy(string) -
.Bulk(string) -
.Damage(string) -
.Description(string) -
.Level(Number) -
.Notes(string) -
.Range(string) -
.RateOfFire(string) -
.Recoil(string) -
.Shots(string) -
.Strength(string) -
.Usage(string)
This is the object passed in to the template. All other data is derived from it.
-
.Age(string) -
.Attributes(Attributes) -
.Birthday(string) -
.BodyType(BodyType) -
.ConditionalModifiers([]ConditionalModifier) -
.CreatedOn(string) -
.EmbeddedPortraitDataURL(string) -
.Encumbrance([]Encumbrance) -
.Equipment(AllEquipment) -
.Eyes(string) -
.Gender(string) -
.GridTemplate(string) -
.Hair(string) -
.Handedness(string) -
.Height(string) -
.Lift(Lift) -
.MeleeWeapons([]MeleeWeapon) -
.ModifiedOn(string) -
.Name(string) -
.Notes([]Note) -
.Organization(string) -
.Page(Page) -
.Player(string) -
.Points(Points) -
.RangedWeapons([]RangedWeapon) -
.Reactions([]ConditionalModifier) -
.Religion(string) -
.SizeModifier(int) -
.Skills([]Skill) -
.Skin(string) -
.Spells([]Spell) -
.Swing(string) -
.TechLevel(string) -
.Thrust(string) -
.Title(string) -
.Traits([]Trait) -
.Weight(string)
-
.Depth(int) -
.Description(string) -
.Difficulty(string) -
.ID(string) -
.Level(string) -
.ModifierNotes(string) -
.Notes(string) -
.PageRef(string) -
.ParentID(string) -
.Points(Number) -
.RelativeLevel(string) -
.Tags([]string) -
.Type(string) -
.UnsatisfiedReason(string)
-
.Amount(Number) -
.Source(string)
-
.Class(string) -
.Colleges([]string) -
.Depth(int) -
.Description(string) -
.Difficulty(string) -
.Duration(string) -
.ID(string) -
.Level(string) -
.Mana(Mana) -
.Notes(string) -
.PageRef(string) -
.ParentID(string) -
.Points(Number) -
.RelativeLevel(string) -
.Resist(string) -
.Rituals(string) -
.Tags([]string) -
.TimeToCast(string) -
.Type(string) -
.UnsatisfiedReason(string)
-
.Depth(int) -
.Description(string) -
.ID(string) -
.ModifierNotes(string) -
.Notes(string) -
.PageRef(string) -
.ParentID(string) -
.Points(Number) -
.Tags([]string) -
.Type(string) -
.UnsatisfiedReason(string) -
.UserDescription(string)
Last updated for GCS v5.39
GURPS page references (example: B16) are provided for convenience. For full rules, see the relevant GURPS publications.
Building characters
- Character Sheet Overview
- Library Explorer
- Core Concepts
- Abilities
- Gear & Notes
Advanced Features
Customization
- Settings
- Appearance