0 votes

Hello,I am new to Godot and I am following the Typing Game Tutorial on Youtube (part 3) and following his steps however, when I get to adding my list of words into a function in the enemy, it says that it is not declared in the current scope.

onready var words = $RichTextLabel
onready var words_text = words.text 

func _ready() -> void:
        words_text = WordList.get_words()
        words.parse_bbcode(set_center_tags(word_text))

I have a unlinked script named "WordList" which I am trying to get the words from. I have tried to set WordList as a variable with the script path, but then I get the error Invalid call. Non-existent function "get_words()" in base 'string'

Godot version v3.5
in Engine by (12 points)

1 Answer

0 votes

It'll be helpful to include the full text of this script and your WordList script, so we can see if you're using class_name or if there are errors preventing the WordList from compiling. Based on the invalid call message, it sounds like you were assigning the path string to WordList, when you want
var WordList = load("res://path/to/WordList.gd")

by (187 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.