Ren'Py Error trying to load save/load/preferences screen from custom menu

Tarish

New Member
Jun 26, 2018
2
0
Hi there.

I'm trying to make a custom game menu with imagebuttons, following that tutorial I found here:


More or less, everything works correctly, but when I try to make the Save/Load/Preferences button go where they should, an error appears:
The code looks like that:

Code:
$ _game_menu_screen = "game_menu"

screen game_menu():
    tag menu
    add "images/background.png" xalign 0 yalign 0
    zorder 102

    imagebutton:
        focus_mask True
        idle Transform("images/Preferences.png")
        hover Transform("images/Preferences Hover.png")
        action [ShowMenu("preferences")]

    imagebutton:
        focus_mask True
        idle Transform("images/Save.png")
        hover Transform("images/Save Hover.png")
        action [ShowMenu("save")]

    imagebutton:
        focus_mask True
        idle Transform("images/Load.png")
        hover Transform("images/Load Hover.png")
        action [ShowMenu("load")]
As I say, now pushing the right mouse button, the screen shows every
image as it should, and the custom actions ("jump inventory", and that
kind of things) work without problem, but when I click any of these
three buttons, the next error pops:

I'm sorry, but an uncaught exception occurred.

While running game code:
Code:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "game/screens.rpy", line 716, in execute
screen preferences():
File "game/screens.rpy", line 716, in execute
screen preferences():
File "game/screens.rpy", line 720, in execute
use game_menu(_("Preferences"), scroll="viewport"):
Exception: Too many arguments in call (expected 0, got 1).

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "C:\path\renpy-7.1.3-sdk\renpy\ast.py", line 881, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\path\renpy-7.1.3-sdk\renpy\python.py", line 1913, in py_exec_bytecode
exec bytecode in globals, locals
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "C:\path\renpy-7.1.3-sdk\renpy\ui.py", line 289, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 2672, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 3059, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 531, in visit_all
d.visit_all(callback, seen)
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 531, in visit_all
d.visit_all(callback, seen)
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 531, in visit_all
d.visit_all(callback, seen)
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 531, in visit_all
d.visit_all(callback, seen)
File "C:\path\renpy-7.1.3-sdk\renpy\display\screen.py", line 424, in visit_all
callback(self)
File "C:\path\renpy-7.1.3-sdk\renpy\display\core.py", line 3059, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "C:\path\renpy-7.1.3-sdk\renpy\display\screen.py", line 434, in per_interact
self.update()
File "C:\path\renpy-7.1.3-sdk\renpy\display\screen.py", line 619, in update
self.screen.function(**self.scope)
File "game/screens.rpy", line 716, in execute
screen preferences():
File "game/screens.rpy", line 716, in execute
screen preferences():
File "game/screens.rpy", line 720, in execute
use game_menu(_("Preferences"), scroll="viewport"):
File "C:\path\renpy-7.1.3-sdk\renpy\ast.py", line 136, in apply
raise Exception("Too many arguments in call (expected %d, got %d)." % (len(self.positional), len(args)))
Exception: Too many arguments in call (expected 0, got 1).

Windows-8-6.2.9200
Ren'Py 7.1.3.1092
Hola soy una puerta 1.0
Thu Jun 20 20:56:47 2019
Any advice about what can be the cause, and how can I solve it?

Thank you very much.

Things I've tried and still give error:

Code:
screen game_menu:
(no brackets)

Code:
action ShowMenu("preferences")
action [ShowMenu('preferences')]
action [Show("preferences")]
action [ShowMenu("preferences_screen")]
action [Jump("preferences")]
action [Scene("preferences")]
action [Screen("preferences")]
Yes, some of them, I've actually tried to improvise, seeing that nothing I found worked. Also, I've tried any combination of them (i.e. action Show('preferences'), for example)
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,059
Your reference is from 6 years ago... so things have changed substantially since then.

Ren'py has a built-in screen called 'game_menu' which your custom one has overwritten... all the default screens are already in screens.rpy and the ones that rely on the built-in 'game_menu' that does take arguments will now cause errors.

Looking at the default screens in that file and going through them and the actual , to figure out how you can effectively customize the existing structure is probably your best bet.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,171
Code:
screen game_menu():
[...]
Code:
use game_menu(_("Preferences"), scroll="viewport"):
Exception: Too many arguments in call (expected 0, got 1).
You provide two arguments to a screen that you've defined as waiting for no arguments.
 

Tarish

New Member
Jun 26, 2018
2
0
Thank you very much. I'll take a look at that and see how can I fix what I've broken.

Thank you!