Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mouth for war on Tue 23/11/2010 16:23:35

Title: problems with cursor [Solved]
Post by: Mouth for war on Tue 23/11/2010 16:23:35
GRRR I'm going nuts over this. On the introscreen I have disabled the interface because that shouldn't be visible during the credits etc. When the "NEW GAME" and "LOAD GAME" buttons appear, I'm getting problems. This is the script

function room_Load()
{
DisableInterface();
mouse.Visible =false;
gIconbar.Visible =false;
gInventory.Visible =false;
gPanel.Visible =false;
gRestartYN.Visible =false;
gSaveGame.Visible =false;
gRestoreGame.Visible =false;
}

No problems there. This is after the NEW GAME and LOAD GAME buttons appears

EnableInterface();
mouse.Visible =true;
mouse.UseModeGraphic(eModeInteract);
mouse.EnableMode(eModeInteract);

I also have the function for the loadbutton

function oload_Interact()
{
gRestoreGame.Visible =true;
RestoreGameDialog ();
}

I only want the Interact icon to be visible but It's not enabled...can't click on Load game or New game...Unless I set gIconbar to
gIconbar.Visible =true; but if I do that the entire iconbar is visible with all icons etc. I only want the Interact icon to be visible and enabled...Is that possible somehow?
thanks
Title: Re: problems with cursor
Post by: tzachs on Tue 23/11/2010 16:45:12
In the same manner you can make gIconBar visible and not visible (and enabled or not), you can do the same thing to each ones of the buttons in gIconBar (you can get their names if you double click the gui in the designer and look at the combo box in the properties window).

You basically need to make gIconBar and bInteract (or however its called) visible, and make all other buttons (bLookAt, bTalk, etc) not visible.
Title: Re: problems with cursor
Post by: Mouth for war on Tue 23/11/2010 16:53:55
the problem is that the Interact on the giconbar is a verb and when you press that verb the mouse changes into the interact image. I only want that interact image visible and not the iconbar at all.
Title: Re: problems with cursor
Post by: Khris on Tue 23/11/2010 18:16:14
First of all, note that all e.g.
  gRestoreGame.Visible =false;
actually does is turn off the GUI if it is visible. However, it looks as if you're trying to prevent those GUIs from showing. (Having all those commands in room_Load doesn't make any sense otherwise).

Say you still want F5 to bring up the save game dialog, just not in the menu, only during the game. What you do is put a check for the current room in on_key_press:

function on_key_press(int keycode) {

  // shortcut keys that are supposed to work always:
  if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp");  // F12

  if (player.Room == 1) return;   // exit the function if player is in menu room

  // rest of shortcuts, supposed to work only during game
...
}


This example disables all key commands except F12 in the menu screen.


On to your problem:

Why would you want the Interact Icon to be visible? Is the player supposed to be able to change the mouse mode while at the menu screen?

I don't know what modes you have enabled; my guess is that while you're changing the appearance of the mouse cursor to interact, the mode is still eModeWalkto. Naturally, this won't trigger oload_Interact().

Instead of
  mouse.UseModeGraphic(eModeInteract);
  mouse.EnableMode(eModeInteract);


use this:
  mouse.EnableMode(eModeInteract);
  mouse.mode = eModeInteract;



No offense, you seem to have what Germans call "dangerous half knowledge" when it comes to scripting. It looks like you're making simple things unnecessarily complicated and messy. The best way to go about solving this would be you telling us what the player's supposed to see when they play the game.
Title: Re: problems with cursor
Post by: Mouth for war on Tue 23/11/2010 19:10:48
Thanks for the answers...but I did a little work around and got it working the way I want :)
and yeah my scripting knowledge is limited but I'm learning :D