A small CELX function library
Posted: 18.04.2005, 12:46
Here are some wrapper functions for providing CEL functionality which doesn't exists in CELX.
Nothing special, but you may add this to your personal CELX function library, and use it as convenient replacement functions when converting CEL-scripts to CELX scripts.
Some more for your CELX function library:
maxim
Nothing special, but you may add this to your personal CELX function library, and use it as convenient replacement functions when converting CEL-scripts to CELX scripts.
Code: Select all
--*---------------------------------------------*----------
--* CELX replacement for CEL 'orbit()' function *----------
--*---------------------------------------------*----------
function orbit(axis,rate,duration)
script = celestia:createcelscript(string.format("{ orbit {axis %s rate %1.1f duration %1.1f} }",axis,rate,duration))
while script:tick(0.001) do
wait (0)
end
end
Code: Select all
--*-----------------------------------------------*----------
--* CELX replacement for CEL 'gotoloc()' function *----------
--*-----------------------------------------------*----------
function gotoloc(x,y,z,xrot,yrot,zrot,time)
script = celestia:createcelscript(string.format("{ gotoloc {time %1.1f position [%i %i %i] xrot %i yrot %i zrot %i} }",time,x,y,z,xrot,yrot,zrot))
while script:tick(0.001) do
wait (0)
end
end
Some more for your CELX function library:
Code: Select all
--*--------------------------------------------------------------------------------*--
--* 'dimUpDown()' let's you increase or decrease the actual ambient light setting, *--
--* so that you can easily show features that are hidden in (planetary) shadows. *--
--* *--
--* start The dimming start value. Normaly that should be retrieved via *--
--* celestia:getambient() before. Possible values are between 0 and 1 *--
--* *--
--* stop The dimming end value. Should be greater than 'start' for dimming *--
--* up and less than 'start' for dimming down. Possible values are *--
--* between 0 and 1 *--
--* *--
--* step The increase/decrease amount of ambient light in each iterating step. *--
--* Should be positive for dimming up and negative for dimming down. *--
--* '0.02' is a good mean value. *--
--* *--
--* time The waiting time between each iteration step. Greater values make *--
--* dimming slower. Smaller values make dimming faster. '0.01' is a good *--
--* mean value *--
--*--------------------------------------------------------------------------------*--
function dimUpDown(start, stop, step, time)
for i = start,stop,step do
celestia:setambient (i)
wait (time)
end
wait (0.4)
end
maxim