Entering Lua-commands directly in Celestia

All about writing scripts for Celestia in Lua and the .cel system
Topic author
Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Entering Lua-commands directly in Celestia

Post #1by Harry » 29.01.2004, 16:45

Hi,

after Marc Griffith brought up the idea to create a Lua-console to type in commands directly in Celestia, I found out that this is already possible with Celestia 1.3.2pre1 (earlier version didn't have the necessary keyboard-input for scripts).

So I have written a script which reads lines from the keyboard and executes them as Lua-scripts (or more precise as functions) when pressing Enter. You can get the script here:
http://www.h-schmidt.net/celestia/
Currently you can only type, delete (backspace) and execute the current line (Return), but this should be enough to test some Lua-commands. To see the value of something, you have to return it (the line is executed as a function, so if you type "return 1+1", the result will be 2). Variables can be used, so you can save values across different lines.

E.g.

Code: Select all

o = celestia:getobserver()
sol = celestia:find("Sol")
o:goto(sol, 10)

There is no documentation for the new scripting features (like keyboard, mutliviews, etc) yet, so if you have questions, please ask here.

Harald

marc
Posts: 426
Joined: 13.03.2002
With us: 22 years 8 months
Location: Outback Australia

Post #2by marc » 30.01.2004, 02:28

Harald, I like your webpage, how come it is not in the webring yet? :)

http://mostlyharmless.sourceforge.net/webring/index.htm

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Re: Entering Lua-commands directly in Celestia

Post #3by don » 31.01.2004, 06:39

Harry wrote:So I have written a script which reads lines from the keyboard and executes them as Lua-scripts (or more precise as functions) when pressing Enter.

VERY KEWEL! 8O

Thanks Harald! :D

-Don G.

Topic author
Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Post #4by Harry » 20.04.2004, 23:07

I've just uploaded a minor update of the lua-console script (lua-console_v1.1.celx). The new version adds the possibility to access already entered commands again. Press CTRL-P to go to the previous line, and CTRL-N to go to the next line (the latter one obviously works only if you've used CTRL-P before). I have only tested on Linux, so I don't know if these keys work ok on Windows...

Harald

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #5by don » 20.04.2004, 23:57

Works just fine in WinXP.

Thank you Harald!
-Don G.
My Celestia Scripting Resources page

Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.


Return to “Scripting”