Problems with QuitGame(0): why doesn't work?

Started by Clarabella, Mon 18/02/2008 19:08:34

Previous topic - Next topic

Clarabella

Ok, I know, you are going to shoot me for such a stupid question... but I search for an answer in the forum and I could't find anything!

So, here's my problem. I use AGS 3.0, and I just made my own personal Quit GUI and it just doesn't work, but I can't understand why: it seems to me that I didn't make mistakes. Here's the code I used:

function btnIconExit_Click(GUIControl *control, MouseButton button) {
 
  GuiQuit.Visible= true;
  gIconbar.Visible = false;
}

function ButtonLascia_OnClick(GUIControl *control, MouseButton button)
{
  QuitGame(0);
}

function ButtonGioca_OnClick(GUIControl *control, MouseButton button)
{
  GuiQuit.Visible = false;
  gIconbar.Visible = true;
}

ButtonGioca (to go on playing) works, it returns to the game.
ButtonLascia (to quit) doesn't work, doesn't happen anything: why???
Thanks everyone for help!

---

PS: sorry for my not very good english... I'm Italian!

Ghost

#1
If you have just written that code in your global script, you still need to link it to the buttons.
While in the GUI editor, click on a button and then on the properties button in the small bottom right area. There, click on the "on_click" event, and you should be fine- AGS will then create a "stub" for the interaction, and there you'll rewrite the code. (Could be that this isn't necessary and AGS will merely link to the code blocks you already write- I have never done it this way round ;) )

Basically, you always need to do that: Create hotspot, button, character etc, and "create" the click action. Then write the script code into the stub AGS creates for you.

Clarabella

Yes! You're right!
I knew it would be an extremely easy and stupid answer (for an extremely stupid question)...

Now it works: thank you very much!
Bye!

SMF spam blocked by CleanTalk