VisualScript

    A script implemented in the Visual Script programming environment.

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

    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.

    • node_ports_changed ( function, int id )

    Emitted when the ports of a node are changed.

    • void add_custom_signal ( 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.


    • void add_node ( func, int id, node, Vector2 position=Vector2( 0, 0 ) )

    Add a node to a function of the VisualScript.


    • void add_variable ( name, Variant default_value=null, export=false )

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


    • void custom_signal_add_argument ( String name, type, String argname, index=-1 )

    Add an argument to a custom signal added with add_custom_signal.


    • custom_signal_get_argument_count ( String name ) const

    Get the count of a custom signal’s arguments.


    • custom_signal_get_argument_name ( String name, argidx ) const

    Get the name of a custom signal’s argument.


    Get the type of a custom signal’s argument.


    Remove a specific custom signal’s argument.


    • void custom_signal_set_argument_name ( name, int argidx, argname )

    Rename a custom signal’s argument.



    • void custom_signal_swap_argument ( name, int argidx, withidx )

    Swap two of the arguments of a custom signal.


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

    Connect two data ports. The value of ‘s from_port would be fed into ‘s to_port.


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

    Disconnect two data ports previously connected with data_connect.


    • get_function_node_id ( String name ) const

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


    • get_function_scroll ( String name ) const

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


    • get_node ( String func, id ) const

    Returns a node given its id and its function.


    Returns a node’s position in pixels.


    • get_variable_default_value ( String name ) const

    Returns the default (initial) value of a variable.


    • get_variable_export ( String name ) const

    Returns whether a variable is exported.


    • get_variable_info ( String name ) const

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


    • has_custom_signal ( String name ) const

    Returns whether a signal exists with the specified name.


    • has_data_connection ( String func, from_node, int from_port, to_node, int to_port ) const

    Returns whether the specified data ports are connected.


    • has_function ( String name ) const

    Returns whether a function exists with the specified name.


    Returns whether a node exists with the given id.


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

    Returns whether the specified sequence ports are connected.


    • bool has_variable ( name ) const

    • void remove_custom_signal ( String name )

    Remove a custom signal with the given name.


    • void remove_function ( name )

    Remove a specific function and its nodes from the script.


    • void remove_node ( String func, id )

    Remove a specific node.


    • void remove_variable ( String name )

    Remove a variable with the given name.


    • void rename_custom_signal ( name, String new_name )

    Change the name of a custom signal.


    • void rename_function ( name, String new_name )

    Change the name of a function.


    • void rename_variable ( name, String new_name )

    Change the name of a variable.


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

    Connect two sequence ports. The execution will flow from of ‘s from_output into .

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


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

    Disconnect two sequence ports previously connected with sequence_connect.


    • void set_function_scroll ( name, Vector2 ofs )

    Position the center of the screen for a function.


    • void set_instance_base_type ( type )

    Set the base type of the script.


    Position a node on the screen.


    • void set_variable_default_value ( name, Variant value )

    Change the default (initial) value of a variable.


    Change whether a variable is exported.


    • void set_variable_info ( name, Dictionary value )