This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

First, wow, it is annoying that half the programming software out there doesn't have error messages that makes sense. Anyway, I got this message in this game file: https://www.dropbox.com/sh/6dtbs589njzyw0k/AADQlYzpNPLPTIGaHhOedviaa?dl=0 I really don't know a way of explaining it without showing the game files, so here you go. Thanks for your help in advance!

in Engine by (27 points)

I'll see it in a moment and see if i can help.

2 Answers

+1 vote
Best answer

Hi,
I've seen two main problems. The first is in line 19 of RichTextLabel.gd.
There you are trying to use show() function from RichTextLabel node. However (besides you forgot the () in show), as the script is attached directly to RichTextLabel, you shouldn't try to get this:

get_tree().get_root().get_node("Polygon2D/RichTextLabel").show

but call directly to show:

show()

or if you want to use full path:

get_tree().get_root().get_node("Node2D/Polygon2D/RichTextLabel").show()

The error isn't to hard to interpret once you start to know the engine a little. It says Invalid get index 'show' (on base: 'null instance') because the sentence get_tree().get_root().get_node("Polygon2D/RichTextLabel").show returns null as you are trying to get RichTextLabel from that full path, and you are missing Node2D. So the error says that the null returned has not an index called show.

Similar error is the one you have in the timer timeout's function. There you use:

$RichTextLabel.show()

but you are already inside RichTextLabel as the script is attached to it. So instead you should directly use:

show()

The other things i see are that the text won't show anyways, because it's Polygon2D is not visible, and also you set to 0 visible characters in ready. You need to change that when you want the text to appear, but i assume you already know that.
Tell me if its helps! it works on my pc

by (3,505 points)
selected by

Hey, thanks again! By the way, I didn't mean for the text to show up yet, so that's not an issue, but yeah. I'll try to keep this in mind so this error doesn't happen again.

Er, while you're here. What's the reason why when I say hide()...it doesn't?

I'll check when i get home.. in which line is the hide that is not working?

Eerrmm, actually, never mind. I got it. But I do have another problem. (Oh, yeah. I'm a problem factory) Don't worry. I'll stop bothering you after this: what's wrong with this code?

func input(event):
if event.type == InputEvent.MOUSE
BUTTON && event.ispressed():
if get
visiblecharacters() > gettotalcharactercount():
if page < dialog.size()-1:
page += 1
setbbcode(dialog[page])
set
visible_characters(0)

It has the same error message as before, but with 'type' instead of 'show' and 'InputEventMouseMotion' instead of 'null instance'

In on my phone right know so i cannot test what im going to tell you. But i think that in godot 3 you should use:

if (event is InputEventMouseButton):

Instead of

if (event.type == InputEvent.MOUSE_BUTTON):

Please tell me if this works for you!
Anyway, just for the record, is better that if you have different questions you ask them on different questions, so more people can answer you and you get more chance of a faster answer! And if remember to select the answer that best worked for you so others with similar problems can easily find the answer.

Okay! Thanks for the tip. I'll try this now.

Yay, it works! Thanks...for the 5th time? 6th? I dunno.

You are welcome! You may select the answer if it helped!

would you select my answer?

0 votes

Not sure if this is relative, but this is one of the top results when searching "godot invalid get index on base null instance".

After much trial and error, I found that the child nodes of my root node are not accessible until the "ready" function. If I tried to reference them at the top of the script or in the "init" function, I just kept getting "null".

Maybe this is common knowledge for experienced godot people, or it's listed somewhere I haven't seen yet, but it really made my life difficult for two days.

by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.