Celestia/Celx Scripting/CELX Lua Methods/CEL command print

From Wikibooks, open books for an open world
Jump to navigation Jump to search

print[edit | edit source]

print { text <textstring> origin <originstring> duration <duration> row <rownumber> column <columnnumber> }

The print command allows you to display text in Celestia's display window, defining where the text is positioned and for how long it should be displayed.

You must follow the print command with a wait command of a duration equal to or greater than the specified <duration> is required.

Beware: If the text you want printed is longer than the width of the user's window, it will run off the right edge of the window.

Arguments:

text <textstring>
The text you want displayed, surrounded by quote marks. No default.
You may also use "\n" to generate a CR/LF at any position within the text string.
origin <originstring>
Starting position of the first character of your text. Default is "bottomleft".
Must be one of the following values:
  • bottom
  • bottomleft
  • bottomright
  • center
  • left
  • right
  • top
  • topleft
  • topright
duration <duration>
Number of seconds to display the text message. Default is 1.0.
row <rownumber>
Defines the starting display line (vertical position), offset from the <originstring>, on which the text should be displayed. Default is 0.
Positive values move the starting row down, while negative values move the starting row up ("+" sign is not necessary).
column <columnnumber>
The column number (horizontal position) where the first character of the text should be displayed. Default is 0.
Column 0 (zero) is the left edge of the display screen.


CELX equivalent-1:

Based on the celestia:flash() method.

Note: This method has no ability to position the text on a specific position on the screen.
The celestia:print() method should be used instead (see CELX equivalent-2)

  • Print text on screen, similar to print.
    <textstring> A string containing the message to be printed.
    The string can contain newlines "\n" to break lines, or many special characters encoded in UTF-8.
    <duration> is the number of seconds the text is shown. Default is 5.0 sec.
celestia:flash( <textstring>, <duration> )


CELX equivalent-2:

Based on the celestia:print() method.

  • Print text on screen. Celestia supports UTF-8 encoded text strings for showing non-ASCII characters.
    <textstring> is a string containing the message to be printed.
    The string can contain newlines "\n" to break lines, or many special characters encoded in UTF-8.
    <duration> is the number of seconds the text is shown. Default is 5.0 sec.
    <horig> is the horizontal origin of text: -1 is left, 0 center, 1 right.
    <vorig> is the vertical origin of text, -1 is bottom, 0 center, 1 top.
    <hoffset> is the horizontal offset relative to the horizontal origin.
    <voffset> is the vertical offset relative to the vertical origin.
celestia:print( <textstring>, <duration>, <horig>, <vorig>, <hoffset>, <voffset> )

Example:
This example prints the message "Hello Universe!" three rows up from the bottom of the display screen, starting two columns from the left edge:

CEL:

print { text "Hello Universe!" row -3 column 2 }
wait  { duration 5 }

CELX with the celestia:flash() method:

celestia:flash("Hello Universe!", 5.0)
wait(5.0)

CELX with the celestia:print() method:

celestia:print( "Hello Universe!", 5.0, -1, -1, 3, 2)
wait(5.0)


Back to CEL command index