Icon Descriptions with ? Cursor [SOLVED]

Started by Elessar, Thu 21/06/2007 22:28:57

Previous topic - Next topic

Elessar

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:


  • When I click on the button, I want the icon bar to stay visible until I click the button again
  • I want the cursor to be set to eModeAbout
  • When I click on the buttons, I just want a description of the button, not to actually do what it normally does (e.g. change the cursor) (I could probably get this part working if I could figure out the other two)
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...

Ashen

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.:

Code: ags

#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).
I know what you're thinking ... Don't think that.

Elessar

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?

Khris

You can cycle through the GUIs using the gui[] array.

Code: ags
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;
}

SMF spam blocked by CleanTalk