All pages
Powered by GitBook
1 of 37

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Descendants

Property in BasicBlock

Summary

Gets all descendants (that is, destinations, and destinations of those destinations, and so on), recursively.

public IEnumerable<BasicBlock> Descendants
{
            get; }

Remarks

Cycles are detected and avoided.

AddDestination(string,Condition)

Method in

Summary

Adds a new destination to this block, that points to a node.

Ancestors

Property in

Summary

Get the ancestors of this block - that is, blocks that may run immediately before this block.

public IEnumerable<BasicBlock> Ancestors { get };
BasicBlock
Parameters
Name
Description

string nodeName

The name of the destination node.

condition

The condition under which descendant will be run.

public void AddDestination(string nodeName, Condition condition)
BasicBlock

AddDestination(BasicBlock,Condition)

Method in BasicBlock

Summary

Adds a new destination to this block, that points to another block.

public void AddDestination(BasicBlock descendant, Condition condition)

Parameters

Name
Description

BasicBlock

Class in Yarn.Compiler

Inherits from System.Object

Summary

A basic block is a run of instructions inside a Node. Basic blocks group instructions up into segments such that execution only ever begins at the start of a block (that is, a program never jumps into the middle of a block), and execution only ever leaves at the end of a block.

Classes

Name
Description

Enums

Name
Description

Methods

Name
Description

Properties

Name
Description

Structs

Name
Description
public class BasicBlock

Yarn.Compiler.BasicBlock descendant

The new descendant node.

Yarn.Compiler.BasicBlock.Condition condition

The condition under which descendant will be run.

Yarn.Compiler.BasicBlock.Condition

FirstInstructionIndex

Property in BasicBlock

Summary

Gets the index of the first instruction of the node that this block is in.

public int FirstInstructionIndex { get; set; }

Gets the Instructions that form this block.

Gets the name of the label that this block begins at, or null if this basic block does not begin at a labelled instruction.

Gets a descriptive name for the block.

Gets the name of the node that this block is in.

Gets the collection of player-visible content that will be delivered when this block is run.

CommandElement

A command that will be executed.

LineElement

A line of dialogue that should be shown to the player.

OptionsElement

A collection of options that should be shown to the player.

PlayerVisibleContentElement

An abstract class that represents some content that is shown to the player.

Condition

The conditions under which a Destination may be reached at the end of a BasicBlock.

AddDestination(string,Condition)

Adds a new destination to this block, that points to a node.

AddDestination(BasicBlock,Condition)

Adds a new destination to this block, that points to another block.

Ancestors

Get the ancestors of this block - that is, blocks that may run immediately before this block.

Descendants

Gets all descendants (that is, destinations, and destinations of those destinations, and so on), recursively.

DescendantsWithPlayerVisibleContent

Gets all descendants (that is, destinations, and destinations of those destinations, and so on) that have any player-visible content, recursively.

Destinations

Gets the destinations of this block - that is, blocks or nodes that may run immediately after this block.

FirstInstructionIndex

Gets the index of the first instruction of the node that this block is in.

Destination

A destination represents a BasicBlock or node that may be run, following the execution of a BasicBlock .

Block

Enumeration Member in

Summary

DirectJump

Enumeration Member in

Summary

The Destination is reached beacuse of an explicit instruction to go to this block.

Block

Property in

Summary

The block that this destination refers to.

Name

Property in

Summary

Gets a descriptive name for the block.

LabelName

Property in

Summary

Gets the name of the label that this block begins at, or null if this basic block does not begin at a labelled instruction.

NodeName

Property in

Summary

The name of the node that this destination refers to.

ExpressionIsFalse

Enumeration Member in

Summary

The Destination is reached because an expression evaluated to false.

ExpressionIsTrue

Enumeration Member in

Summary

The Destination is reached because an expression evaluated to true.

LineID

Field in

Summary

The string table ID of the line that will be shown to the player.

Fallthrough

Enumeration Member in

Summary

The Destination is reached because the preceding BasicBlock reached the end of its execution, and the Destination's target is the block immediately following.

Condition

Property in

Summary

The condition that causes this destination to be reached.

Instructions

Property in

Summary

Gets the Instructions that form this block.

Instructions
LabelName
Name
NodeName
PlayerVisibleContent
Block
DestinationType
DirectJump
Condition
Remarks

This value is only valid when Type is Block .

public BasicBlock Block { get; set; }
Destination
Remarks

If this block begins at a labelled instruction, the name will be [NodeName].[LabelName] . Otherwise, it will be [NodeName].[FirstInstructionIndex] .

public string Name
{
            get; }
BasicBlock
public string LabelName { get; set; }
BasicBlock
Remarks

This value is only valid when Type is Node .

public string NodeName { get; set; }
Destination
ExpressionIsFalse
Condition
ExpressionIsTrue
Condition
public string LineID;
LineElement
Fallthrough
Condition
public Condition Condition { get; set; }
Destination
public IEnumerable<Instruction> Instructions { get; set; };
BasicBlock

Node

Enumeration Member in DestinationType

Summary

Node

CommandText

Field in CommandElement

Summary

The text of the command.

public string CommandText;

Options

Field in OptionsElement

Summary

The collection of options that will be delivered to the player.

public IEnumerable<Option> Options;

DescendantsWithPlayerVisibleContent

Property in BasicBlock

Summary

Gets all descendants (that is, destinations, and destinations of those destinations, and so on) that have any player-visible content, recursively.

public IEnumerable<BasicBlock> DescendantsWithPlayerVisibleContent
{
            get; }

Remarks

Cycles are detected and avoided.

LineID

Field in Option

Summary

The string table ID that will be shown to the player.

public string LineID;

NodeName

Property in BasicBlock

Summary

Gets the name of the node that this block is in.

public string NodeName { get; set; }

LineElement

Class in BasicBlock

Inherits from PlayerVisibleContentElement

Summary

A line of dialogue that should be shown to the player.

public class LineElement : PlayerVisibleContentElement

Fields

Name
Description

PlayerVisibleContent

Property in BasicBlock

Summary

Gets the collection of player-visible content that will be delivered when this block is run.

public IEnumerable<PlayerVisibleContentElement> PlayerVisibleContent
{
            get; }

Remarks

Player-visible content means lines, options and commands. When this block is run, the entire contents of this collection will be displayed to the player, in the same order as they appear in this collection.

If this collection is empty, then the block contains no visible content. This is the case for blocks that only contain logic, and do not contain any lines, options or commands.

To tell the difference between the different kinds of content, use the is operator to check the type of each item:

CommandElement

Class in BasicBlock

Inherits from PlayerVisibleContentElement

Summary

A command that will be executed.

public class CommandElement : PlayerVisibleContentElement

Fields

Name
Description

Option

Struct in OptionsElement

Inherits from System.ValueType

Summary

Represents a single option that may be presented to the player.

public struct Option

Fields

Name
Description

Condition

Enum in

Inherits from System.Enum

Summary

The conditions under which a may be reached at the end of a BasicBlock.

Destination

Struct in

Inherits from System.ValueType

Summary

A destination represents a or node that may be run, following the execution of a .

OptionsElement

Class in

Inherits from

Summary

A collection of options that should be shown to the player.

PlayerVisibleContentElement

Class in

Inherits from System.Object

Summary

An abstract class that represents some content that is shown to the player.

Destination

Field in

Summary

The destination that will be run if this option is selected by the player.

Type

Property in

Summary

Gets the Destination's type - whether the destination is a block, or a node.

LineID

The string table ID of the line that will be shown to the player.

CommandText

The text of the command.

Destination

The destination that will be run if this option is selected by the player.

LineID

The string table ID that will be shown to the player.

foreach (var item in block.PlayerVisibleContent) { if (item is
LineElement line) { // Do something with line } }
Remarks

This class is used, rather than the runtime classes Yarn.Line or Yarn.OptionSet, because when the program is being analysed, no values for any substitutions are available. Instead, these classes represent the data that is available offline.

public abstract class PlayerVisibleContentElement
BasicBlock
Remarks

This will be the name of a label, or the name of a node.

public string Destination;
Option
public DestinationType Type { get; set; }
Destination
Members
Name
Description

The Destination is reached beacuse of an explicit instruction to go to this block.

The Destination is reached because an expression evaluated to false.

The Destination is reached because an expression evaluated to true.

The Destination is reached because the preceding BasicBlock reached the end of its execution, and the Destination's target is the block immediately following.

The Destination is reached because the player made an in-game choice to go to it.

BasicBlock
Destination
Remarks

Destination objects represent links between blocks, or between blocks and nodes.

Enums

Name
Description

The type of a Destination.

Properties

Name
Description

The block that this destination refers to.

The condition that causes this destination to be reached.

The name of the node that this destination refers to.

Gets the Destination's type - whether the destination is a block, or a node.

BasicBlock
BasicBlock
BasicBlock
Fields
Name
Description

The collection of options that will be delivered to the player.

Structs

Name
Description

Represents a single option that may be presented to the player.

public class OptionsElement : PlayerVisibleContentElement
BasicBlock
PlayerVisibleContentElement

DestinationType

Enum in Destination

Inherits from System.Enum

Summary

The type of a Destination.

public enum DestinationType
{
    Node,
    Block
}

Members

Name
Description
public enum Condition
{
    Fallthrough,
    DirectJump,
    ExpressionIsTrue,
    ExpressionIsFalse,
    Option
}
public struct Destination

Block

Node

DirectJump
ExpressionIsFalse
ExpressionIsTrue
Fallthrough
Option
DestinationType
Block
Condition
NodeName
Type
Options
Option

Option

Enumeration Member in

Summary

The Destination is reached because the player made an in-game choice to go to it.

Option
Condition

Destinations

Property in BasicBlock

Summary

Gets the destinations of this block - that is, blocks or nodes that may run immediately after this block.

public IEnumerable<Destination> Destinations { get };

See Also

  • : A destination represents a or node that may be run, following the execution of a .

Destination
BasicBlock
BasicBlock