Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: arrtisste36 on Mon 12/01/2009 18:36:03

Title: Setting up an interface
Post by: arrtisste36 on Mon 12/01/2009 18:36:03
I'm bad at figuring out scripting commands myself, so bear with me.  :-\

I don't like the basic interface that AGS comes with.  I prefer an interface in which the left mouse button serves as "Look at" or "Walk to" if there's nothing to look at.  Right click to interact with something.  I also want to have a GUI at the top that gives a description of what you're doing.  Like, if I mouse over a book, it would say "Look at book."  How would I go about incorporating both of these ideas into a game?
Title: Re: Setting up an interface
Post by: Khris on Mon 12/01/2009 18:58:06
Personally, I'd just display "book", since a right-click will interact with it.
Just create a label on a GUI, make the GUI use background and border color 0, and set the label's text to "@OVER_HOTSPOT@" (not sure about the exact spelling of the token, look it up if it doesn't work).

Then find the on_mouse_click function in the global script, and change the left and right click behavior as follows:

  if (button == eMouseLeft) {
    int mm;
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) mm = eModeWalkto;
    else mm = eModeLook;
    ProcessClick(mouse.x, mouse.y, mm);
  }
  else if (button == eMouseRight) {
    ProcessClick(mouse.x, mouse.y, eModeInteract);
  }
Title: Re: Setting up an interface
Post by: ALPHATT on Mon 12/01/2009 19:54:33
I'd suggest leftmb(walk&interact), rightmb(look)

this method is more common when using lmb/rmb instead of different icons.
Title: Re: Setting up an interface
Post by: arrtisste36 on Mon 12/01/2009 20:41:06
Thank you! ;D
Title: Re: Setting up an interface
Post by: Fritzi on Wed 14/01/2009 06:48:55
(1) It's eModeLookat, not eModeLook.
(2) With the code above, you loose the ability to talk to players, I'd suggest the scheme Leftclick = walk/lookat, Rightclick = talk/interact.


  else if (button == eMouseLeft) {
    int mm;
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) mm = eModeWalkto;
    else mm = eModeLookat;
    ProcessClick(mouse.x, mouse.y, mm);
  }
  else if (button == eMouseRight) {
    int nm;
    if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter) nm= eModeTalkto;
    else nm=eModeInteract;
    ProcessClick(mouse.x, mouse.y, nm);
  }
Title: Re: Setting up an interface
Post by: Khris on Wed 14/01/2009 10:19:01
They aren't listed in the manual and I was too lazy to open AGS to verify two letters ;)
More importantly though,
what's stopping you from putting talk to-code into "interact with character"?
Title: Re: Setting up an interface
Post by: arrtisste36 on Wed 14/01/2009 23:26:26
Yeah, I was planning for "Talk To" to be included in interact.  Sorry if I didn't make that clear.  Thanks for the help everyone!