I have made an image map for the game menu, as shown here: http://i.imgur.com/VaVte.png
And I've configured the "Auto Mode", so when the user clicks it, it toggles a check mark on and off beside it (as shown in the image). I've already implemented a portion of Python script written by PyTom that enables the toggling of "Auto Mode", and this works great... Just an aspect of the checkbox function I'm having trouble with.
What works: Toggling the AFM on/off works, and 'toggling' the image of the checkmark works, using the "toggle_img" I have defined. (Is there an easier way to do this?)
What doesn't work: When I check the "Auto Mode" off and return to game, it happily putters along, but when I return to the game menu, the check mark is gone; so it doesn't remember that I've checked the box, even though Auto Mode is on: _preferences.afm_enable (Although I am aware the 'check' for it being enabled is done only when on 'clicked')
So, I thought if I added a sort of "check" to see if Auto Mode was on, when you opened the menu, that it would display the checkmark. The code I wrote for this is:
Code: Select all
python:
ui.layer('checkmark')
if _preferences.afm_enable:
ui.image("imgon.png")
ui.close()
Code: Select all
screen navigation:
My hacked up solution (sucks!), and doesn't even really work... I think I'm completely on the wrong track, halp!.
TL;DR: Checkbox not remembering that I've ticked it upon return to the menu where it was ticked.
Here's the code for the entire screen, untouched by my "solution". I'm using "imgon.png" for the check, and "imgoff.png" for a small section of the background that this just layers over top of, hiding the check. (Again, there must be a way to do it so it just hides the checkmark image, right?)
Note: I added the checkmark images to different layers, "screens" or "checkmark", as they were previously appearing behind the menu background.
Code: Select all
screen navigation:
tag menu
modal True
window:
style "gm_root"
imagemap:
ground "new_main_nav_ground_2.png"
hover "new_main_nav_hover_bold.png"
hotspot (226, 137, 457, 170) clicked Return()
hotspot (226, 181, 457, 212) clicked QuickSave(message = "Progress saved.")
hotspot (226, 226, 457, 260) clicked ShowMenu("load_game")
hotspot (256, 271, 487, 300) clicked ShowMenu("text_history")
hotspot (236, 314, 467, 344) clicked ShowMenu("preferences_game")
hotspot (236, 358, 477, 388) clicked MainMenu(confirm=True)
hotspot (226, 402, 457, 430) clicked Quit()
hotspot (303, 460, 402, 474) clicked Skip()
hotspot (429, 460, 457, 474) clicked (toggle_afm, toggle_img)
init python:
_preferences.afm_enable = False
if not persistent.set_afm:
_preferences.afm_time = 10
persistent.set_afm = True
def toggle_img():
ui.layer('screens')
if _preferences.afm_enable:
ui.image("imgon.png")
else:
ui.image("imgoff.png")
ui.close()
def toggle_afm():
_preferences.afm_enable = not _preferences.afm_enable
renpy.restart_interaction()
Again, forgive me for my noobishness, just started my first attempts at doing any type of scripting on Sunday.
Thank you all very much for your time, in advance.