On my main menu, I have a conditional which, if you've played the game once, pops up and congratulates you. Originally, I had this code below, which worked but the "okay" button would occasionally not focus by default and wouldn't even highlight if I pressed left, right, up, down on the controller (FYI this is for a console port).
This is my old code:
Code: Select all
screen main_menu():
add MouseHiderDisplayable() size (1,1)
tag menu
if len(persistent.endings) == 1:
window:
add "mainmenubg"
hbox:
add "images/popup.png" xanchor 0.0 yanchor 0 xpos 410 ypos 200
vbox:
yanchor 0
xanchor 0.5
ypos 350
xalign 0.5
xmaximum 1000
ymaximum 350
xfill True
spacing 25
label _("Congratulations! #etc"):
text_style "yesno_label_text"
xalign 0.5
yalign 0.5
hbox:
style "menu"
xalign 0.5
ypos 250
spacing 70
button:
action [Return(), AddToSet(persistent.endings, 1)] default True
style "menu_choice_button"
text _("Okay") style "menu_choice"
Here's my new code, but unfortunately it doesn't work:
Code: Select all
screen main_menu():
add MouseHiderDisplayable() size (1,1)
tag menu
if len(persistent.endings) == 1:
use firstplaythroughpopup
### rest of menu
screen firstplaythroughpopup:
add MouseHiderDisplayable() size (1,1)
modal True
window:
add "mainmenubg"
hbox:
add "images/popup.png" xanchor 0.0 yanchor 0 xpos 410 ypos 200
vbox:
yanchor 0
xanchor 0.5
ypos 350
xalign 0.5
xmaximum 1000
ymaximum 350
xfill True
spacing 25
label _("Congratulations! #etc"):
text_style "yesno_label_text"
xalign 0.5
yalign 0.5
hbox:
style "menu"
xalign 0.5
ypos 250
spacing 70
button:
action [Return(), AddToSet(persistent.endings, 1)] default True
style "menu_choice_button"
text _("Okay") style "menu_choice"