for task_name in tasks:
%TaskBoard.text = str(task_name)
This for loop goes through each task and sets the task board to that string. If we un-roll the loop it would look like this:
%TaskBoard.text = "Make serum"
%TaskBoard.text = "Research"
%TaskBoard.text = "Research"
%TaskBoard.text = "Make serum"
%TaskBoard.text = "Study results"
%TaskBoard.text = "Research"
Which results in only displaying the last “Research” right? You will need to add each task, I also recommend not doing this in _process
as it can be rather expensive to set text labels and manipulate strings every frame.
func _on_newtask_timeout():
tasks.append(new_task.pick_random())
# create a new blank string
var all_tasks: String = ""
# add each task to the string
for task_name in tasks:
all_tasks += task_name + "\n" # \n makes a new line; like hitting enter, but for code
# apply the accumulated string to the label
%TaskBoard.text = all_tasks
Make sure to paste code with formatting: