VisualScript

Inherits: Script < Resource < Reference < Object

A script implemented in the Visual Script programming environment.

Description

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

Object.set_script 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.

Tutorials

Methods

voidadd_custom_signal ( String name )
voidadd_function ( String name )
voidadd_node ( String func, int id, VisualScriptNode node, Vector2 position=Vector2( 0, 0 ) )
voidadd_variable ( String name, Variant default_value=null, bool export=false )
voidcustom_signal_add_argument ( String name, Variant.Type type, String argname, int index=-1 )
intcustom_signal_get_argument_count ( String name ) const
Stringcustom_signal_get_argument_name ( String name, int argidx ) const
Variant.Typecustom_signal_get_argument_type ( String name, int argidx ) const
voidcustom_signal_remove_argument ( String name, int argidx )
voidcustom_signal_set_argument_name ( String name, int argidx, String argname )
voidcustom_signal_set_argument_type ( String name, int argidx, Variant.Type type )
voidcustom_signal_swap_argument ( String name, int argidx, int withidx )
voiddata_connect ( String func, int from_node, int from_port, int to_node, int to_port )
voiddata_disconnect ( String func, int from_node, int from_port, int to_node, int to_port )
intget_function_node_id ( String name ) const
Vector2get_function_scroll ( String name ) const
VisualScriptNodeget_node ( String func, int id ) const
Vector2get_node_position ( String func, int id ) const
Variantget_variable_default_value ( String name ) const
boolget_variable_export ( String name ) const
Dictionaryget_variable_info ( String name ) const
boolhas_custom_signal ( String name ) const
boolhas_data_connection ( String func, int from_node, int from_port, int to_node, int to_port ) const
boolhas_function ( String name ) const
boolhas_node ( String func, int id ) const
boolhas_sequence_connection ( String func, int from_node, int from_output, int to_node ) const
boolhas_variable ( String name ) const
voidremove_custom_signal ( String name )
voidremove_function ( String name )
voidremove_node ( String func, int id )
voidremove_variable ( String name )
voidrename_custom_signal ( String name, String new_name )
voidrename_function ( String name, String new_name )
voidrename_variable ( String name, String new_name )
voidsequence_connect ( String func, int from_node, int from_output, int to_node )
voidsequence_disconnect ( String func, int from_node, int from_output, int to_node )
voidset_function_scroll ( String name, Vector2 ofs )
voidset_instance_base_type ( String type )
voidset_node_position ( String func, int id, Vector2 position )
voidset_variable_default_value ( String name, Variant value )
voidset_variable_export ( String name, bool enable )
voidset_variable_info ( String name, Dictionary value )

Signals

  • node_ports_changed ( String function, int id )

Emitted when the ports of a node are changed.

Method Descriptions

  • void add_custom_signal ( String name )

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


  • void add_function ( String name )

Add a function with the specified name to the VisualScript.


Add a node to a function of the VisualScript.


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


Add an argument to a custom signal added with add_custom_signal.


  • int custom_signal_get_argument_count ( String name ) const

Get the count of a custom signal’s arguments.


Get the name of a custom signal’s argument.


Get the type of a custom signal’s argument.


  • void custom_signal_remove_argument ( String name, int argidx )

Remove a specific custom signal’s argument.


  • void custom_signal_set_argument_name ( String name, int argidx, String argname )

Rename a custom signal’s argument.


Change the type of a custom signal’s argument.


  • void custom_signal_swap_argument ( String name, int argidx, int withidx )

Swap two of the arguments of a custom signal.


Connect two data ports. The value of from_node’s from_port would be fed into to_node’s to_port.


  • void data_disconnect ( String func, int from_node, int from_port, int to_node, int to_port )

Disconnect two data ports previously connected with data_connect.


  • int get_function_node_id ( String name ) const

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


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


Returns a node given its id and its function.


Returns a node’s position in pixels.


Returns the default (initial) value of a variable.


Returns whether a variable is exported.


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


Returns whether a signal exists with the specified name.


Returns whether the specified data ports are connected.


Returns whether a function exists with the specified name.


Returns whether a node exists with the given id.


  • bool has_sequence_connection ( String func, int from_node, int from_output, int to_node ) const

Returns whether the specified sequence ports are connected.


Returns whether a variable exists with the specified name.


  • void remove_custom_signal ( String name )

Remove a custom signal with the given name.


  • void remove_function ( String name )

Remove a specific function and its nodes from the script.


Remove a specific node.


  • void remove_variable ( String name )

Remove a variable with the given name.


Change the name of a custom signal.


Change the name of a function.


Change the name of a variable.


  • void sequence_connect ( String func, int from_node, int from_output, int to_node )

Connect two sequence ports. The execution will flow from of from_node’s from_output into to_node.

Unlike data_connect, there isn’t a to_port, since the target node can have only one sequence port.


  • void sequence_disconnect ( String func, int from_node, int from_output, int to_node )

Disconnect two sequence ports previously connected with sequence_connect.


Position the center of the screen for a function.


  • void set_instance_base_type ( String type )

Set the base type of the script.


Position a node on the screen.


Change the default (initial) value of a variable.


  • void set_variable_export ( String name, bool enable )

Change whether a variable is exported.


Set a variable’s info, using the same format as get_variable_info.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.