Skip to content

Proposal: New 'NodeName' parameter type for commands/functions #103

@TheMartianLife

Description

@TheMartianLife

Additions to core/Unity code that allows functions and commands to be declared that accept a NodeName-typed parameter, either as a strict type or as a type-hinted annotation on what is otherwise a string. This would allow compile-time error-checking of many values, and for the editor to do design-time validation that what the value you have given does refer to a node which exists in the current project.

Examples of why this would be useful:

  • a command which takes a node to setup a listener for - now when a particular event happens, it knows what to run
  • a function which does some custom logic about a function - similar how people have asked for an alternative form of visited() which counts exits rather than entries, or functions which query the saliency system
  • inbuilt functions can also make use of this, such as visited()
// examples
<<set_callback_node NodeName>>

<<set $node_exits = my_visited(NodeName)>>

<<if visited(NodeName)>>

People are already doing this with strings, but more validation is good!

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreIssues concerning the compiler or engine-independent code in the YarnSpinner repoProposalAn idea for a new feature or changed behaviour you wantUnityIssues concerning the Unity engine-specific code in the YarnSpinner-Unity repo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions