StandardLibrary
Provides definitions and implementations for all the built in functions and operators
public sealed class StandardLibraryInherits from System.Object
#Nested Types
- Contains the names of standard library functions whose implementations are expected to be provided by the game engine.
#Methods
#AllFunctions()
Creates all function definitions of the built in functions
public static Dictionary<string, FunctionType> AllFunctions()Returns Dictionary: A dictionary of every function and it's definition keyed by name
Exceptions
System.ArgumentExceptionIf an expected function doesn't exist
#CallFunc(string, Value[], CancellationToken)
Invoke the function
public static ValueTask<Yarn.Value> CallFunc(string functionName, Value[] parameters, CancellationToken token)Parameters
functionNamestringThe name of the functionparametersYarn.Value[]the list of parameters the function needstokenSystem.Threading.CancellationTokenCancellation token to use
Returns ValueTask: The Yarn Value that is the result of the function
Exceptions
System.ArgumentExceptionIf the function doesn't exist in the standard library
#GenerateUniqueCommandBlockViewedVariableName(string, string, int)
Gets the name of the boolean variable that stores whether or not the content inside a once block has been seen by the player before.
public static string GenerateUniqueCommandBlockViewedVariableName(string sourceFileName, string node, int lineNumber)Parameters
sourceFileNamestringThe absolute path to the yarn file that contains the once block.nodestringthe node that contains the once block.lineNumberintThe line number in the editor that opens the once block.
Returns String: A variable name.
This is an inherently unstable identifer as it relies of layout attributes of the yarn code.
Later versions of Yarn Spinner will likely change how this works to be more stable.
Moreso than GenerateUniqueContentViewedVariableName this is only really useful during development.
Sorry.
#GenerateUniqueContentViewedVariableName(string)
Gets the name of the boolean variable that stores whether the
content identified by lineID has been seen by the player before.
public static string GenerateUniqueContentViewedVariableName(string lineID)Parameters
lineIDstringThe line ID to generate a variable name for.
Returns String: A variable name.
The value provided should be the full line ID without the #.
So if you have a line
Alice: this is my once line <<once>> #line:abc123 the input should be "line:abc123".#GenerateUniqueVisitedVariableForNode(string)
Generates a unique tracking variable name.
This is intended to be used to generate names for visting.
Ideally these will very reproduceable and sensible.
For now it will be something terrible and easy.
public static string GenerateUniqueVisitedVariableForNode(string nodeName)Parameters
nodeNamestringThe name of the node that needs to have a tracking variable created.
Returns String: The new variable name.
#TryGetFunction(string, FunctionType)
Finds the definition (so the parameters and return) for the requested function
public static bool TryGetFunction(string functionName, out FunctionType function)Parameters
functionNamestringthe name of the functionfunctionYarn.FunctionTypeThe function definition
Returns Boolean: true if the function has a definition
Generated from Yarn Spinner for Unity 3.3.