Are the tutorials in the documentation up to date?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bleenx
:warning: Old Version Published before Godot 3 was released.

I tried following the GDScript Tutorial, the starting one, in the documentation, where you add a panel and then a label and a button as children of the panel. Upon making the script for the panel and writing the code, the result is an error instead of “Hello!”

I deleted my code and instead copy/pasted the code from the tutorial, and it also gave the same error. So I’m wondering if the tutorial is up to date or if I somehow could have missed something.

  • I created a panel.
  • I created a label.
  • I created a button.
  • I made sure to make the label and the button children of the panel.
  • I clicked the panel and added a script.
  • I copy pasted the code from the tutorial into it.
  • I saved the scene, set it to main after it insisted, and ran it.
  • Error.

Thank you. I was unsure how to find the error and copy it here.

Some are, but (and I’m gestimating here) most are not. This isn’t a big problem though as most of the version 1 info is still relevant to version 2. Copying and pasting the script and error message here would help me in solving your problem with you.

SupToasty | 2016-04-29 01:41

Thanks for replying. This is the tutorial: http://docs.godotengine.org/en/latest/tutorials/step_by_step/scripting.html

And the code in question is this one:

extends Panel

func _on_button_pressed():
get_node(“Label”).set_text(“HELLO!”)

func _ready():
get_node(“Button”).connect(“pressed”,self,“_on_button_pressed”)

I’m not sure why the getnode isn’t showing an underscore here, but I use it when writing the real script.

Bleenx | 2016-04-29 11:59

I assume the italic words are where underscores where. This is a non-static scripting language, did you add indents after the function declarations? If not then indent the get_node() s

SupToasty | 2016-04-29 15:47

When you copy and paste from the docs, it often leaves out true indents and inserts 4 to 8 blank spaces instead.

SupToasty | 2016-04-29 16:00

Thanks for that. When I entered the code, it automatically indented the code for me on the next line:

func _on_button_pressed():
get_node(“Label”).set_text(“HELLO!”)

func _ready():
get_node(“Button”).connect(“pressed”,self,“_on_button_pressed”)

*its not showing the indent in the preview here but it’s really indented

So, I don’t understand where my mistake is. I have the label and button as children of the panel, added the script to the panel. I’m just not sure if I’m missing something, but I could have sworn I followed each step precisely. Hmm, stumped here.

Bleenx | 2016-04-29 16:19

Why don’t you try taking a snapshot of your editor’s node tree and see what the debugger’s explanation for the crash is. You might need a upload site like pintrest or deviant art to have the image show here.

SupToasty | 2016-04-29 16:25

Well I did it again for the third time and it all worked. What did I do differently? I have no idea. I think I may have saved my script in the wrong place the first time? I don’t know. I’m still trying to figure out the best way to save stuff in this engine… Thanks for your help.

If you don’t mind, can you tell me how to set my custom layout to open every time I start a new project? I always have to set it myself which seems unusual that Godot wouldn’t remember it. I can save the layout and select it, but Godot never uses it as default.

If I have to make a new question for this, I will. Thanks!

Bleenx | 2016-04-29 16:46

I’m sure it’s possible. You will probably need to make a custom build though. The rest of the community might give you away to make your layout default without compiling the engine.

SupToasty | 2016-04-29 16:54

How odd. I own Construct 2 and use Unity and both open with whatever layout I saved. Oh well, no biggie. Thanks for all your help!

Bleenx | 2016-04-29 17:03

Not sure if you figured out the default layout question, but I think if you save over the ‘Default’ layout, it will load that up each time.

jonathanh | 2016-06-04 06:14