99
edits
(Add delegate table) |
(Add event table) |
||
Line 128: | Line 128: | ||
== Delegates == | == Delegates == | ||
Unique to conversations are their delegate attributes such as <code>IfHaveQuest="What's Eating the Watervine?"</code> or <code>GiveItem="Joppa Recoiler"</code>.<br/> | Unique to conversations are their delegate attributes such as <code>IfHaveQuest="What's Eating the Watervine?"</code> or <code>GiveItem="Joppa Recoiler"</code>.<br/> | ||
These are distinguished between two types | These are distinguished between two types: Predicates which control whether an element is accessible, and Actions which perform some task when the element is selected.<br/> | ||
After the Deep Jungle update these are now for the most part agnostic as to what their parent element is. | After the Deep Jungle update these are now for the most part agnostic as to what their parent element is. | ||
Line 152: | Line 152: | ||
public static class DelegateContainer | public static class DelegateContainer | ||
{ | { | ||
// A predicate that receives a DelegateContext object with our values assigned, this to protect mods from signature breaks. | |||
[ConversationDelegate(Speaker = true)] | |||
public static bool IfHaveItem(DelegateContext Context) | |||
{ | |||
// Context.Value holds the quoted value from the XML attribute. | |||
// Context.Target holds the game object. | |||
// Context.Element holds the parent element. | |||
return Context.Target.HasObjectInInventory(Context.Value); | |||
} | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 214: | Line 214: | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<conversation ID="EventfulSnapjaw"> | <conversation ID="EventfulSnapjaw"> | ||
<part Name="SpiceContext" Register="All" /> <!-- Registers for | <part Name="SpiceContext" Register="All" /> <!-- Registers for Speaker events by default, but overrides with both --> | ||
<start ID="TasterOfTheSalt"> | <start ID="TasterOfTheSalt"> | ||
<part Name="SnapjawLaugh" /> <!-- Registers for Speaker events --> | <part Name="SnapjawLaugh" /> <!-- Registers for Speaker events --> | ||
Line 229: | Line 229: | ||
==Tables== | ==Tables== | ||
Below are non-exhaustive tables of existing parts, events and delegates. | Below are non-exhaustive tables of existing parts, events and delegates. | ||
===Events=== | |||
Source notes the deepest element that you can expect the event to propagate from. In order, the values are Conversation -> Node -> Choice -> Text.<br/> | |||
Order notation is very approximate, as the same event will be fired multiple times on different elements during a navigation. | |||
{| class="wikitable" | |||
|- | |||
! Name | |||
! Source | |||
! Description | |||
! Order | |||
|- | |||
| IsElementVisibleEvent | |||
| Text | |||
| Fired when determining whether an element is possibly available for rendering and selection, after any predicates defined on the element. | |||
| Before: GetTextElementEvent, After: EnteredElementEvent | |||
|- | |||
| GetTextElementEvent | |||
| Text | |||
| Fired when choosing a text element for preparation and can control the chosen text. | |||
| Before: PrepareTextEvent, After: IsElementVisibleEvent | |||
|- | |||
| PrepareTextEvent | |||
| Text | |||
| Fired when preparing spoken text for display after a node has been entered.<br/> | |||
This precedes the standard variable replacements like =subject.name= and allows setting a new Subject and Object. | |||
| Before: DisplayTextEvent, After: GetTextElementEvent | |||
|- | |||
| DisplayTextEvent | |||
| Choice | |||
| Fired before displaying the prepared text to screen.<br/> | |||
This is where you will typically add unspoken text like tooltips or other metagame information. | |||
| Before: ColorTextEvent, After: PrepareTextEvent | |||
|- | |||
| ColorTextEvent | |||
| Choice | |||
| Fired when coloring the display text of an element. | |||
| With: DisplayTextEvent | |||
|- | |||
| GetChoiceTagEvent | |||
| Choice | |||
| Fired when selecting an ending tag to apply to the display text such as [begin trade]. | |||
| With: DisplayTextEvent | |||
|- | |||
| EnteredElementEvent | |||
| Choice | |||
| Fired after an element has successfully been entered. | |||
| Before: PrepareTextEvent, After: EnterElementEvent | |||
|- | |||
| EnterElementEvent | |||
| Choice | |||
| Fired as an element is being entered and can prevent navigation. | |||
| Before: EnteredElementEvent, After: LeaveElementEvent | |||
|- | |||
| GetTargetElementEvent | |||
| Choice | |||
| Fired after leaving the current node and can control the navigation target. | |||
| Before: EnterElementEvent, After: LeaveElementEvent | |||
|- | |||
| LeaveElementEvent | |||
| Node | |||
| Fired as an element is being left and can prevent navigation. | |||
| Before: GetTargetElementEvent, After: GetDisplayTextEvent | |||
|- | |||
| LeftElementEvent | |||
| Node | |||
| Fired after an element has successfully been exited. | |||
| Before: EnteredElementEvent, After: GetTargetElementEvent | |||
|- | |||
| HideElementEvent | |||
| Choice | |||
| Fired when evaluating elements to display that are hidden by special outside conditions.<br/> | |||
One such condition is the last choice selected that will be hidden if navigation was successful but did not leave the current node. | |||
| Before: PrepareTextEvent, After: IsElementVisibleEvent | |||
|- | |||
| PredicateEvent | |||
| Text | |||
| Fired by the <code>IfCommand</code> predicate and controls visibility similarly to IsElementVisibleEvent. | |||
| Before: IsElementVisibleEvent, After: EnteredElementEvent | |||
|} | |||
===Delegates=== | ===Delegates=== | ||
An Inverse predicate can be invoked with <code>IfNot</code> to negate its value.<br /> | An Inverse predicate can be invoked with <code>IfNot</code> to negate its value.<br /> | ||
Line 333: | Line 412: | ||
| IfSubtype | | IfSubtype | ||
| Predicate | | Predicate | ||
| Continues if the target is of the specified | | Continues if the target is of the specified subtype. | ||
| Yes | | Yes | ||
| Yes | | Yes |