hello, i'm not sure to be in the right place, so sorry if i'm "lost" hm...
So, i would like to load text for my project in labels, randomly.
For example, i have 1 label in first scene and if my text file has these words (1 by line or separate by a space) :
hello
world
cat
town
i want to load randomly one of these word, in the label :
world (random choice ;D)
So, actually i can do this :
- display random words in label named "zemot"
func _ready() -> void: var label_text_res = "res://data.txt" var file = FileAccess.open(label_text_res, FileAccess.READ) var text = file.get_as_text() $data01.text = text
- load a text file in a label
func _ready(): initial_position = position var vrai = ["maison","chaton","voiture","cool"]; randomize() $zemot.text = vrai[randi()%vrai.size()]
But i don't know how to mix this two techniques. Any ideas?
I continue to search ; thank you for your help...
vegetalain