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

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

setsurface[edit | edit source]

setsurface { name <string> }

Allows you to define an alternate surface texture for the currently selected object. An alternate texture must first be defined in the solarsys.ssc file for the object in question.

For example, if you want to create an alternate surface texture for Earth, called "Earth-2", and it's related texture filename is earth2.jpg, you would add the following entry to the solarsys.ssc file, after the closing brace for the ' "Earth" "Sol" ' entry:

AltSurface "Earth-2" "Sol/Earth"
{Texture "earth2.jpg"}

Arguments:

name <string>
Defines the name of the alternate texture defined in the AltSurface entry of the solarsys.ssc file, not the name of the texture file itself. No default.


CELX equivalent:

Based on the observer:setsurface() method.

  • Get observer instance of the active view and set the currently used surface.
    <string> is the name of the surface to be used.
obs = celestia:getobserver()
obs:setsurface( <string> )

Example:
To use the built-in Celestia "limit of knowledge" textures, instead of the interpretive ones, use:

CEL:

setsurface { name "limit of knowledge" }

CELX: with the observer:setsurface() method.

obs = celestia:getobserver()
obs:setsurface("limit of knowledge")

Example:
To use the "Earth-2" texture, as mentioned above, use:

CEL:

setsurface { name "Earth-2" }

CELX: with the observer:setsurface() method.

obs = celestia:getobserver()
obs:setsurface("Earth-2")


Back to CEL command index