I am working on this game where I have a screen that opens to display certain random messages, its a Krystal ball whom the player can take it out of its pocket peer in it and get a random message.
Here is part of the code:
Code: Select all
label ballgaze:
$ ball = renpy.random.randint(1, 4)
if ball == 1:
$messa = "Today its going to Rain heavily., but stay focused on your purpose"
if ball == 2:
$messa = "What does not kill you will make you stronger."
if ball == 3:
$messa = "Your destiny is in your hands."
if ball == 4:
$messa = "Remember the reason you are here!!"
screen kriball_button:
imagebutton:
idle "appear_idle.png"
hover "appear_hover.png"
action [Show ("kriball_screen "), Hide("kriball_button")] align (.40,.90)
screen kriball:
modal True
window:
vbox:
label "Krystal Ball"
text " Digging in your pocket you take out the Krystal ball and peer inside for a message:"
text ""
text " [messa] "
How can i make it that the screen will display another random message after i close and reopen it again?
I understand that somehow the message ballgaze "function" should run each time the screen is opened in order to generate a new one.
But I cannot figure out how to get it done, I hope someone can give me a hand with this.