跳至內容

Celestia/Celx 指令碼/CELX Lua 方法/CEL 命令 print

來自華夏公益教科書,自由的教科書

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

print 命令允許您在 Celestia 的顯示視窗中顯示文字,定義文字的位置以及顯示時長。

您必須在 print 命令之後使用一個 wait 命令,其持續時間等於或大於指定的 <duration>。

注意:如果要列印的文字長度超過使用者視窗的寬度,則文字將超出視窗的右側邊緣。

引數

text <textstring>
您要顯示的文字,用引號括起來。無預設值。
您也可以使用 "\n" 在文字字串的任何位置生成 CR/LF。
origin <originstring>
文字第一個字元的起始位置。預設為 "bottomleft"。
必須是以下值之一
  • bottom
  • bottomleft
  • bottomright
  • center
  • left
  • right
  • top
  • topleft
  • topright
duration <duration>
顯示文字訊息的秒數。預設為 1.0。
row <rownumber>
定義文字應顯示的起始顯示行(垂直位置),從 <originstring> 偏移。預設為 0。
正值將起始行向下移動,而負值將起始行向上移動(“+”符號不是必需的)。
column <columnnumber>
文字第一個字元應顯示的列號(水平位置)。預設為 0。
第 0 列(零)是顯示螢幕的左邊緣。


CELX 等效項-1

基於 celestia:flash() 方法。

注意:此方法無法將文字定位到螢幕上的特定位置。
應改用 celestia:print() 方法(參見CELX 等效項-2

  • 在螢幕上列印文字,類似於 print。
    <textstring> 包含要列印的訊息的字串。
    該字串可以包含換行符 "\n" 來換行,或許多以 UTF-8 編碼的特殊字元。
    <duration> 是文字顯示的秒數。預設為 5.0 秒。
celestia:flash( <textstring>, <duration> )


CELX 等效項-2

基於 celestia:print() 方法。

  • 在螢幕上列印文字。Celestia 支援 UTF-8 編碼的文字字串,用於顯示非 ASCII 字元。
    <textstring> 是一個包含要列印的訊息的字串。
    該字串可以包含換行符 "\n" 來換行,或許多以 UTF-8 編碼的特殊字元。
    <duration> 是文字顯示的秒數。預設為 5.0 秒。
    <horig> 是文字的水平原點:-1 是左,0 是中心,1 是右
    <vorig> 是文字的垂直原點,-1 是底部,0 是中心,1 是頂部
    <hoffset> 是相對於水平原點的水平偏移量。
    <voffset> 是相對於垂直原點的垂直偏移量。
celestia:print( <textstring>, <duration>, <horig>, <vorig>, <hoffset>, <voffset> )

示例
此示例列印訊息 "Hello Universe!",該訊息位於顯示螢幕底部的上方三行,從左側邊緣開始的兩列

CEL

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

CELX 使用 celestia:flash() 方法

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

CELX 使用 celestia:print() 方法

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


返回 CEL 命令索引

華夏公益教科書