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

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

set[edit]

set { name <string> value <valuenumber> }

-- Or --

set { name <string> value <valuestring> }

Set one of the items listed below to the value specified in the value argument.

Arguments:

name <string>
No default. Must be one of the following values:
  • MinOrbitSize
    This value is used when Celestia's render orbits option is turned on.
    In general, when an object is very distant its orbit path will not be shown. MinOrbitSize is the minimum radius (in pixels) which the orbit path must cover before Celestia will draw it.
  • AmbientLightLevel
    Equivalent to the setambientlight { brightness <valuenumber> } command.
    Set brightness level of Ambient Light to the specified <valuenumber>. Must be within the 0.0 (min) to 1.0 (max) range. Default is 0.
    Values specified outside the valid range are adjusted to the nearest valid value.
    For realism, this should be set to 0.0. Setting it to 1.0 will cause the side of a planet facing away from the Sun to appear as bright as the lit side.
  • FOV
    Field of View. Celestia computes this value relative to the size of the display window, in pixels.
  • StarDistanceLimit
    The furthest distance at which Celestia will display stars.
    The default value is 1,000,000, however, as of version 1.3.1, Celestia only uses a distance out to 16,000 light years.
value <valuenumber>
The number value you want to assign to the name <string> parameter. Default is 0.0.

-- OR --

Arguments:

name <string>
No default. Must be one of the following values:
  • StarStyle
    This allows you to set how Celestia displays stars on the screen.
    The StarStyle value must be one of the following:
    • Fuzzypoints
    • Points
    • scaleddiscs
value <valuestring>
The string value you want to assign to the name <string> parameter. Default is "".


CELX equivalents:

Based on five different celestia methods.

  • Set the minimum size of an orbit to be rendered.
    The given <valuenumber> is the minimum size of an orbit in pixels.
celestia:setminorbitsize( <valuenumber> )
  • Set the level of ambient light.
    The given <valuenumber> is the new level of ambient light and must be between 0 and 1.
celestia:setambient( <valuenumber> )
  • Set the FOV (Field Of View) for this observer.
    Convert <valuenumber> from degrees in radians by multiplying <valuenumber> with math.pi (= 3.14159265) and divide by 180 and store in "fov_radians".
    The Lua math.rad( <valuenumber> ) function can also be used for this.
    Then get observer instance of the active view and set the FOV.
fov_radians = math.rad( <valuenumber> )
obs = celestia:getobserver()
obs:setfov(fov_radians)
  • Set the maximum distance of stars to be rendered.
    The given <valuenumber> is the maximum distance.
celestia:setstardistancelimit( <valuenumber> )
  • Set the rendering style for stars.
    The given <valuestring> must be one of "fuzzy", "point", "disc".
celestia:setstarstyle( <valuestring> )

Example:

CEL:

set { name "MinOrbitSize" value 3 }
set { name "AmbientLightLevel" value 0.15 }           setambientlight { brightness 0.15 } 
set { name "FOV" value 35.5 }
set { name "StarDistanceLimit" value 2000000 }
set { name "StarStyle" value "points" }

CELX with 5 different celestia methods:

celestia:setminorbitsize(3)
celestia:setambient(0.15)
celestia:getobserver():setfov(math.rad(35.5))
celestia:setstardistancelimit(2000000)
celestia:setstarstyle("points")


Back to CEL command index