Error trying to load save/load/preferences screen from custom menu

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Tarish
Newbie
Posts: 3
Joined: Thu Jun 20, 2019 2:30 pm
Contact:

Error trying to load save/load/preferences screen from custom menu

#1 Post by Tarish »

Hi there.

I'm trying to make a custom game menu with imagebuttons, following that tutorial I found here:
viewtopic.php?f=51&t=22394#p283224

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: Select all

$ _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:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game 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.

Edit: Things I've tried and still give error:

Code: Select all

screen game_menu:
(no brackets)

Code: Select all

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)
Last edited by Tarish on Thu Jun 20, 2019 3:59 pm, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Error trying to load save/load/preferences screen from custom menu

#2 Post by Imperf3kt »

I'm not sure but you have the actions inside a list.
Try removing the square brackets and see if it helps.

Code: Select all

action ShowMenu("load")
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Tarish
Newbie
Posts: 3
Joined: Thu Jun 20, 2019 2:30 pm
Contact:

Re: Error trying to load save/load/preferences screen from custom menu

#3 Post by Tarish »

Imperf3kt wrote: Thu Jun 20, 2019 3:14 pm I'm not sure but you have the actions inside a list.
Try removing the square brackets and see if it helps.

Code: Select all

action ShowMenu("load")
I've tried it already, but it didn't work, either. I'll edit the post with the things I've already tried.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Error trying to load save/load/preferences screen from custom menu

#4 Post by Alex »

Well, this is Sparta the GUI system, and you kind of broke it...
Check the original screens.rpy file.
Preferences screen uses game menu screen with some arguments, so game menu must have these arguments (they are placed in bracets)

Code: Select all

screen game_menu(title, scroll=None, yinitial=0.0):
In your code there are no arguments for game menu screen.
So, either add these arguments for the game menu screen or change/delete the line in preferences screen (and other screens)

Code: Select all

use game_menu(_("Preferences"), scroll="viewport"):

Tarish
Newbie
Posts: 3
Joined: Thu Jun 20, 2019 2:30 pm
Contact:

Re: Error trying to load save/load/preferences screen from custom menu

#5 Post by Tarish »

Alex wrote: Thu Jun 20, 2019 6:23 pm Well, this is Sparta the GUI system, and you kind of broke it...
That's the actual story of my life :(

Thank you very much, I'll take a look at it, and see how I can fix everything. I was getting crazy trying to find the cause of the error, your answers have enlightened me.

Thank you!

Post Reply

Who is online

Users browsing this forum: LegsWild