My random text... is always the same ??!
Hello, i make a chatbot with Godot and i want to create random text from the program to simulate a... forum, or a chat.
Like the others connected, talk together, alone.
But, the "random" text is always the same, each time i launch the program. I don't understand why.
i have always "coucou", "ça baigne?", "c'est ...", "aurevoir"
Here is, three elements on my form :
- 1 Timer (TimerForum)
- 1 Label (Label)
- 1 Label (Forlab)
Here is my script :
`
extends Control
var forumcnv = 0
func _ready():
pass
func _on_TimerForum_timeout():
# -------------------------------------------------
forumcnv += 1
var reponse = String("defaut")
# -------------------------------------------------
var zeforum_01 = [ "bonjour",
"coucou",
"hello",
"salut"]
var zeforum_02 = [ "ça va?",
"ça roule?",
"ça baigne?",
"ça flotte?"]
var zeforum_03 = [ "c'est bien",
"c'est cool",
"c'est top",
"c'est ..."]
var zeforum_04 = [ "aurevoir",
"à bientôt",
"à demain",
"a++"]
# -------------------------------------------------
if $"Forlab".text == String(5):
reponse = zeforum_01[randi()%zeforum_01.size()]
$"Label".text = reponse
if $"Forlab".text == String(10):
reponse = zeforum_02[randi()%zeforum_02.size()]
$"Label".text = reponse
if $"Forlab".text == String(15):
reponse = zeforum_03[randi()%zeforum_03.size()]
$"Label".text = reponse
if $"Forlab".text == String(20):
reponse = zeforum_04[randi()%zeforum_04.size()]
$"Label".text = reponse
# -------------------------------------------------
print(forumcnv)
$"Forlab".text = String(forumcnv)
`
So my question is, how to make a "real" random text, please? 8D
Thanks for your advices, have a nice day 😉
Alain