GUI scripting question

Started by Retro Wolf, Thu 23/04/2009 13:48:23

Previous topic - Next topic

Retro Wolf

Hello everyone! I want to make it so that every time any character speaks, rather than the GUIs becoming unclickable, i want them to dissappear, then reappear after the conversation has ended. I have a solution but it is long winded:

function oCup_Look()
{
  gActionBar.Visible = false; // Doing this before every conversation?!!
  gInventory.Visible = false;
  cEgo.Say("A hot cup of coffee, a wolf's worst enemy!");
  gActionBar.Visible = true;  // Doing this after every conversation?!!
}

With this method, i would have to retype the code for every time a character speaks, which would be annoying!. Since there seems to already be an instruction for making the GUI unclickable, there should be an ideal place to put the code, but i have yet to find it.

Any help would be greatly appreciated! And i would like to thank AGS for the excellent software!

Hudders

IIRC there's a property you can set in the game settings window to do exactly as you want.

thezombiecow

#2
If not, you could slap something like this in the Global Script's repeatedly_execute_always function:

Quoteif (cEgo.View == cEgo.SpeechView)
{
  gActionBar.Visible = false;
}
else
{
  gActionBar.Visible = true;
}

What that says is 'if the character's set to speech view, hide the action bar'.

Bear in mind though that you'll have to account for every possible situation in-game, so if you have more than one speech view, or want it to not happen sometimes, you'll need to slap some extra conditions in... so in conversations the ActionBar will presumably popup if you're playing any animations, or while the player's choosing a response. For those though, you could slap a gActionBar.Visible = false/ true by hand to cover it.

:)

Retro Wolf

Thankyou very much! The solution was so simple, i feel like an idiot lol.

Trent R

zombiecow's works great, another way you could do it:

Code: ags
function Speak (this Character*, const string message) {
  gActionBar.Visible=false;
  this.Say(message);
  gActionBar.Visible=true;
}


And then replace character.Speak with all of your character.Say calls.


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Khris

You're looking for:
General Settings -> Visual -> When player interface is disabled, GUIs should -> Be hidden

SMF spam blocked by CleanTalk