<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://159.203.101.162/w/index.php?action=history&amp;feed=atom&amp;title=Conversion</id>
	<title>Conversion - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://159.203.101.162/w/index.php?action=history&amp;feed=atom&amp;title=Conversion"/>
	<link rel="alternate" type="text/html" href="http://159.203.101.162/w/index.php?title=Conversion&amp;action=history"/>
	<updated>2026-05-13T16:39:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://159.203.101.162/w/index.php?title=Conversion&amp;diff=4359&amp;oldid=prev</id>
		<title>LegacyKing: Created page with &quot;${pc.val.x}  (again, where the &quot;x&quot; is the new variable now holding new FACE).   2 new tokens for the Data Control file: * FUNCTION:x * VALUE:x   '''FUNCTION:x''' * Must appear...&quot;</title>
		<link rel="alternate" type="text/html" href="http://159.203.101.162/w/index.php?title=Conversion&amp;diff=4359&amp;oldid=prev"/>
		<updated>2023-06-22T22:20:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;${pc.val.x}  (again, where the &amp;quot;x&amp;quot; is the new variable now holding new FACE).   2 new tokens for the Data Control file: * FUNCTION:x * VALUE:x   &amp;#039;&amp;#039;&amp;#039;FUNCTION:x&amp;#039;&amp;#039;&amp;#039; * Must appear...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;${pc.val.x}&lt;br /&gt;
&lt;br /&gt;
(again, where the &amp;quot;x&amp;quot; is the new variable now holding new FACE).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2 new tokens for the Data Control file:&lt;br /&gt;
* FUNCTION:x&lt;br /&gt;
* VALUE:x&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''FUNCTION:x'''&lt;br /&gt;
* Must appear as the first item on the line in a data control file&lt;br /&gt;
* Takes one argument, a function name&lt;br /&gt;
* Must be a &amp;quot;legal&amp;quot; function name, meaning:&lt;br /&gt;
* - starts with a letter, e.g. A-Z, additional legal characters are 0-9&lt;br /&gt;
* and _ (none of those as the first character)&lt;br /&gt;
* - No spaces, no other special characters.&lt;br /&gt;
* - Are case insensitive (as many other things in LST files)&lt;br /&gt;
This defines the function name as it will be used in a formula in the&lt;br /&gt;
LST data files.&lt;br /&gt;
&lt;br /&gt;
If a FUNCTION appears more than once, the other characteristics (currently VALUE) must be identical.&lt;br /&gt;
===&lt;br /&gt;
'''VALUE:x'''&lt;br /&gt;
Must appear as an additional token on the line of a FUNCTION: in the data control file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The provided value must be a value formula.  This means it must have valid variable names, valid function names, matching parenthesis, etc. etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In addition to all of the build-in functions (e.g. if, ceil, round), two additional items can be used:&lt;br /&gt;
&lt;br /&gt;
   (1) the arg(n) function.  The arg function is a &amp;quot;local&amp;quot; function to the VALUE: part of a FUNCTION (it can not generally be used in LST files).&lt;br /&gt;
&lt;br /&gt;
The arg function takes one argument.  It MUST be a Integer &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  (2) Any previously defined FUNCTION. This MUST appear in the file before the current Function or in a file processed before the current file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Meaning:&lt;br /&gt;
* FUNCTION:d20mod &amp;lt;&amp;gt; VALUE:floor((arg(0)-10)/2)&lt;br /&gt;
* FUNCTION:embed &amp;lt;&amp;gt; VALUE:d20mod(arg(0)*4&lt;br /&gt;
is legal, while:&lt;br /&gt;
* FUNCTION:embed &amp;lt;&amp;gt; VALUE:d20mod(arg(0)*4&lt;br /&gt;
* FUNCTION:d20mod &amp;lt;&amp;gt; VALUE:floor((arg(0)-10)/2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...is not legal (since d20mod does not yet exist when embed is encountered)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a function is used in LST data, it is called by the name provided&lt;br /&gt;
in the FUNCTION token.  It requires a certain number of arguments.  This&lt;br /&gt;
exactly matches the integer one greater than the highest number of the&lt;br /&gt;
arg(n) function provided in the VALUE part of a FUNCTION&lt;br /&gt;
     (In computer science terms, the arg(n) function is zero-indexed)&lt;br /&gt;
&lt;br /&gt;
The provided arguments can be any legal formula, so:&lt;br /&gt;
* d20Mod(INT)&lt;br /&gt;
* d20Mod(INT+4)&lt;br /&gt;
are both perfectly legal.&lt;br /&gt;
&lt;br /&gt;
===&lt;br /&gt;
For example:&lt;br /&gt;
* FUNCTION:d20Mod &amp;lt;&amp;gt; VALUE:floor((arg(0)-10)/2)&lt;br /&gt;
* Note the arg(n) function here uses ZERO, not ONE.&lt;br /&gt;
This would then be used in LST data as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
d20Mod(n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It will catch both d20Mod() and d20Mod(14,5) as errors (too few or too many args).  It would also catch: d20Mod(&amp;quot;mystring&amp;quot;) as an error (wrong format - requires a Number, found a String).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The n is substituted where &amp;quot;arg(0)&amp;quot; appears in the &amp;quot;VALUE&amp;quot;... so a&lt;br /&gt;
statmod would be as easy as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
d20Mod(INT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or some such...&lt;br /&gt;
&lt;br /&gt;
Direct values can also be used, e.g. d20Mod(10) would return 0.&lt;br /&gt;
&lt;br /&gt;
===&lt;br /&gt;
Some other notes:&lt;br /&gt;
* Note that the function actually has to be *used* (not just defined) for&lt;br /&gt;
* the errors to be caught (since it can't guess at overall context)&lt;br /&gt;
* An embedding example can be found here:&lt;br /&gt;
* https://groups.yahoo.com/neo/groups/pcgen_experimental/conversations/messages/19549&lt;/div&gt;</summary>
		<author><name>LegacyKing</name></author>
		
	</entry>
</feed>