Cannot Figure Out Why My Time System Is Broken

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Thallium

Currently have 1 error that says "Invalid argument for “connect()" function: argument 2 should be “Callable” but is “res://Scripts/Util/TimeSystem.gd””. I would greatly appreciate any help, this is for a stardew clone that I plan on releasing to the asset library for others to learn from so if you notice any other mistakes please feel free to inform me! :slight_smile:

extends Node

var currentHour : int = 6
var currentMinute : int = 0
var isAM : bool = true

var weekdays := ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
var currentDay : int = 0

@onready var timeLabel = $AnimationPlayer
@onready var minuteTimer = $Timer

func _ready():
	minuteTimer.wait_time = 60.0 / 14.0  # 14 minutes real time equivalent to 1 minute game time
	minuteTimer.connect("timeout", self, "_on_Timer_timeout")
	minuteTimer.start()

func _on_timer_timeout():
	advanceTime()
	updateUITime()

func advanceTime():
	currentMinute += 1
	if currentMinute >= 60:
		currentMinute = 0
		advanceHour()

func advanceHour():
	currentHour += 1
	if currentHour >= 12:
		currentHour = 1
		isAM = !isAM
		advanceDay()

func advanceDay():
	currentDay = (currentDay + 1) % 7

func updateUITime():
	var timeString = str(currentHour).pad_zeros(2) + ":" + str(currentMinute).pad_zeros(2) + " " + "AM"
	var weekdayString = weekdays[currentDay]
	timeLabel.text = weekdayString + ", " + timeString
:bust_in_silhouette: Reply From: Enfyna

connect() changed in 4.0

Thank you! I was able to fix it by changing it over to this:

minuteTimer.timeout.connect(_on_timer_timeout)

Thallium | 2023-05-26 15:44