Message box yes or no

Started by Candle, Wed 21/12/2005 02:02:48

Previous topic - Next topic

Candle

Is there a command for a message box or do you need to make a gui with the yes or no buttons on it and what you want the yes or no to do?
Call the gui yes or no from a hotspot.

Candle

I have the img to show what I want:
I'm going to need some help this if anyone has a little time to help me with this.
What I want the message box to control is if you get an eyeball from the dead guy you see sitting there.
Si when you click on him you get the message box ( i will add the text to message box) It wil would be "DO you want to take the Eyeball?"so if they say yes I will add the eyeball and no they don't take it.

Akumayo

Isn't this what your looking for (probably not, considering you posted on it, but whatever, my ten cents):
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23869.0
"Power is not a means - it is an end."

Candle

Thanks Akumayo, that would work just as well I think.
I'm going to read that post now and see how to use it.
Thank you for the help.

Akumayo

#4
Actually, if you're okay with not using a GUI, I've thought up a rather nice code with keypresses:

In global script top:
Code: ags

function YesOrNo() {
Ã,  Display("Yes (y) or No (n)");
Ã,  if (IsKeyPressed(89) == 1 || IsKeyPressed(78) == 1) {
Ã,  Ã,  if (IsKeyPressed(89) == 1) {
Ã,  Ã,  Ã,  return 1;
Ã,  Ã,  }
Ã,  Ã,  if (IsKeyPressed(78) == 1) {
Ã,  Ã,  Ã,  return 0;
Ã,  Ã,  }
Ã,  }
Ã,  else {
Ã,  Ã,  Display("You have to pick one!");
Ã,  Ã,  YesOrNo();
Ã,  }
}


In global script header:
Code: ags

import function YesOrNo();


Example of use:
Code: ags

Display("Do you really want to pick up the eyeball?!");
int pickitup = YesOrNo();
if (pickitup == 1) {
Ã,  Display("You take the eyeball.");
Ã,  player.AddInventory(ieyeball);
}
else {
Ã,  Display("You leave the eyeball alone.");
}

Will display the question, and then ask the player yes or no until they press and hold 'y' or 'n', and take action based on their answer.
"Power is not a means - it is an end."

Candle

Man that works perfect .. Thanks so much for the help.

Akumayo

No problem, I'm using it in a few of my 'games' because of its simplicity.  ;D
"Power is not a means - it is an end."

SMF spam blocked by CleanTalk