I was browsing the forums for some help on making a button have multiple actions and found this: viewtopic.php?t=37185
So I decided to apply the same logic to my own button but it didn't work.
I'm trying to get my button to be sensitive to a specific condition: having a gallery image unlocked. So I found the SensitiveIf() command, but I end up getting an error. The code I used for my button is:
Code: Select all
imagebutton auto "gui/gallery/replay_%s.png" action SensitiveIf[SetVariable("persistent.unlock_cg1", True), Replay("start")]
And the error I got is this:
Code: Select all
I'm sorry, but an uncaught exception occurred.
After initialization, but before game start.
File "game/screens.rpy", line 1184, in prepare_screen
screen cg_gallery_extras():
File "game/screens.rpy", line 1184, in prepare
screen cg_gallery_extras():
File "game/screens.rpy", line 1239, in prepare
grid 2 3:
File "game/screens.rpy", line 1239, in prepare
grid 2 3:
File "game/screens.rpy", line 1251, in prepare
imagebutton auto "gui/gallery/replay_%s.png" action SensitiveIf[SetVariable("persistent.unlock_cg1", True), Replay("start")]
File "game/screens.rpy", line 1251, in prepare
imagebutton auto "gui/gallery/replay_%s.png" action SensitiveIf[SetVariable("persistent.unlock_cg1", True), Replay("start")]
TypeError: 'type' object has no attribute '__getitem__'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Program Files\renpy-7.2.2-sdk\renpy\bootstrap.py", line 313, in bootstrap
renpy.main.main()
File "C:\Program Files\renpy-7.2.2-sdk\renpy\main.py", line 525, in main
run(restart)
File "C:\Program Files\renpy-7.2.2-sdk\renpy\main.py", line 90, in run
renpy.display.screen.prepare_screens()
File "C:\Program Files\renpy-7.2.2-sdk\renpy\display\screen.py", line 909, in prepare_screens
s.ast.prepare_screen()
File "game/screens.rpy", line 1184, in prepare_screen
screen cg_gallery_extras():
File "game/screens.rpy", line 1184, in prepare
screen cg_gallery_extras():
File "game/screens.rpy", line 1239, in prepare
grid 2 3:
File "game/screens.rpy", line 1239, in prepare
grid 2 3:
File "game/screens.rpy", line 1251, in prepare
imagebutton auto "gui/gallery/replay_%s.png" action SensitiveIf[SetVariable("persistent.unlock_cg1", True), Replay("start")]
File "game/screens.rpy", line 1251, in prepare
imagebutton auto "gui/gallery/replay_%s.png" action SensitiveIf[SetVariable("persistent.unlock_cg1", True), Replay("start")]
File "C:\Program Files\renpy-7.2.2-sdk\renpy\python.py", line 1954, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "<screen language>", line 1251, in <module>
TypeError: 'type' object has no attribute '__getitem__'
Windows-8-6.2.9200
Ren'Py 7.2.2.491
Princess Impersonator 1.0
Wed Mar 18 17:42:58 2020
Thanks in advance!