Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Minimi on Sun 06/07/2003 22:40:17

Title: Messages to appear at position of mouse/hotspot
Post by: Minimi on Sun 06/07/2003 22:40:17
Ok, in my adventure without character...to play with.. the messages are always shown in the middle of the screen, no matter if i'm clicking on a hotspot or object far from it! How do I program that the text will appear somewhere near the position I clicked.. and not always in the middle of the screen?
Title: Re:Messages to appear at position of mouse/hotspot
Post by: AJA on Mon 07/07/2003 21:22:28
From the manual:

QuoteDisplayAt(int x, int y, int width, string message, ...)


Identical to the "Display" function, only this allows you to define the position and size of the window where the text is displayed. The X and Y variables define the co-ordinates of the upper-left corner of the window. The WIDTH variable defines the width of the window. The height is then automatically calculated so that the message fits into the window.
Note: This is a blocking call. See the "Display" help for more information.

Example:

DisplayAt (50,50,100, "This is a message");

will display the message at coordinates 50,50 in a box 100 pixels wide.
See Also: Display, DisplayAtY

You'll probably use it like this to show it where the mouse cursor is: DisplayAt(mouse.x,mouse.y,100,"This is a message");