Noxico scene system

From The Pile
Jump to: navigation, search

The Noxico scene system is used for both dialogue and sex. It is inspired by the dialogue system from Skyrim, and stored in two XML resources -- one for dialogue, one for sex.

The basic structure of an NSS resource is as follows:

<!DOCTYPE scenes [
<!ELEMENT scenes (scene+)>
<!ELEMENT scene (filter*,(p|script)*,action*)>
<!ELEMENT filter EMPTY>
<!ELEMENT script (#PCDATA)>
<!ELEMENT action EMPTY>
<!ATTLIST scene
id CDATA #REQUIRED
name CDATA #REQUIRED
list CDATA #IMPLIED
priority CDATA #IMPLIED
>
<!ATTLIST filter
target (top|bottom) #REQUIRED
type CDATA #REQUIRED
name CDATA #IMPLIED
value CDATA #IMPLIED
>
<!ATTLIST script type CDATA #FIXED "text/javascript">
<!ATTLIST action name CDATA #REQUIRED>
 
<!ELEMENT p (#PCDATA|if|else)*>
<!ELEMENT if (#PCDATA|if|else)*>
<!ELEMENT else (#PCDATA|if|else)*>
<!-- Same as FILTER above. -->
<!ATTLIST if
target (top|bottom) #REQUIRED
type CDATA #REQUIRED
name CDATA #IMPLIED
value CDATA #IMPLIED
>
]>

That is, the resource is a collection of scene elements, each with optional filter and action elements, and any combination of p and script elements.

Each action refers to another scene by name. A scene element's id is purely for the author's benefit, and list determines how to show the option in the list. When looking for a scene with a specific name, all matching scene elements are checked for matching filter elements. The first scene that filters out entirely is chosen. As a result, the most generic scenes should go on the bottom of the resource.

The p and script elements for a scene about to be displayed are parsed in order of appearance.

Simple example

How the example links up.
<scene id="ExampleA" name="(starting node)">
<!-- Suppose there are filters here to determine friendliness. -->
<p>
Well met, traveller. Can I help you?
</p>
<action name="tell about self" />
<action name="cancel goodbye" />
</scene>
<scene id="ExampleB" name="tell about self" list="Tell me about yourself.">
<filter target="bottom" type="has" name="occupation/woodcutter" />
<p>
I am [b:fullname], the local woodcutter. I've lived here for years now.
</p>
<action name="introduce self and tell more" />
<action name="foot in mouth" />
</scene>
<scene id="ExampleC" name="cancel goodbye" list="No thanks. Sorry to interrupt.">
<p>
Goodbye then, I guess. May we meet again soon.
</p>
</scene>
TODO: explain things like grammar tokens and filters.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox