Need Help With GUI buttons

Started by Yo Mama!, Tue 03/06/2003 19:03:20

Previous topic - Next topic

Yo Mama!

I need more help with my game  :'(. How do I make GUI buttons do stuff? I want a prompt to ask the player if they want to get rid off all their points, and I don't know how to make the buttons do anything. I want the yes button to make the score 0, and the no button to keep it the same. I tried to find it in the Help file, but all I could find was vague instructions.

Proskrito

QuoteI tried to find it in the Help file, but all I could find was vague instructions.
well, the manual doesn't have a solution for every single scripting problem :-\, the"vague instructions" you mention is what you have to know in order to script things :). They wont tell you how to make a button that makes the score 0, it´ll just tell how to assign actions to a button, how the functions works, and so on. Then, it is you the one who has to mix everything. :D
Well, asking to your question, i think it would be something like:
first, you have to set the "left click" property of your buttons to "run script" (in the floating window in the gui editor)
next, if your interface name is "CLEARSCORE", the button that clears the score is #0, and the one that keeps it is #1, then you shoud put in the "interface_click()" function:
function interface_click(int interface, int button) {
 if (interface == CLEARSCORE){
    if (button == 0) {
       GiveScore(-game.score); // <- im not sure about this !
       GUIOff(CLEARSCORE);
    }
    else if (button == 1){
       GUIOff(CLEARSCORE);
    }
 }
...
}// end of interface_click() function

hope it helps

SMF spam blocked by CleanTalk