(Formerly known as CreateTextOverlay, which is now obsolete)
static Overlay* Overlay.CreateTextual(int x, int y, int width,
FontType font, int color, string text)
Creates a screen overlay containing the text you pass at the position
specified. A screen overlay looks identical to the way speech text is
displayed in conversations, except that with this command the text stays
on the screen until either you remove it with the Remove command, or the player
goes to a different room, in which case it is automatically removed.
The X and Y parameters specify the upper-left corner of where the text
will be written. WIDTH is the width, in pixels, of the text area. FONT is
the font number from the editor to use (0 is the normal font, 1 is the speech
font). COLOR is the text color - use one of the colours from 1 to 15.
Finally, TEXT is obviously the text that gets displayed.
The function returns the Overlay, which you use later to reposition
and remove the overlay.
You can insert the value of variables into the message. For more information,
see the string formatting section.
NOTE: large overlays, in the same way as objects, can impact performance
while displayed.
NOTE: there is currently a maximum of 10 overlays displayed at any one time. Some other
commands such as Say and SayBackground create overlays internally,
so don't rely on being able to create 10 with CreateTextual.
NOTE: if the Overlay object goes out of scope, the overlay will be removed. Hence,
if you want the overlay to last on-screen outside of the script function where it
was created, the Overlay* variable declaration needs to be at the top of
the script and outside any script functions.
Example:
Overlay* myOverlay = Overlay.CreateTextual(50,80,120, Game.SpeechFont, 15,"This is a text overlay");
Wait(40);
myOverlay.Remove();
will display a 120 pixels text area with its upper left corner at coordinates 50,80
containing the string "This is a text overlay" using the speech font and white color.
It will be displayed for 1 second, then removed.
See Also: Overlay.CreateGraphical, Overlay.X,
Overlay.Y, Overlay.Remove
|