- Edited
This is my first game ever, I have zero coding knowledge other than the absolute basics. I'm making a text based adventure and I'm trying to make it scroll down to the latest response every time the player makes an action. Ive had to watch a couple of older tutorials to get this far, but i cant find anything on what arguments this function is looking for so I'm not sure how to fix it.
The error it gives me is "Invalid type in function 'connect' in base 'VScrollBar' cannot convert argument 2 from Object to Callable"
extends Control
const InputResponse = preload("res://input_response.tscn")
@onready var game_history = $Background/Margin/Rows/GameInfo/Scroll/GameHistory
@onready var scroll = $Background/Margin/Rows/GameInfo/Scroll
@onready var scrollbar = scroll.get_v_scroll_bar()
func _ready() -> void:
scrollbar.connect("changed", self, handle_scroll_bar_changed())
func handle_scroll_bar_changed():
scroll.scroll_vertical = scrollbar.max_value
func _on_input_text_submitted(new_text: String) -> void:
var input_reponse = InputResponse.instantiate()
input_reponse.set_text(new_text, "Test")
game_history.add_child(input_reponse)