Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ciborium on Wed 18/04/2007 23:16:50

Title: Mouse over character
Post by: ciborium on Wed 18/04/2007 23:16:50
Why doesn't this script work?
I'm trying to get the mouse to change to talk to when over a character.
This is in my repeatedly execute:


if (Character.GetAtScreenXY(mouse.x, mouse.y) == true){
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode = eModeTalkto;
  }


Title: Re: Mouse over character
Post by: Ashen on Wed 18/04/2007 23:21:49
Read the manual (http://www.adventuregamestudio.co.uk/manual/Character.GetAtScreenXY.htm)
Quote from: Character.GetAtScreenXY
Returns the character if there is, or null if there is not. See the description of GetLocationName for more on screen co-ordinates.

The == true part of that doesn't mean anything - replace it with != null and it should work. You may also want to add a mouse.Mode != eModeTalkto check as well. Otherwise - as it's in rep_ex - the SaveCursorUntilItLeaves line will be repeated, 'saving' the mode as eModeTalkto.
Title: Re: Mouse over character
Post by: ciborium on Thu 19/04/2007 02:11:49
Thanks, I had used the != null in some other places, I just wasn't thinking clearly.

So far it's working as-is, except != null correction.