Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Carles on Fri 24/02/2023 19:01:34

Title: load button [SOLVED]
Post by: Carles on Fri 24/02/2023 19:01:34
Hi,
I have a room with a load game button. In the button events I put the function:

show_restore_game_dialog

When loading the GUI into the game I get this error:

Runtime error: wrong number of parameters to exported function 'show_restore_game_dialog' (expected 0, supplied 2)

Thanks!
Title: Re: load button
Post by: eri0o on Fri 24/02/2023 19:12:47
Can you show how you are calling that function, exactly?

Spoiler
the error message reads like you are calling it show_restore_game_dialog(a, b);, but it takes no parameters.
[close]
Title: Re: load button
Post by: Carles on Fri 24/02/2023 19:18:24
I am calling the function in the button event this way:

show_restore_game_dialog

If I call the function in a room hotspot like this:

show_restore_game_dialog();

It works perfectly.
Title: Re: load button
Post by: eri0o on Fri 24/02/2023 19:24:03
ok, let's go back one step.

When you say you have a room with a button you mean that, in a room of your game, there's a GUI that is shown, and in that GUI there is a GUI control that is a Button, and in that button through the event (⚡) page in the Button properties you linked a function in the Click event.

And the function you linked is show_restore_game_dialog.

So, you can't do that, because button click takes two parameters. Just clear it up, click on hit so it generates a skeleton function on Global Script, and do the function call there.
Title: Re: load button
Post by: Carles on Fri 24/02/2023 19:28:42
Ok! Thanks, now it works :)