Value Context: Difference between revisions
No edit summary |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 31: | Line 31: | ||
|(Right, Number) Returns non-zero if the field contains the empty string and zero if it contains text of any length. If used on a numeric field or with an array or matrix, an error is reported. Testing of array and matrix elements must be done via the "compare" intrinsic.<br> | |(Right, Number) Returns non-zero if the field contains the empty string and zero if it contains text of any length. If used on a numeric field or with an array or matrix, an error is reported. Testing of array and matrix elements must be done via the "compare" intrinsic.<br> | ||
Example: result = this.field[myfield].isempty | Example: result = this.field[myfield].isempty | ||
|- | |||
|ischanged | |||
|(Right, Number) Returns non-zero if the field contents have been changed in any way from its original starting state. This can detect a field that has been changed by the user or via a script.<br> | |||
Example: result = this.field[myfield].ischanged | |||
|- | |- | ||
|ischosen | |ischosen | ||
Line 38: | Line 42: | ||
|delta | |delta | ||
|(Right, Number) Returns the delta component of a user field. The field must be explicitly configured to support delta processing.<br> | |(Right, Number) Returns the delta component of a user field. The field must be explicitly configured to support delta processing.<br> | ||
Example: result = this.field[myfield].delta | Example: result = this.field[myfield].delta | ||
|- | |- | ||
|arrayvalue[''row''] | |arrayvalue[''row''] | ||
|(Right, Number) Returns the contents of a specific element of the array-based field as a numeric value. The index of the element is given by ''row'', where the index is a zero-based value that must be less than the number of rows in the array. If the field is text, the contents are automatically converted to a suitable value.<br> | |(Right, Number) Returns the contents of a specific element of the array-based field as a numeric value. The index of the element is given by ''row'', where the index is a zero-based value that must be less than the number of rows in the array. If the field is text, the contents are automatically converted to a suitable value.<br> | ||
Example: result = this.field[myfield].arrayvalue[3] | Example: result = this.field[myfield].arrayvalue[3] | ||
|- | |- | ||
|arraytext[''row''] | |arraytext[''row''] | ||
|(Right, Number) Returns the contents of a specific element of the array-based field as a string. The index of the element is given by ''row'', where the index is a zero-based value that must be less than the number of rows in the array. If the field is numeric, the contents are automatically converted to a suitable string.<br> | |(Right, Number) Returns the contents of a specific element of the array-based field as a string. The index of the element is given by ''row'', where the index is a zero-based value that must be less than the number of rows in the array. If the field is numeric, the contents are automatically converted to a suitable string.<br> | ||
Example: result = this.field[myfield].arraytext[3] | Example: result = this.field[myfield].arraytext[3] | ||
|- | |- | ||
|matrixvalue[''row'',''col''] | |matrixvalue[''row'',''col''] | ||
|(Right, Number) Returns the contents of a specific element of the matrix-based field as a numeric value. The index of the element is given by ''row'' and ''col'', where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is text, the contents are automatically converted to a suitable value.<br> | |(Right, Number) Returns the contents of a specific element of the matrix-based field as a numeric value. The index of the element is given by ''row'' and ''col'', where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is text, the contents are automatically converted to a suitable value.<br> | ||
Example: result = this.field[myfield].matrixvalue[3,4] | Example: result = this.field[myfield].matrixvalue[3,4] | ||
|- | |- | ||
|matrixtext[''row'',''col''] | |matrixtext[''row'',''col''] | ||
|(Right, String) Returns the contents of a specific element of the matrix-based field as a string. The index of the element is given by ''row'' and ''col'', where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is numeric, the contents are automatically converted to a suitable string.<br> | |(Right, String) Returns the contents of a specific element of the matrix-based field as a string. The index of the element is given by ''row'' and ''col'', where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is numeric, the contents are automatically converted to a suitable string.<br> | ||
Example: result = this.field[myfield].matrixvalue[3,4]<br> | Example: result = this.field[myfield].matrixvalue[3,4] | ||
|- | |||
|datetime[''fmt'',''sep''] | |||
|(Right, String) Returns the contents of the field formatted for output as a date or time, where ''sep'' is the separator string to use between values. The ''fmt'' parameter dictates the formatting to be used and must be one of the following values: | |||
<ul class="sets"> | |||
<li>realdate – Formatted as if it's a real-world date.</li> | |||
<li>realtime – Formatted as if it's a real-world time.</li> | |||
<li>gamedate – Formatted as if it's a game-world date.</li> | |||
<li>gametime – Formatted as if it's a game-world time.</li> | |||
</ul> | |||
Example: result = this.field[myfield].datetime[gamedate,"/"]<br> | |||
{{note}}This target reference is only supported on fields within picks - not things. | |||
|- | |- | ||
|history[''spl''] | |history[''spl''] | ||
Line 62: | Line 77: | ||
<li>stack – The notes text for each entry is reported and the adjustment details are included in parentheses with the notes (e.g. "notes (+2)")</li> | <li>stack – The notes text for each entry is reported and the adjustment details are included in parentheses with the notes (e.g. "notes (+2)")</li> | ||
</ul> | </ul> | ||
{{note}}This target reference is only supported on fields within picks - not things. | |||
|- | |- | ||
|} | |} |
Latest revision as of 02:45, 20 February 2009
Context: HL Kit … Kit Reference … Multiple Sources
Jump to: Target References
The "value" context represents any field within the pick or thing associated with a template. The value context is used for display only, so all aspects of the field are always read-only.
Context Transitions
The "value" context parallels a "field" context, with the key distinction being that all values are read-only, since they are intended for display only. From within a "value" context, you can utilize the following set of valid context transitions:
-None- There are no transitions from within a value context.
Target References
The "value" script context is actually the same as a "field" context, except that the field is being accessed from within a visual script and is therefore read-only in all behaviors. Hence the need to keep the script contexts distinct. The complete list of target references for the "value" context is presented in the table below.
value (Right, Number) Returns the contents of the field as a numeric value. If the field is text, the contents are automatically converted to a suitable value.
Example: result = this.field[myfield].value
text (Right, String) Returns the contents of the field as a string. If the field is numeric, the contents are automatically converted to a suitable string.
Example: result = this.field[myfield].text
isempty (Right, Number) Returns non-zero if the field contains the empty string and zero if it contains text of any length. If used on a numeric field or with an array or matrix, an error is reported. Testing of array and matrix elements must be done via the "compare" intrinsic.
Example: result = this.field[myfield].isempty
ischanged (Right, Number) Returns non-zero if the field contents have been changed in any way from its original starting state. This can detect a field that has been changed by the user or via a script.
Example: result = this.field[myfield].ischanged
ischosen (Right, Number) Returns non-zero if the field contains a pick or a thing that was selected via a menu. If the field is associated with a menu and no selection has yet been made, zero is returned.
Example: result = this.field[myfield].ischosen
delta (Right, Number) Returns the delta component of a user field. The field must be explicitly configured to support delta processing.
Example: result = this.field[myfield].delta
arrayvalue[row] (Right, Number) Returns the contents of a specific element of the array-based field as a numeric value. The index of the element is given by row, where the index is a zero-based value that must be less than the number of rows in the array. If the field is text, the contents are automatically converted to a suitable value.
Example: result = this.field[myfield].arrayvalue[3]
arraytext[row] (Right, Number) Returns the contents of a specific element of the array-based field as a string. The index of the element is given by row, where the index is a zero-based value that must be less than the number of rows in the array. If the field is numeric, the contents are automatically converted to a suitable string.
Example: result = this.field[myfield].arraytext[3]
matrixvalue[row,col] (Right, Number) Returns the contents of a specific element of the matrix-based field as a numeric value. The index of the element is given by row and col, where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is text, the contents are automatically converted to a suitable value.
Example: result = this.field[myfield].matrixvalue[3,4]
matrixtext[row,col] (Right, String) Returns the contents of a specific element of the matrix-based field as a string. The index of the element is given by row and col, where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is numeric, the contents are automatically converted to a suitable string.
Example: result = this.field[myfield].matrixvalue[3,4]
datetime[fmt,sep] (Right, String) Returns the contents of the field formatted for output as a date or time, where sep is the separator string to use between values. The fmt parameter dictates the formatting to be used and must be one of the following values: - realdate – Formatted as if it's a real-world date.
- realtime – Formatted as if it's a real-world time.
- gamedate – Formatted as if it's a game-world date.
- gametime – Formatted as if it's a game-world time.
Example: result = this.field[myfield].datetime[gamedate,"/"]
NOTE! This target reference is only supported on fields within picks - not things.history[spl] (Right, String) Generates and returns a text string that contains the change history for the field. The spl parameter is a string that is inserted between entries in the change history, splicing them together for appropriate output. The history report contents depend on the history behavior assigned to the field, as given below: - best – Only the notes text for each history entry is reported
- stack – The notes text for each entry is reported and the adjustment details are included in parentheses with the notes (e.g. "notes (+2)")
NOTE! This target reference is only supported on fields within picks - not things.