Debian Codegraph @

doc/classes/Script.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Script" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A class stored as a resource.
5 </brief_description>
6 <description>
7 A class stored as a resource. A script extends the functionality of all objects that instantiate it.
8 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.
9 The [code]new[/code] method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
10 </description>
11 <tutorials>
12 <link title="Scripting documentation index">$DOCS_URL/tutorials/scripting/index.html</link>
13 </tutorials>
14 <methods>
15 <method name="can_instantiate" qualifiers="const">
16 <return type="bool" />
17 <description>
18 Returns [code]true[/code] if the script can be instantiated.
19 </description>
20 </method>
21 <method name="get_base_script" qualifiers="const">
22 <return type="Script" />
23 <description>
24 Returns the script directly inherited by this script.
25 </description>
26 </method>
27 <method name="get_global_name" qualifiers="const">
28 <return type="StringName" />
29 <description>
30 Returns the class name associated with the script, if there is one. Returns an empty string otherwise.
31 To give the script a global name, you can use the [code]class_name[/code] keyword in GDScript and the [code][GlobalClass][/code] attribute in C#.
32 [codeblocks]
33 [gdscript]
34 class_name MyNode
35 extends Node
36 [/gdscript]
37 [csharp]
38 using Godot;
39
40 [GlobalClass]
41 public partial class MyNode : Node
42 {
43 }
44 [/csharp]
45 [/codeblocks]
46 </description>
47 </method>
48 <method name="get_instance_base_type" qualifiers="const">
49 <return type="StringName" />
50 <description>
51 Returns the script's base type.
52 </description>
53 </method>
54 <method name="get_property_default_value">
55 <return type="Variant" />
56 <param index="0" name="property" type="StringName" />
57 <description>
58 Returns the default value of the specified property.
59 </description>
60 </method>
61 <method name="get_rpc_config" qualifiers="const">
62 <return type="Variant" />
63 <description>
64 Returns a [Dictionary] mapping method names to their RPC configuration defined by this script.
65 </description>
66 </method>
67 <method name="get_script_constant_map">
68 <return type="Dictionary" />
69 <description>
70 Returns a dictionary containing constant names and their values.
71 </description>
72 </method>
73 <method name="get_script_method_list">
74 <return type="Dictionary[]" />
75 <description>
76 Returns the list of methods in this [Script].
77 [b]Note:[/b] The dictionaries returned by this method are formatted identically to those returned by [method Object.get_method_list].
78 </description>
79 </method>
80 <method name="get_script_property_list">
81 <return type="Dictionary[]" />
82 <description>
83 Returns the list of properties in this [Script].
84 [b]Note:[/b] The dictionaries returned by this method are formatted identically to those returned by [method Object.get_property_list].
85 </description>
86 </method>
87 <method name="get_script_signal_list">
88 <return type="Dictionary[]" />
89 <description>
90 Returns the list of signals defined in this [Script].
91 [b]Note:[/b] The dictionaries returned by this method are formatted identically to those returned by [method Object.get_signal_list].
92 </description>
93 </method>
94 <method name="has_script_signal" qualifiers="const">
95 <return type="bool" />
96 <param index="0" name="signal_name" type="StringName" />
97 <description>
98 Returns [code]true[/code] if the script, or a base class, defines a signal with the given name.
99 </description>
100 </method>
101 <method name="has_source_code" qualifiers="const">
102 <return type="bool" />
103 <description>
104 Returns [code]true[/code] if the script contains non-empty source code.
105 [b]Note:[/b] If a script does not have source code, this does not mean that it is invalid or unusable. For example, a [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 [method can_instantiate].
106 </description>
107 </method>
108 <method name="instance_has" qualifiers="const">
109 <return type="bool" />
110 <param index="0" name="base_object" type="Object" />
111 <description>
112 Returns [code]true[/code] if [param base_object] is an instance of this script.
113 </description>
114 </method>
115 <method name="is_abstract" qualifiers="const">
116 <return type="bool" />
117 <description>
118 Returns [code]true[/code] if the script is an abstract script. An abstract script does not have a constructor and cannot be instantiated.
119 </description>
120 </method>
121 <method name="is_tool" qualifiers="const">
122 <return type="bool" />
123 <description>
124 Returns [code]true[/code] if the script is a tool script. A tool script can run in the editor.
125 </description>
126 </method>
127 <method name="reload">
128 <return type="int" enum="Error" />
129 <param index="0" name="keep_state" type="bool" default="false" />
130 <description>
131 Reloads the script's class implementation. Returns an error code.
132 </description>
133 </method>
134 </methods>
135 <members>
136 <member name="source_code" type="String" setter="set_source_code" getter="get_source_code">
137 The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.
138 </member>
139 </members>
140 </class>