Page 1 of 1

"Diary" script help requested

Posted: 01.12.2011, 20:17
by selden
Gentle folk,

A few days ago, I received an email message asking if a Diary addon might be available for Celestia, similar to what was described in a 4th season episode of NCIS. I've managed to implement it for Windows, but I don't have a Mac or Linux system to test it on.

Diary editing is provided in the Addon by a Lua script which runs a text editor and opens a file. Unfortunately, different editors and different commands need to be used under the different operating systems.

Below is a CelX script which implements the necessary functionality under Windows. Although this script is the bare minimum, the entire Addon is more elaborate, including a book that you can goto and unlock.

Code: Select all

celestia:requestsystemaccess()
wait(0)
status = os.execute("start notepad my_diary.txt")


I think an equivalent script for Linux is

Code: Select all

celestia:requestsystemaccess()
wait(0)
status = os.execute("emacs my_diary.txt &")


I would greatly appreciate it if people could test these .celx scripts and let me know if they work. Also, if a Mac user could suggest (and try) an alternative to emacs, it'd help a lot.

Under Windows (after Celestia starts), you'll see a brief flicker as a CMD window opens briefly and then closes. Notepad should then open, asking if you want to create the file "my_diary.txt".

Thanks for whatever help people can provide.

Re: "Diary" script help requested

Posted: 02.12.2011, 07:07
by John Van Vliet
--- edit ---

Re: "Diary" script help requested

Posted: 02.12.2011, 11:54
by selden
john Van Vliet wrote:when i saw that ncis episode i though the same thing
lua

but it is a lot of work for something in plain test and not encrypted
I intend to let the user change the editing command if something more sophisticated is desired.

emacs is not a default install on most systems
popular - yes
Good point. I'll change it to vi.

As i recall that episode once a "non real"( made up name) star was selected then the script ran
That's easy enough to do.

it was a text overlay on the screen and NOT in a editor
lua can print to the screen . And maybe redirecting "enter" to the txt file as output
Unfortunately, writing in Celestia's window would require using an editor written in Lua. That's a bigger project than I'm willing to take on right now.


i can test it
i have emacs and vi and vim installed
Thanks!
though you call MS windows's "notepad" the equivalent ( and better) is -- Gnome default is " gedit" and the KDE default is " kwrite"
I'll probably leave it up to the user to modify the edit command if they want to use an editor other than vi.


well emacs and kwrite do pop up ( celestia 1.6.1 - default)
a nice WARNING pop's up and you need to say y for yes or esc for no
Please use the Forum's attachment option or a different hosting service. Imagebam is adding pictures of scantily clad women to your screengrabs.

you might want to use PGP and use an image( planet map) as the encryption key
I'll probably leave it up to the user to modify the edit command if something like that is desired.

Re: "Diary" script help requested

Posted: 02.12.2011, 18:07
by selden
The addon is now available.
See viewtopic.php?f=23&t=16719

Re: "Diary" script help requested

Posted: 02.12.2011, 19:41
by John Van Vliet
--- edit ---

Re: "Diary" script help requested

Posted: 02.12.2011, 21:12
by selden
Are you paying for their services by any chance?
Many such services display advertisements to non-paying customers but not to paying customers.

I've attached what I saw just now.
I've zipped it in order not to force others to see the potentially offensive material. It's relatively mild, but still inappropriate.