A script implemented in the Visual Script programming environment.
    public class VisualScript : Script

A script implemented in the Visual Script programming environment. The script extends the functionality of all objects that instance it.

Object.SetScript(Godot.Reference) extends an existing object, if that object’s class matches one of the script’s base classes.

You are most likely to use this class via the Visual Script editor or when writing plugins for it.

Inheritance Chain

Constructors

    public VisualScript()

Signals

    "node_ports_changed" (String function, int id)

Emitted when the ports of a node are changed.

Properties

    public Dictionary Data { get; set; }

Methods

    public void AddCustomSignal(string name)

Add a custom signal with the specified name to the VisualScript.

    public void AddFunction(string name)

Add a function with the specified name to the VisualScript.

    public void AddNode(string func, int id, VisualScriptNode node, Vector2? position = default(Vector2?))

Add a node to a function of the VisualScript.

    public void AddVariable(string name, object defaultValue = null, bool export = false)

Add a variable to the VisualScript, optionally giving it a default value or marking it as exported.

    public void CustomSignalAddArgument(string name, Variant.Type type, string argname, int index = -1)

Add an argument to a custom signal added with AddCustomSignal(string).

    public int CustomSignalGetArgumentCount(string name)

Get the count of a custom signal’s arguments.

    public string CustomSignalGetArgumentName(string name, int argidx)

Get the name of a custom signal’s argument.

    public Variant.Type CustomSignalGetArgumentType(string name, int argidx)

Get the type of a custom signal’s argument.

    public void CustomSignalRemoveArgument(string name, int argidx)

Remove a specific custom signal’s argument.

    public void CustomSignalSetArgumentName(string name, int argidx, string argname)

Rename a custom signal’s argument.

    public void CustomSignalSetArgumentType(string name, int argidx, Variant.Type type)

Change the type of a custom signal’s argument.

    public void CustomSignalSwapArgument(string name, int argidx, int withidx)

Swap two of the arguments of a custom signal.

    public void DataConnect(string func, int fromNode, int fromPort, int toNode, int toPort)

Connect two data ports. The value of fromNode’s fromPort would be fed into toNode’s toPort.

    public void DataDisconnect(string func, int fromNode, int fromPort, int toNode, int toPort)

Disconnect two data ports previously connected with DataConnect(string, int, int, int, int).

    public int GetFunctionNodeId(string name)

Returns the id of a function’s entry point node.

    public Vector2 GetFunctionScroll(string name)

Returns the position of the center of the screen for a given function.

    public VisualScriptNode GetNode(string func, int id)

Returns a node given its id and its function.

    public Vector2 GetNodePosition(string func, int id)

Returns a node’s position in pixels.

    public object GetVariableDefaultValue(string name)

Returns the default (initial) value of a variable.

    public bool GetVariableExport(string name)

Returns whether a variable is exported.

    public Dictionary GetVariableInfo(string name)

Returns the info for a given variable as a dictionary. The information includes its name, type, hint and usage.

    public bool HasCustomSignal(string name)

Returns whether a signal exists with the specified name.

    public bool HasDataConnection(string func, int fromNode, int fromPort, int toNode, int toPort)

Returns whether the specified data ports are connected.

    public bool HasFunction(string name)

Returns whether a function exists with the specified name.

    public bool HasNode(string func, int id)

Returns whether a node exists with the given id.

    public bool HasSequenceConnection(string func, int fromNode, int fromOutput, int toNode)

Returns whether the specified sequence ports are connected.

    public bool HasVariable(string name)

Returns whether a variable exists with the specified name.

    public void RemoveCustomSignal(string name)

Remove a custom signal with the given name.

    public void RemoveFunction(string name)

Remove a specific function and its nodes from the script.

    public void RemoveNode(string func, int id)

Remove a specific node.

    public void RemoveVariable(string name)

Remove a variable with the given name.

    public void RenameCustomSignal(string name, string newName)

Change the name of a custom signal.

    public void RenameFunction(string name, string newName)

Change the name of a function.

    public void RenameVariable(string name, string newName)

Change the name of a variable.

    public void SequenceConnect(string func, int fromNode, int fromOutput, int toNode)

Connect two sequence ports. The execution will flow from of fromNode’s fromOutput into toNode.

Unlike DataConnect(string, int, int, int, int), there isn’t a to_port, since the target node can have only one sequence port.

    public void SequenceDisconnect(string func, int fromNode, int fromOutput, int toNode)

Disconnect two sequence ports previously connected with SequenceConnect(string, int, int, int).

    public void SetFunctionScroll(string name, Vector2 ofs)

Position the center of the screen for a function.

    public void SetInstanceBaseType(string type)

Set the base type of the script.

    public void SetNodePosition(string func, int id, Vector2 position)

Position a node on the screen.

    public void SetVariableDefaultValue(string name, object value)

Change the default (initial) value of a variable.

    public void SetVariableExport(string name, bool enable)

Change whether a variable is exported.

    public void SetVariableInfo(string name, Dictionary value)

Set a variable’s info, using the same format as GetVariableInfo(string).

Tags: