| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 | :github_url: hide.. DO NOT EDIT THIS FILE!!!.. Generated automatically from Godot engine sources... Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py... XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Script.xml... _class_Script:Script======**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`**Inherited By:** :ref:`CSharpScript<class_CSharpScript>`, :ref:`GDScript<class_GDScript>`, :ref:`ScriptExtension<class_ScriptExtension>`A class stored as a resource... rst-class:: classref-introduction-groupDescription-----------A class stored as a resource. A script extends the functionality of all objects that instantiate it.This is the base class for all scripts and should not be used directly. Trying to create a new script with this class will result in an error.The ``new`` method of a script subclass creates a new instance. :ref:`Object.set_script()<class_Object_method_set_script>` extends an existing object, if that object's class matches one of the script's base classes... rst-class:: classref-introduction-groupTutorials---------- :doc:`Scripting documentation index <../tutorials/scripting/index>`.. rst-class:: classref-reftable-groupProperties----------.. table::   :widths: auto   +-----------------------------+-------------------------------------------------------+   | :ref:`String<class_String>` | :ref:`source_code<class_Script_property_source_code>` |   +-----------------------------+-------------------------------------------------------+.. rst-class:: classref-reftable-groupMethods-------.. table::   :widths: auto   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`bool<class_bool>`                                          | :ref:`can_instantiate<class_Script_method_can_instantiate>`\ (\ ) |const|                                                               |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Script<class_Script>`                                      | :ref:`get_base_script<class_Script_method_get_base_script>`\ (\ ) |const|                                                               |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`StringName<class_StringName>`                              | :ref:`get_global_name<class_Script_method_get_global_name>`\ (\ ) |const|                                                               |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`StringName<class_StringName>`                              | :ref:`get_instance_base_type<class_Script_method_get_instance_base_type>`\ (\ ) |const|                                                 |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Variant<class_Variant>`                                    | :ref:`get_property_default_value<class_Script_method_get_property_default_value>`\ (\ property\: :ref:`StringName<class_StringName>`\ ) |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Variant<class_Variant>`                                    | :ref:`get_rpc_config<class_Script_method_get_rpc_config>`\ (\ ) |const|                                                                 |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Dictionary<class_Dictionary>`                              | :ref:`get_script_constant_map<class_Script_method_get_script_constant_map>`\ (\ )                                                       |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] | :ref:`get_script_method_list<class_Script_method_get_script_method_list>`\ (\ )                                                         |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] | :ref:`get_script_property_list<class_Script_method_get_script_property_list>`\ (\ )                                                     |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] | :ref:`get_script_signal_list<class_Script_method_get_script_signal_list>`\ (\ )                                                         |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`bool<class_bool>`                                          | :ref:`has_script_signal<class_Script_method_has_script_signal>`\ (\ signal_name\: :ref:`StringName<class_StringName>`\ ) |const|        |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`bool<class_bool>`                                          | :ref:`has_source_code<class_Script_method_has_source_code>`\ (\ ) |const|                                                               |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`bool<class_bool>`                                          | :ref:`instance_has<class_Script_method_instance_has>`\ (\ base_object\: :ref:`Object<class_Object>`\ ) |const|                          |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`bool<class_bool>`                                          | :ref:`is_abstract<class_Script_method_is_abstract>`\ (\ ) |const|                                                                       |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`bool<class_bool>`                                          | :ref:`is_tool<class_Script_method_is_tool>`\ (\ ) |const|                                                                               |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+   | :ref:`Error<enum_@GlobalScope_Error>`                            | :ref:`reload<class_Script_method_reload>`\ (\ keep_state\: :ref:`bool<class_bool>` = false\ )                                           |   +------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+.. rst-class:: classref-section-separator----.. rst-class:: classref-descriptions-groupProperty Descriptions---------------------.. _class_Script_property_source_code:.. rst-class:: classref-property:ref:`String<class_String>` **source_code** :ref:`🔗<class_Script_property_source_code>`.. rst-class:: classref-property-setget- |void| **set_source_code**\ (\ value\: :ref:`String<class_String>`\ )- :ref:`String<class_String>` **get_source_code**\ (\ )The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically... rst-class:: classref-section-separator----.. rst-class:: classref-descriptions-groupMethod Descriptions-------------------.. _class_Script_method_can_instantiate:.. rst-class:: classref-method:ref:`bool<class_bool>` **can_instantiate**\ (\ ) |const| :ref:`🔗<class_Script_method_can_instantiate>`Returns ``true`` if the script can be instantiated... rst-class:: classref-item-separator----.. _class_Script_method_get_base_script:.. rst-class:: classref-method:ref:`Script<class_Script>` **get_base_script**\ (\ ) |const| :ref:`🔗<class_Script_method_get_base_script>`Returns the script directly inherited by this script... rst-class:: classref-item-separator----.. _class_Script_method_get_global_name:.. rst-class:: classref-method:ref:`StringName<class_StringName>` **get_global_name**\ (\ ) |const| :ref:`🔗<class_Script_method_get_global_name>`Returns the class name associated with the script, if there is one. Returns an empty string otherwise.To give the script a global name, you can use the ``class_name`` keyword in GDScript and the ``[GlobalClass]`` attribute in C#... tabs:: .. code-tab:: gdscript    class_name MyNode    extends Node .. code-tab:: csharp    using Godot;    [GlobalClass]    public partial class MyNode : Node    {    }.. rst-class:: classref-item-separator----.. _class_Script_method_get_instance_base_type:.. rst-class:: classref-method:ref:`StringName<class_StringName>` **get_instance_base_type**\ (\ ) |const| :ref:`🔗<class_Script_method_get_instance_base_type>`Returns the script's base type... rst-class:: classref-item-separator----.. _class_Script_method_get_property_default_value:.. rst-class:: classref-method:ref:`Variant<class_Variant>` **get_property_default_value**\ (\ property\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Script_method_get_property_default_value>`Returns the default value of the specified property... rst-class:: classref-item-separator----.. _class_Script_method_get_rpc_config:.. rst-class:: classref-method:ref:`Variant<class_Variant>` **get_rpc_config**\ (\ ) |const| :ref:`🔗<class_Script_method_get_rpc_config>`Returns a :ref:`Dictionary<class_Dictionary>` mapping method names to their RPC configuration defined by this script... rst-class:: classref-item-separator----.. _class_Script_method_get_script_constant_map:.. rst-class:: classref-method:ref:`Dictionary<class_Dictionary>` **get_script_constant_map**\ (\ ) :ref:`🔗<class_Script_method_get_script_constant_map>`Returns a dictionary containing constant names and their values... rst-class:: classref-item-separator----.. _class_Script_method_get_script_method_list:.. rst-class:: classref-method:ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] **get_script_method_list**\ (\ ) :ref:`🔗<class_Script_method_get_script_method_list>`Returns the list of methods in this **Script**.\ **Note:** The dictionaries returned by this method are formatted identically to those returned by :ref:`Object.get_method_list()<class_Object_method_get_method_list>`... rst-class:: classref-item-separator----.. _class_Script_method_get_script_property_list:.. rst-class:: classref-method:ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] **get_script_property_list**\ (\ ) :ref:`🔗<class_Script_method_get_script_property_list>`Returns the list of properties in this **Script**.\ **Note:** The dictionaries returned by this method are formatted identically to those returned by :ref:`Object.get_property_list()<class_Object_method_get_property_list>`... rst-class:: classref-item-separator----.. _class_Script_method_get_script_signal_list:.. rst-class:: classref-method:ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] **get_script_signal_list**\ (\ ) :ref:`🔗<class_Script_method_get_script_signal_list>`Returns the list of user signals defined in this **Script**.\ **Note:** The dictionaries returned by this method are formatted identically to those returned by :ref:`Object.get_signal_list()<class_Object_method_get_signal_list>`... rst-class:: classref-item-separator----.. _class_Script_method_has_script_signal:.. rst-class:: classref-method:ref:`bool<class_bool>` **has_script_signal**\ (\ signal_name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Script_method_has_script_signal>`Returns ``true`` if the script, or a base class, defines a signal with the given name... rst-class:: classref-item-separator----.. _class_Script_method_has_source_code:.. rst-class:: classref-method:ref:`bool<class_bool>` **has_source_code**\ (\ ) |const| :ref:`🔗<class_Script_method_has_source_code>`Returns ``true`` if the script contains non-empty source code.\ **Note:** If a script does not have source code, this does not mean that it is invalid or unusable. For example, a :ref:`GDScript<class_GDScript>` that was exported with binary tokenization has no source code, but still behaves as expected and could be instantiated. This can be checked with :ref:`can_instantiate()<class_Script_method_can_instantiate>`... rst-class:: classref-item-separator----.. _class_Script_method_instance_has:.. rst-class:: classref-method:ref:`bool<class_bool>` **instance_has**\ (\ base_object\: :ref:`Object<class_Object>`\ ) |const| :ref:`🔗<class_Script_method_instance_has>`Returns ``true`` if ``base_object`` is an instance of this script... rst-class:: classref-item-separator----.. _class_Script_method_is_abstract:.. rst-class:: classref-method:ref:`bool<class_bool>` **is_abstract**\ (\ ) |const| :ref:`🔗<class_Script_method_is_abstract>`Returns ``true`` if the script is an abstract script. An abstract script does not have a constructor and cannot be instantiated... rst-class:: classref-item-separator----.. _class_Script_method_is_tool:.. rst-class:: classref-method:ref:`bool<class_bool>` **is_tool**\ (\ ) |const| :ref:`🔗<class_Script_method_is_tool>`Returns ``true`` if the script is a tool script. A tool script can run in the editor... rst-class:: classref-item-separator----.. _class_Script_method_reload:.. rst-class:: classref-method:ref:`Error<enum_@GlobalScope_Error>` **reload**\ (\ keep_state\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_Script_method_reload>`Reloads the script's class implementation. Returns an error code... |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`.. |void| replace:: :abbr:`void (No return value.)`
 |