Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: SupSuper on Tue 01/08/2006 17:29:13

Title: MODULE: Confirmation GUI v1.00
Post by: SupSuper on Tue 01/08/2006 17:29:13
Well nothing better to start a new month than a new project, and since I don't have the staff to make an adventure game, might as well help out the ones I can with a module. Made with AGS 2.71, as always.

Ok, so what's this all about? Well, sick of creating a new GUI everytime you need to show the player a message or a Yes/No dialog? Want to easily create death windows like the ones in Sierra without lifting a finger? Well then, this is the module for you!

I know SSH has made a module with the same purpose, DialogBox (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26842), but I started this before he put up his, and I wasn't just gonna dump my work. In any case, this works very differently from his module.

But enough chit-chat. Time to show you some examples of what this module can do:

(http://i6.photobucket.com/albums/y237/supsuper/AGS/confirm1.png) (http://i6.photobucket.com/albums/y237/supsuper/AGS/confirm2.png)
(http://i6.photobucket.com/albums/y237/supsuper/AGS/confirm3.png) (http://i6.photobucket.com/albums/y237/supsuper/AGS/confirm4.png)

See all of these windows? These were all created just by calling one function. The module reuses the same GUI and does all the positioning, sizing and changing the controls as necessary to fit your parameters, so that in the end you get a nice and neat dialog just by telling it what to display on it.

The module was initially just one function, but to keep with the same system as every other module, I decided to add the Hide() one just so it would seem more complete.

Download here (http://supsuper.wurmz.net/stuff/confirm_fix.zip)

For assigning actions for the buttons, you'll probably have to use a global variable.
Example:


int i;

{
  i = 1;
  Confirm.Show(...);
}

(...)

{
i = 2;
Confirm.Show(.....);
}

function Confirm_btnYes_Click(GUIControl *control, MouseButton button) {
  Confirm.Hide();
  if (i == 1) {
    // do stuff for left-button in dialog 1
  } else if (i == 2) {
    // do stuff for left-button in dialog 2
  }
    // etc.
}

function Confirm_btnNo_Click(GUIControl *control, MouseButton button) {
  Confirm.Hide();
  if (i == 1) {
    // do stuff for right-button in dialog 1
  } else if (i == 2) {
    // do stuff for right-button in dialog 2
  }
    // etc.
}


Got it? No? Well, I can include a sample game if needed.

Anyways, anything else should be explained in the rather crummy documentation. Since AGS doesn't support optional strings, you'll have to use a blank string "" if you wanna leave something out like the titlebar.

Feel free to intensely bug-test this, because after coding it, I didn't have much patient to do it myself. Heck, originally I didn't know about the GetTextWidth and GetTextHeight functions which lead me to try and write my own and nearly kill myself. :P

Umm... enjoy. :)
Title: Re: MODULE: Confirmation GUI v1.00
Post by: jasonjkay on Wed 02/08/2006 13:14:50
Sounds great, it really looks like you have a load of gui's and yet it's just one. Im definately putting this on my site.
Title: Re: MODULE: Confirmation GUI v1.00
Post by: strazer on Wed 02/08/2006 14:01:42
I think it would be better to add the name of its GUI to the GUI control name, as suggested in our script module guidelines (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26283) (i.e. btnYes -> CONFIRM_btnYes).
btnYes and btnNo are very generic names that could otherwise easily conflict with names of GUI controls already in use by the user.
Title: Re: MODULE: Confirmation GUI v1.00
Post by: SupSuper on Wed 02/08/2006 17:05:46
Good point, changed.
Title: Re: MODULE: Confirmation GUI v1.00
Post by: TerranRich on Thu 09/07/2009 01:44:55
Is there a re-upload for this? Or perhaps an updated version for AGS 3.0 and up?

Or... maybe I can figure out how this was done, and release my own version. ;)
Title: Re: MODULE: Confirmation GUI v1.00
Post by: SupSuper on Thu 09/07/2009 02:00:51
I've reuploaded it for you.

It should still work with AGS 3.0, I don't think anything drastic changed regarding GUIs, but I haven't tried it myself. If it doesn't I can upgrade it.