Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | flynneastwood |
Greetings!
I’m following an online course on Udemy with Yann.
I’m at the point where with a lineEdit, I connect a signal when the player hit return to display the answer.
The problem is, when I hit return, the engine gives me the error Method not found.
I tried to copy and paste the entire code from the teacher and it still gives me the same error.
Here’s the code:
func _on_TextBox_text_entered(new_text):
>>$Blackboard/StoryText.text = new_text
>>player_words.append(new_text)
>>$Blackboard/TextBox.text = ""
>>check_player_word_length()
What am I doing wrong?
Thank you for your time!
Could you cut and paste the exact error returned? Also, when you wrote “connect a signal when the player hit return to display the answer”, did you connect it via the editor, or did you use a connect()
function?
Ertain | 2020-01-08 17:55
Hey Ertain, I connected using the editor. Below is the full error.
E 0:00:10:0066 Error calling method from signal ‘text_entered’: ‘Node2D(LoonyLips.gd)::_on_LineEdit_text_entered’: Method not found.
core/object.cpp:1238 @ emit_signal()
flynneastwood | 2020-01-09 01:25
Obviously you connected to the wrong function name. You connected to a (seemingly nonexistent) function _on_LineEdit_text_entered
whereas your handler is called _on_TextBox_text_entered
So remove the connection and map it again to the correct function.
wombatstampede | 2020-01-09 07:41
At first I thought I was allright with the names but when editing the Connect in the editor, the name was wrong. I corrected it and now it works fine. Thanks Ertain and Wombat!
flynneastwood | 2020-01-09 10:21
credits go to Ertain for asking the right questions.
wombatstampede | 2020-01-09 10:44