Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Elessar on Thu 21/06/2007 22:28:57

Title: Icon Descriptions with ? Cursor [SOLVED]
Post by: Elessar on Thu 21/06/2007 22:28:57
In the Sierra games, you could click the ? button on the icon bar, and the cursor would change to a ?. Then you could click on the different buttons and it would tell you what they were. I'm trying to implement the same thing, and here is what I am trying (unsuccessfully) to figure out:

Oh, and the Gui is on Mouse YPos. I tried to do it on Popup Modal, but then I was into code over my head. However, if that is the only way, I guess I'll have to stick to it...
Title: Re: Icon Descriptions with ? Cursor
Post by: Ashen on Thu 21/06/2007 22:45:32
1 I don't think is possible using YPos-type GUI (the coded behaviour is for them to switch off when clicked). You'll need to figure out how to code it for a Popup Modal GUI. It's not that hard, and I'm pretty sure there's more than one thread explaining how it works. Where were you going wrong?

2 can either be done using the 'Set cursor mode' option for the Button's 'Left Click' porperty, or chose 'Run script' and code it. I'd recommend using 'Run script', and changing any other Mode setting buttons you've got as well, because:

3 is easiest for Buttons that have a script function. Just add a condition checking the mouse.Mode and run accordingly, e.g.:


#sectionstart btnIconInv_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnIconInv_Click(GUIControl *control, MouseButton button) {
  if (mouse.Mode == eModeAbout) Display("Opens your Inventory .");
  else show_inventory_window();
}
#sectionend btnIconInv_Click  // DO NOT EDIT OR REMOVE THIS LINE


And you'll obviously need something to change out of eModeAbout when you're done (e.g. clicking the '?' button again, or when you close the GUI).
Title: Re: Icon Descriptions with ? Cursor
Post by: Elessar on Thu 21/06/2007 23:08:52
Quote from: Ashen on Thu 21/06/2007 22:45:321 I don't think is possible using YPos-type GUI (the coded behaviour is for them to switch off when clicked). You'll need to figure out how to code it for a Popup Modal GUI. It's not that hard, and I'm pretty sure there's more than one thread explaining how it works. Where were you going wrong?

Well, with your help I've figured most of it out. The major thing that is still not working is that if I open another gui, (say the inventory) if I move my cursor to the top of the screen, the icon bar still appears. Now I'm pretty sure that if I hard-code it so that it checks every other gui before it opens, I can prevent this. Is there a more efficient way, or do I have to check every one?
Title: Re: Icon Descriptions with ? Cursor
Post by: Khris on Fri 22/06/2007 00:03:20
You can cycle through the GUIs using the gui[] array.

function openguis() {
  int og=0;
  int i=0;
  while(i<Game.GUICount) {
    if (gui[i].Visible && i!=1) og++;   // exclude gui[1] = Iconbar
    i++;
  }
  return og;
}