Dynamic Scope

From PCGen Wiki
Jump to: navigation, search

Deprecated

This page is Deprecated, please see Setting up the new Formula System

Original Content

What we really need is the ability to define a "scope" on the fly, without really having code involvement, which creates a basically hollow, simple object. So the scope is "VISION", and we can then instantiate "Low-Light Vision" and give it a variable "Range":

  • Data Control File:

DYNAMICSCOPE:VISION


  • Variable File:

LOCAL:VISION|NUMBER=Range or LOCAL:VISION|Range


  • Dynamic (a new file type) File:

VISION:Low-Light Vision

This can then be modified as:

  • MODIFYOTHER:VISION|Low-Light Vision|Range|SET|60

Since a Vision is then an object that is in our "object library" (ReferenceContext to the code folks), we can pull the entire list from there (that code has long been written). We can then expose the dynamic types in its own subvariable, and we then have a pretty easy way to increment across all vision objects in Freemarker:


 <#list pc.dynamic.vision as vision>
  ${vision.name} ${vision.val.range}
 </#list>


 <#list pc.dynamic.movement as movement>
   ${movement.name} ${movement.val.speed}
 </#list>


(this ignores converting the range to local units and all that, but you get the idea)


So the proposal is this: 1) DYNAMICSCOPE:x

  • ... becomes a new data control token.
  • Like other LST tokens, this is case insensitive, but usage in later tokens is always capitalized, so I suspect the data standard should be all CAPS.
  • Any argument to that then becomes a legal "scope" in LOCAL: in the variable definition file, see below.
  • One per line, DYNAMICSCOPE only takes one argument (x is the new scope)

2) DYNAMIC: becomes a new token legal in PCC files. It's format is:

  • DYNAMIC:x
  • x is the file just as in tokens like DEITY or DOMAIN
  • INCLUDE/EXCLUDE on the line are are legal.
  • The prefix (scope) MUST appear on the line, e.g.:
  • VISION:Darkvision
  • VISION:Low-Light Vision

3) A Dynamic can not contain any information (no additional tokens). It is NOT a full CDOMObject. It simply is a named object that contains variables.

  • Note: If you need a "default" range for vision, you can always set it in the global variable file. Note this is actually rather convenient if it's really a base rule, as you can do something like:
  • MODIFYOTHER:VISION|ALL|Range|Set|60
  • ...and not have to worry about a MODIFY on each separate VISION object.

4)For Variable Definition and usage in MODIFYOTHER, the appropriate argument "x" matches the DYNAMICSCOPE (e.g. VISION would sensibly be "x" below)

  • LOCAL:x|NUMBER|Range
  • MODIFYOTHER:x|Low-Light Vision|Range|SET|60

5) We introduce a new token usable in LST files:

  • GRANT:x|y
  • x is a DYNAMICSCOPE
  • y is the name of the dynamic object.

6) A Dynamic object MUST be granted in order to have its local variables modified or to have its modifiers have an impact (just like any other object)