/usr/pkg/bin/pod2html: bin/gffmodify.pl: unexpected =item directive in paragraph 124. ignoring.
gffmodify - Find matching items and modify them from the gff structures
gffmodify [--help|-h] [--version|-V] [--verbose|-v]
[--config config-file]
[--no-write|-n]
[--interactive|-i]
[--backup|-b]
[--find-struct|-s structure-regexp]
[--print-fields|-p fields-to-print-regexp]
--find|-f label-regexp:=:
value-regexp
[--find|-f label-regexp:=:
value-regexp ...]
[--find|-f label-regexp:!:
value-regexp ...]
[--or|-o --find|-f label-regexp:=:
value-regexp ...]
[--modify|-m label=
value]
[--modify|-m label[#
type]=
value|@ask
[(
default)
]@
]
[--variable varname=
value]
[--variable varname[#
int
|float
|string
]=
value]
[--parameter|-P name=
relative-path]
[--global-parameter|-g name=
absolute-path]
[--area-parameter|-a name=
absolute-path]
[--variable-parameter name=
varname]
[--variable-parameter name=
/globalvarname]
[--variable-parameter name=
..parentvarname]
filename ...
gffmodify --help
gffmodify first finds the structure specified with the -s option (or use root if it is not set). Then it starts matching the list of -f options in the order of all of them match then it will start modifying the structure. All -f options are anded together, and multiple set of -f options can be given separated with -o which are then ored together (i.e. if any of the sets ored together matches then modify structure).
When the matching structure is found, then the modifications listed in
the --modify are done in the order they are given. There can be
multiple --modify options. If the value is @ask@
then the
program will ask for new value for the field. If you want to use some
other default than the old value, simply use @ask(
default)@
as a new value.
In addition to changing the value of fields, the gffmodify can add variables to the given structure. This can be done by using --variable option. The --variable option works just like --modify but it will add variable instead of modifying field.
When using interactive options (-i to prompt before, or @ask@
) then
the -p option might be useful to print out some field from the
struct.
If information needs to be copied from different parts of the tree to
some other parts, then named parameters can be used to do that. Named
parameters are created by using --parameter, --global-parameter,
--area-parameter or --variable-parameter. Each of those options
takes a name of the parameter and the path to use when getting the
parameter value. The --parameter takes the parameters from the
given structure, i.e. the path is relative to the current matched
structure. The --global-parameter takes the parameters from the
toplevel structure, and --area-parameter takes them from the area
file instead of this git file (it is useful when getting for example
Name or Tag of the area). As area name and tag are so commonly used
there is always automatic paramters @areaname@
and @areatag@
which are set to match the area name and tag.
The --variable-parameter takes the parameter value from the
variables. It can take 3 different types of input. If the varname
is simply normal variable then it is taken from the current structure.
If it is /
varname then it is taken from the toplevel structure,
and if it is ..
varname then it is is taken from the matching
structure, and if not set there then from the parent structure etc.
When adding new items the type normally needs to be given. Types are given in numbers just like the __type field has (0 = byte, 1 = char, 2 = word, etc). If you are modifying old value, then no need to set type. You cannot add items to arrays using this tool yet, you can only add or modify fields in the structures.
^/Creature List\\[\\d+\\]/\$
.
@
name@
it is replaced with the named
paramter name. For areas there is automatic parameters named
@areaname@
, and @areatag@
. For all items there is always the
@path@
. Those items can appear anywhere on the regexp and if they
are there, the values of them are printed out. So use them inside the
regexp like this: Name|Tag|@areaname@
.
:=:
value-regexp>:!:
value-regexp>#
type]=
value@ask@
in which case the
value will be asked from user. The default for the @ask@
can be
given in parenthesis after the ask text, i.e. @ask(
default)@
.
The value can also contain any of the named parameters, and those
named parameters can even be used as a default value (i.e.
@ask(@areaname@)@
.
#
int
|float
|string
]=
value]@remove@
.
The value can also be special value @ask@
in which case the
value will be asked from user. The default for the @ask@
can be
given in parenthesis after the ask text, i.e. @ask(
default)@
.
The value can also contain any of the named parameters, and those
named parameters can even be used as a default value (i.e.
@ask(@areaname@)@
.
=
relative-path@name@
.
It can also be used when modifying field or setting variables. It
cannot be used when matching the structure.
=
absolute-path@name@
. It can also
be used when modifying field or setting variables. It cannot be used
when matching the structure.
=
absolute-path@name@
. It can also be used when modifying field or
setting variables. It cannot be used when matching the structure.
=
varname/
then then variable read from the top structure. If
it starts with ..
then the variable is read first from mathing
structure, and if not found there, the parent structure, etc until it
is read from the top structure. In other cases the variable is read
directly from the matching structure.
This name can then be used in the -p structure in format
@name@
. It can also be used when modifying field or setting
variables. It cannot be used when matching the structure.
=head1 EXPRESSIONS
The named parameter can also do simple expressions. I.e. instead of
only @name@
they can have @random(12)@
or similar functions
which are replaced with the output of the given function.
Supported functions are:
gffmodify.pl \ -v \ -s '^/$' \ -f '^/ScriptOnNotice$:=:^X$' \ -m '/ScriptOnNotice=Y' \ -m '/ScriptSpawn=Z' \ *.utc gffmodify.pl \ -v \ -s '^/Placeable List\[\d+\]/$' \ -f '/OnOpen$:=:^X$' \ -m '/OnOpen=Y' \ *.git gffmodify.pl -v -f '/Tag$:=:^CELIALIAMYN$' -m 'Tag=CELIASAD' Celia.utc gffmodify.pl \ -p 'Fog|Tag|@areaname@' \ -f '^/FogClipDist$:=:.' \ -m 'FogClipDist=@ask(55)@' \ -v \ *.are gffmodify.pl \ -p 'Plot|Static|Useable|LocName|Tag|@areaname@' \ -s '^/Placeable List\[\d+\]/$' \ -f '/Plot$:=:^0$' \ -m 'Plot=@ask@' \ -v *.git gffmodify.pl \ -v \ -s '^/Door List\[\d+\]/$' \ -f '/Locked$:=:^0$' \ -f '/Lockable$:=:^0$' \ -f '/KeyRequired$:=:^0$' \ -f '/KeyName$:=:^$' \ -m '/KeyRequired=1' \ -m 'KeyName=dm_quest_key' \ *.git gffmodify.pl \ -p '@areaname@|@areatag@|/Var' \ --variable 'X2_L_WILD_MAGIC=1' \ -v \ *.git gffmodify.pl \ -p 'FirstName|@areaname@|@areatag@|@wild@|@height@|@item@|@tag@' \ -P 'tag=Tag' \ -variable-parameter 'wild=/X2_L_WILD_MAGIC' \ -a 'width=/Width' \ -a 'height=/Height' \ -s '^/Creature List\[\d*\]/$' \ --variable-parameter 'item=giveitem1' \ -f '/ChallengeRating$:=:.' \ -m 'ClassList[0]/ClassLevel=@ask(@height@)@' -v foo.git
gffencode(1), gffmatch(1), gffprint(1), Gff(3), and GffRead(3).
Tero Kivinen <kivinen@iki.fi>.
This program evolved from gffmatch(1)
and has been enchanced after
that to support variables and parameters etc.