Hero Context

From HLKitWiki
Jump to: navigation, search

Context: HL KitKit Reference  … Multiple Sources

Jump to: Target References

The "hero" context represents an individual actor within the portfolio. This actor could be a lead or a minion.

Context Transitions

A "hero" context is very similar to a "container" context, except that the options available are a bit more limited (e.g. heroes don't have parents). From within a "hero" context, you can utilize the following set of valid context transitions:

state Transitions to the state context.

Example: this.state

child[id] Transitions to the pick context corresponding to the first pick within the container that derives from the thing with the id specified. If the container has no child pick with the given unique id, a run-time error notification is reported to the user and the transition fails to resolve.

Example: this.child[mypick]

childfound[id] Transitions to the pick context corresponding to the first pick within the container that derives from the thing with the id specified. This transition is identical to "child[id]", except that the existence of the child pick is optional. If the child is found, the transition occurs normally. If the child does not exist, no run-time error is reported, although the transition still fails to resolve.

Example: this.childfound[mypick]

firstchild[expr,sort] Transitions to the pick context corresponding to the first pick within the container that satisfies the tag expression given by expr. Since multiple children may satisfy the tag expression, an optional sort set id may be specified by sort, resulting in all matching children being sorted and the first child being used after the sort is performed. The tag expression may be either a literal string or a string expression. If no matching child exists, the transition fails to resolve.

Example: this.firstchild[expr,mysort]
Example: this.firstchild[expr]

minion[id] Transitions to the hero context corresponding to the minion actor with the given id that exists beneath the actor that possesses the current container. If the container is not a master or the specified minion does not exist, the transition fails to resolve.

Example: this.minion[myminion]

herofield[id] Transitions to the field context corresponding to the field given by id that exists on the "actor" pick for the containing actor. This is a shorthand notation for "hero.child[actor].field[id]".

Example: this.herofield[myfield]

usagepool[id] Transitions to the pool context corresponding to the usage pool given by id that exists within the current actor.

Example: this.usagepool[mypool]

transact Transitions to the pick context corresponding to the transaction pick that is associated with the hero governing the current context.

Example: this.transact
NOTE! The transaction pick is only utilized within buy and sell transactions. As such, this transition is only valid within a few select scripts.

dynalink[index] Transitions to the pick context corresponding to the registered dynamic linkage with the index specified. If no dynamic linkage has been registered with the given index, the transition fails to resolve. The index may be an arithmetic expression that calculates the actual index value to be used.

Example: this.dynalink[myindex]

Target References

Heroes are a special type of container. As such, they share all of the same target references as normal containers. However, they also have quite a few additional target references that are unique to heroes. The complete list of these special target references is presented in the table below.

IMPORTANT! For the purposes of data file authoring, the "hero" context applies to all actors, whether they be leads, masters, or minions.

IMPORTANT! Actors also support all general container target references.

NOTE! When an actor is accessed from within a visual script, all operations are restricted to read-only behavior. Any attempts to modify a container from within a visual script will fail.

setactor (Right, Number) Memorizes the current actor context as the "actor focus", allowing it to be instantly accessed thereafter via the "actor." initial script context. Always returns a value of zero.

Example: perform this.setactor

miniontext (Right, String) Returns the name of the thing that attaches the current minion. This makes it possible to retrieve the nature of the minion for display to the user. If invoked on a lead, an empty string is returned.

Example: result = this.miniontext

sourcetree (Right, String) Returns a summary of the various user-selected sources that have chosen for the current actor. This is intended for inclusion within character sheet output. The summary is synthesized solely from sources that are user-selected, although the entire chain of sources down to each selected source is included so that context is provided in case similar names are used in different contexts. Any source that is designated as not reportable is omitted from the summary, allowing sources governing printout and interface behaviors to be omitted. If a source specifies an alternate "reportname", that name is used instead.

Example: result = this.sourcetree

errorcount (Right, Number) Returns the total number of validation errors that were reported within the hero over the course of evaluation. This is intended for use within character sheet output. If accessed during evaluation processing, a run-time error is reported.

Example: result = this.errorcount

errorlist (Right, String) Returns a string containing all validation errors for the hero, based on the most recent evaluation cycle. This is intended for use within character sheet output. If accessed during evaluation processing, a run-time error is reported.

Example: result = this.errorlist

combatant (Right, Left, Number) Indicates whether the actor is managed as a combatant or not within the Tactical Console, with a non-zero value indicating a combatant. If a new value is assigned, the combatant state of the actor is changed.

Example: result = this.combatant
Example: this.combatant = 0

initchange (Right, Number) Returns non-zero if the actor's current initiative value has been modified by the user.

Example: result = this.initchange

ismoveup (Right, Number) Returns non-zero if the actor can be moved upwards within the Tactical Console, thereby adjusting its initiative value.

Example: result = this.ismoveup

ismovedown (Right, Number) Returns non-zero if the actor can be moved downwards within the Tactical Console, thereby adjusting its initiative value.

Example: result = this.ismovedown

combatmove[expr] (Right, Number) Moves the actor upwards or downwards within the Tactical Console, thereby adjusting its initiative position. The number of slots to move is given by the numeric expression expr, with a positive value moving the actor later in the initiative sequence and a negative value earlier. To move an actor down in the order (i.e. later in combat), use "+1", and use "-1" to move the actor upwards. To move an actor to the top or bottom of the initiative order, simply use a very large value, as the engine will safely bound all adjustments. Always returns a value of zero.

Example: perform this.combatmove[-1]

combatact (Right, Number) Designates the actor as having acted this combat turn and triggers an update to determine the next "ready" actor(s). Always returns a value of zero.

Example: perform this.combatact

combatdefer (Right, Number) Designates the actor as having deferred its action this combat turn and triggers an update to determine the next "ready" actor(s). Always returns a value of zero.

Example: perform this.combatdefer

combatmovenow (Right, Number) Moves the actor within the initiative sequence such that it is positioned immediately before the first actor that is currently designated as "ready". This is intended for use when a deferred actor finally acts, as its initiative position is moved to the current slot in the queue. Always returns a value of zero.

Example: perform this.combatmovenow