load button [SOLVED]

Started by Carles, Fri 24/02/2023 19:01:34

Previous topic - Next topic

Carles

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!

eri0o

#1
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]

Carles

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.

eri0o

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.

Carles

Ok! Thanks, now it works :)

SMF spam blocked by CleanTalk