Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Joe on Mon 03/07/2006 23:47:11

Title: Functions only for characters
Post by: Joe on Mon 03/07/2006 23:47:11
Hello all AGS users.

On my last post I said that i wanted to add to my game an interface command which displayes Use...with, Give...to, etc.

Well, I finally got it; but now i want to know if i can use the command "Talk to" or "Give to" only for characters. Because if I click on the buttom "TALK TO" and I move the mose over a tree it appears "Talk to tree" :P... And it is quite stupid...

So if there is a way to use a code which makes the name appear onle when the mouse moves over a character, please let me know.

Thanks. ;)
Title: Re: Functions only for characters
Post by: Ashen on Tue 04/07/2006 00:02:07
How are you handling the displaying? Have you done it something like I suggested in this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=27253.0)?
If so, you can add a check of GetLocationType (http://www.adventuregamestudio.co.uk/manual/GetLocationType.htm), so it only updates over characters, e.g. (untested, and assumes you're using the status String):

if (mouse.Mode == eModeTalkto) {
  if (GetLocatonType(mouse.x, mouse.y) == eLocationCharacter)
    status = "Talk to @overhotspot@";
  else
    status = "Talk to";
}


Will display Talk to (NAME) if you're over a character, or just Talk to otherwise (you could set it to be blank, if you'd rather).

If you're doing it a different way, someting similar would probably still work.
Title: Re: Functions only for characters
Post by: Joe on Tue 04/07/2006 10:49:52
Thanks Ashen, It works perfectly.
My dreams have been reached. :P ;)