CEL/CELX Scripting Documentation

This page lists new cel/celx commands and changes in existing commands in Mobile Celestia and Celestia UWP. These commands should be available for Mobile Celestia 1.5.11, Celestia UWP 2.0.30 or later. For how to use these commands and a list of other supported commands, please refer to this wiki

CELX commands

celestia

celestia:playaudio ( int [channel], str [filename], float [starttime], float [volume], float [pan], bool [loop], bool [nopause] )

Play audio.

channel Required. Specifies the channel that'll be affected by this call.
If not given, will assume the default value of 0, You can provide any number between 0 and 7.
Any number out of this range will cause the script to fail.
filename Required. Path to the file that will be played.
If it is a relative path, then the subfolder "sounds" is searched.
starttime Specifies the start time of the audio in seconds
If not given, the default value will be 0 (start from beginning).
If a negative value is given, 0 will be used instead.
volume Specifies the initial volume of this channel.
If not given, the volume of the channel will be 1.0.
If the value given is not between 0.0 and 1.0, it will clamped to this range.
pan Specifies the initial pan for the channel.
If not given, the sound will be centered (default value of 0).
The level relationship between the left and right channels must be specified in the range from -1.0 to 1.0. The value -1.0 is only the left channel, 0.0 is centered, 1.0 is just the right channel. 
If the value given is not between -1.0 and 1.0, it will clamped to this range.
loop Specifies if the sound file will be played in looping or not.
If not given, the looping mode of the channel will false.
nopause Parameter that allows a particular sound channel to be paused or not paused on any channel when the spacebar is pressed.
Value false - allow pause by spacebar, value true - disallow.
output Whether action succeeded or not.

bool celestia:isplayingaudio ( int [channel] )

Check whether audio is being played on a channel.

channel Required. The channel for checking.
output Whether audio playing succeeded or not.

bool celestia:resumeaudio ( int [channel] )

Resume audio on a channel.

channel Required. Channel for this action.
output Whether action succeeded or not.

celestia:pauseaudio ( int [channel] )

Pause audio on a channel.

channel Required. Channel for this action.

celestia:stopaudio ( int [channel] )

Stop audio on a channel.

channel Required. Channel for this action.

bool celestia:seekaudo ( int [channel] float [time] )

Seek to a specific time in audio on a channel.

channel Required. Channel for this action.
time Required. Time to seek to in seconds.
output Whether action succeeded or not.

celestia:setaudiovolume ( int [channel] float [volume] )

Set volume on a channel.

channel Required. Channel for this action.
volume Required. New volume of the channel.
Will be clamped to between 0.0 and 1.0.
See to celestia:playaudio for information on this value.

celestia:setaudiopan ( int [channel] float [pan] )

Set pan on a channel.

channel Required. Channel for this action.
volume Required. New pan value of the channel.
Will be clamped to between -1.0 and 1.0.
See to celestia:playaudio for information on this value.

celestia:setaudioloop ( int [channel] bool [loop] )

Set loop status on a channel.

channel Required. Channel for this action.
volume Required. New loop value of the channel.
See to celestia:playaudio for information on this value.

celestia:setaudionopause ( int [channel] bool [nopause] )

Set no pause status on a channel.

channel Required. Channel for this action.
volume Required. New nopause value of the channel.
See to celestia:playaudio for information on this value.

celestia:play ( int [channel], float [volume], float [pan], int [loop], str [filename], int [nopause] )

Command for compatibility with Celestia ED for playing audio.

channel Required. Same as celestia:playaudio
volume Required. Same as celestia:playaudio
If a negative value is given and filename is not given, the volume will not be updated for this channel.
pan Same as celestia:playaudio
loop Same as celestia:playaudio
Value 1 is true, 0 is false.
If not given and filename is not given, loop will not be updated for this channel.
filename Same as celestia:playaudio
If not given, other information will be used to update this channel.
If an empty value is given, the channel will be stopped.
nopause Same as celestia:playaudio
Value 1 is true, 0 is false.

celestia:printatpixel ( str [text] float [duration] int [x] int [y] )

Print text at pixel location.

text Required. Text to print.
duration Duration for the text to be displayed in seconds.
Defaults to 1.5.
x, y Pixel location for the text to be printed.
The bottom left location of the first line of the text will be (x, y).
(0, 0) is in bottom left of the window.
Both values efault to 0.

int celestia:getscreendpi ( )

Get DPI of the window.

output DPI of the window.

celestia:setscreendpi ( int [dpi] )

Set DPI for the window.

dpi Required. New DPI value for the window.

( int, int int, int ) celestia:getsafeareainsets ( )

Get safe ares insets for the window.

output Safe area insets of the window.
Left, top, right, bottom.

celestia:setsafeareainsets ( int [left], int [top], int [right], int [bottom] )

Set safe ares insets for the window.

left, top, right, bttom Required. New safe area insets value for the window.

( int, int ) celestia:getwindowdimension ( )

Get window size.

output Size of the window.
Width, height.

float celestia:gettintsaturation ( )

Get saturation value of tinted illumination. Available on Mobile Celestia 1.5.20, Celestia UWP 2.0.36 and later.

output Saturation value of tinted illumination.
Valid range: 0 - 1.

celestia:settintsaturation ( float [tint_saturation] )

Set saturation value of tinted illumination. Available on Mobile Celestia 1.5.20, Celestia UWP 2.0.36 and later.

tint_saturation The saturation value of tinted illumination to set.
Valid range: 0 - 1.

string celestia:getlayoutdirection ( )

The text layout direction of Celestia. Available on Mobile Celestia 1.5.23, Celestia UWP 2.0.37 and later.

output Text layout direction of Celestia
Valid values are ltr or rtl.

celestia:setlayoutdirection ( string [layout_direction] )

Set the text layout direction of Celestia. Available on Mobile Celestia 1.5.23, Celestia UWP 2.0.37 and later.

layout_direction The text layout direction of Celestia to set.
Valid values are ltr or rtl.

object celestia:loadtexture ( string [path], string [addressmode], string [mipmapmode] )

Load a texture from the filesystem. On earlier version of Celestia, this method only takes one parameter, path.

path Required. Path of the texture relative to the script directory.
addressmode Available on Mobile Celestia 1.5.20, Celestia UWP 2.0.36 and later
Address mode of the texture. Available options are wrap, edgeclamp, borderclamp.
Defaults to edgeclamp.
mipmapmode Available on Mobile Celestia 1.5.20, Celestia UWP 2.0.36 and later
Mipmap mode the texture. Available options are default, none.
Defaults to default, enabling mipmapping.
output Texture object. Nil if Celestia is unable to load the texture.

font

int font:getmaxascent ( )

Get max ascent of the font.

output Max ascent of the font.

int font:getmaxdescent ( )

Get max descent of the font.

output Max descent of the font.

int font:gettextwidth ( str [text] )

Get width of a text.

text Required. Text to measure width with.
output Measured width of the text.

CEL commands

play { channel [int] volume [float] pan [float] loop [int] filename [str] nopause [int] }

Commands for playing an audio file, please see to celestia:play in CELX commands