Lines between stars or fictional planet systems

General discussion about Celestia that doesn't fit into other forums.
Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 17 years 11 months
Location: Out there...

Post #21by Reiko » 09.11.2007, 22:44

MKruer wrote:
Reiko wrote:
Cham wrote:material # 1
diffuse 0.4 0.2 1 # Asterism like blue
opacity 0.7
end_material

material # 2
diffuse 0.6 0.3 0.8 # Purple
opacity 0.5
end_material

I have a question, how do you get the color codes?

Color is based upon R G B factors, instead of being 0-255 that is ususaly used in other applications, it is 0.0 to 1.0.

So Take Red that is 255,0,0 becomes 255/255, 0/255, 0/255 or 1.0, 0 , 0

Thank you :)

TJackson
Posts: 24
Joined: 24.12.2021
With us: 2 years 8 months

Post #22by TJackson » 24.01.2022, 22:05

Hi. I'd love to see it, but it doesn't work for me. I'm using Celestia 1.6.2.2 for Windows/pc. proxima.cmod is in the models directory. There are 3 dsc files in the distribution in the Data directory. So, I put proxima.dsc into Data also. Although there is no 'extra' directory, there is an 'extras' directory, so I included a copy of proxima.dsc in there too. Then, I attempt to run proxima.cel as a script, and it paints the star proxima red, but I see no line anywhere connected to it, although I see constellations and boundaries and have turned on every view option that might hold something unexpected. But no line. Am I doing something wrong? Thx

Proxima in Celestia.png

Avatar
SevenSpheres
Moderator
Posts: 822
Joined: 08.10.2019
With us: 4 years 10 months

Post #23by SevenSpheres » 24.01.2022, 22:55

Using the files from this post, I can replicate your inability to see the line when viewing Proxima from Earth. However, if I zoom out from the Solar System, the line becomes visible:
proximaline.png

You should indeed put proxima.dsc in the "extras" directory, since this is where addon files go. The "data" directory is intended for Celestia's default data files, and files in it will only be read if they're specified in celestia.cfg. Although it will work in the main "models" folder, you could instead put proxima.cmod in a "models" folder in "extras" (or in a subdirectory of "extras", as long as that subdirectory also contains the dsc file) - this is the standard way of setting up addons.
My Addons: viewtopic.php?f=23&t=19978 • Discord server admin
Celestia versions: 1.5.1, 1.6.1, 1.6.2, 1.7.0, and some unofficial versions like Celestia-ED


JOS
Posts: 8
Joined: 09.01.2023
With us: 1 year 7 months

Post #25by JOS » 10.01.2023, 12:56

Hello everybody,

After having searched for a long time on the forum and on the internet, I would like to post a request for help.

I am trying to use NROUTES. When I run the script I get the error

Code: Select all

[string "/Applications/Celestia 2.app/Contents/Resou..."]:225: bad argument #1 to 'close' (FILE* expected, got nil)

Context :
    Mac osx ventura 13.0.1
    Mac Mini M1
    Celestia 1.7.37
    Nroutes "v1.0 (16aug17)"

Tests:
I created a simple script based on the documentation requestsystemaccess / 1.3.2 celestia:requestsystemaccess()

Code: Select all

celestia:requestsystemaccess()
wait(0)
-- Use LUA function to open a file with name "LUAtest.txt"
-- in the Celestia main directory in write mode.
test_file = io.open ("LUAtest.txt" , "w")
-- Write some text to the just opened file.
io.output(test_file):write("This is a test")
-- Close the file.
io.close (test_file)


Conclusion :
The result is similar bad argument #1 to 'close' (FILE* expected, got nil)"
So it seems to me that the io.close method doesn't seem to work with my setup.

Questions :
Does anyone have a similar error? If so what solution has been implemented ?


Thanks for your answers

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #26by selden » 10.01.2023, 16:00

JOS wrote:Does anyone have a similar error? If so what solution has been implemented ?


Thanks for your answers

It looks to me like nroutes.celx is having a problem with the path to the folder where you put it. The path might be too long (perhaps it's too deep in the directory structure on your computer) or the script might be having a problem with the space that I see in one of the folder names. The path being too long is suggested to me by the fact that Lua is unable to display the full directory specification and is ending it with "...".

Can you put the script (i.e. extract its ZIP file) in a different folder and run it there? Try to find (or create) a folder which is closer to the "root" of the disk and which has no spaces in the folder names which are involved.

I developed the script on a Windows computer with Celestia v1.6.1 and I don't have access to a Mac, so there might be some other problem that I'm not recognizing.

Edited to add:
Also, I don't know which version of Lua is built into the version of Celestia that you're using. It might not be compatible with the version of Lua used by Celestia v1.6.1.

Edited again:
I just now tested the script under Windows 10 with Celestia v1.6.2.2 and it worked fine. You might consider using that version of Celestia instead of v1.7, at least for testing.
Selden

JOS
Posts: 8
Joined: 09.01.2023
With us: 1 year 7 months

Post #27by JOS » 10.01.2023, 17:39

I just now tested the script under Windows 10 with Celestia v1.6.2.2 and it worked fine. You might consider using that version of Celestia instead of v1.7, at least for testing.

I've tried with the 1.6.2. mac version. I've no error message but the script doesn't work : no route to be seen in celestia

Can you put the script (i.e. extract its ZIP file) in a different folder and run it there? Try to find (or create) a folder which is closer to the "root" of the disk and which has no spaces in the folder names which are involved.

Here is the full path /Applications/Celestia2.app/Contents/Resources/CelestiaResources/extras/nroutes
I've tried to use /Users/me/nroutes with the 1.6.2 version.
the script starts in celestia, but there is no confirmation of the number of routes inside the CSV.
I assume the csv file is not accessible to Celestia despite a CMOD 777 on the nroutes files.

Anyway thank you for your help :smile:
Last edited by JOS on 10.01.2023, 18:29, edited 1 time in total.

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #28by selden » 10.01.2023, 18:16

JOS wrote:
I just now tested the script under Windows 10 with Celestia v1.6.2.2 and it worked fine. You might consider using that version of Celestia instead of v1.7, at least for testing.

I've tried with the 1.6.2. mac version. I've no error message but the script doesn't work : no route to be seen in celestia

The lack of an error message suggests to me that there might be an I/O incompatibility with the version of Lua in 1.7.
I can't fix that. :(

I'm not sure what you mean by "no route to be seen". There are many things which could cause a CMOD object to be invisible. For example:

Does Celestia recognize its Nebula name nroutes? (This is a test that Celestia sees the .dsc file.)

If it does, is the CMOD file in Celestia's models folder? (you have to copy it manually)

If it's there, is the drawing of Nebula objects enabled in Celestia's Render menu? (they can be turned off and on. The route object is defined as a Nebula.)

Have you looked at Celestia's on-screen log? (That might report a problem related to the model or the dsc file.)

Can you put the script (i.e. extract its ZIP file) in a different folder and run it there? Try to find (or create) a folder which is closer to the "root" of the disk and which has no spaces in the folder names which are involved.

Here is the full path /Applications/Celestia2.app/Contents/Resources/CelestiaResources/extras/nroutes
I'll try to make it shorter and let you know

Anyway thank you for your help :smile:

You're very welcome, of course.

FWIW, your original screengrab showed that there's a space between "Celestia" and the "2" which isn't shown in what's typed above. That space might cause a problem. Too many software products interpret a space as an end-of-string. I usually use an underscore (_) instead of spaces in file and folder names.
Selden

JOS
Posts: 8
Joined: 09.01.2023
With us: 1 year 7 months

Post #29by JOS » 10.01.2023, 18:36

FWIW, your original screengrab showed that there's a space between "Celestia" and the "2" which isn't shown in what's typed above. That space might cause a problem. Too many software products interpret a space as an end-of-string. I usually use an underscore (_) instead of spaces in file and folder names.
I removed the space after reading your post in order to be as close as possible to your recommandation for the 1.7 version of celestia

Does Celestia recognize its Nebula name nroutes? (This is a test that Celestia sees the .dsc file.)
Yes the default route you've created as examples are shown fine.

Sounds to me there is an I/O incompatibility with the version of Lua in 1.7. AND 1.6.2 for mac on the io.close method

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #30by selden » 10.01.2023, 22:12

You can find out what version of Lua is provided by your copy of Celestia.

Create a text file named (for example) detect_lua_version.celx and put the following into it:

Code: Select all

   local s = _VERSION
    celestia:print(s,10, -1, -1, 2,4)
    wait(10.0)


Start Celestia, go to a position where there's lots of black space shown so you can see the output. Backing well away from the Earth, for example.

Then double click on the .celx file that you created.
In the middle of Celestia's window you should see "Lua 5.1"

Attached is a screengrab of what I see
Attachments
celestia_lua.jpg
Selden

JOS
Posts: 8
Joined: 09.01.2023
With us: 1 year 7 months

Post #31by JOS » 11.01.2023, 06:17

PFA the asked screenshot

Lua Version.png
Lua Version.png (118.21 KiB) Viewed 8361 times

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #32by selden » 11.01.2023, 12:38

Is that for Celestia 1.7 or 1.6.2?

At any rate, that suggests that there's something different in the file-system environment provided by MacOS that is causing problems, not Lua itself. Or (equivalently) there's a bug in the script that doesn't cause problems under Windows. I'll see if I can add some debugging code to help track it down.
Selden

Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 7 months
Location: Suzhou, China

Post #33by Markerz » 11.01.2023, 12:43

macOS versions of Celestia (after 1.6.1) are running in a sandbox, it cannot write to arbitrary file. The files that Celestia has access to is under

/Users/your user name/Library/Containers/space.celestia.Celestia/Data/Documents

If you use App Store version then it is /Users/your user name/Library/Containers/space.celestia.MobileCelestia/Data/Documents

You need to put a full path to the file you want to write to, not just a relative path or file name. I edited the script like this

local function get_parent_path(item)
return item:match("(.*[/\\])")
end

celestia:requestsystemaccess()
wait(0)
-- Use LUA function to open a file with name "LUAtest.txt" that is next to the script file
-- in the Celestia main directory in write mode.
test_file = io.open (get_parent_path(celestia:getscriptpath()) .. "LUAtest.txt" , "w")
-- Write some text to the just opened file.
io.output(test_file):write("This is a test")
-- Close the file.
io.close (test_file)

And I put the script under /Users/your user name/Library/Containers/space.celestia.Celestia/Data/Documents, it works for me.

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #34by selden » 11.01.2023, 14:52

@Markerz

The nroutes.celx script was trying to specify the full file paths, although it was using a different technique to determine the path (it was explicitly deleting the script file's name from its path). I've changed to using your technique to determine the path, which seems to work under Windows for 1.6.2 and an older version of 1.7.

@JOS

I'll attach a zip containing a debugging version of the nroutes script. It contains only the script itself, none of the examples or instructions.

Please follow this procedure to test this debugging version.

1. replace your current copy of nroutes.celx by the version contained in the zip file.
2. delete all existing copies of nroutes.cmod and nroutes.dsc (Did you try this before? Trying and failing to overwrite existing files might be the "real" cause of the problem.)
3. start Celestia in a terminal window (this should capture some error messages which otherwise would be lost)
e.g. open a terminal window, cd to wherever celestia.exe is located, then type ./celestia followed by an [enter]
4. invoke the new copy of nroutes.celx (e.g. double click on it) Note: it'll run *much* more slowly than v1.0
5. It'll first display a list of the files it'll be trying to use. Please do a screencapture of that output. (they'll stay onscreen for 10 seconds; you might need to expand Celestia's window to see them all)
6. Each time it opens a file, the script also will display the appropriate file name again. They'll stay onscreen for 7 seconds. You can do a screengrab of them if you want, especially if they're different from the initial list.
7. I've added an "assert" statement to each i/o operation so when there's an error there should be a popup saying exactly what the error is. Please do a screencapture of any such popups. (the same info should appear in the terminal window when Celestia exits)
8. After the script has finished (or crashed) please exit from Celestia (if it hasn't already) and copy-and-paste the contents of the terminal window into a file. (just to make sure it's preserved)
9. please post all of the screengrabs and the contents of the terminal window.

Edited to add: the date announced by this debug version is wrong: it says 2022 where it should be 2023. *sigh* to be fixed in final version.
Attachments
nroutes_debug.zip
debug (slow) version of nroutes.celx
(2.31 KiB) Downloaded 138 times
Selden

JOS
Posts: 8
Joined: 09.01.2023
With us: 1 year 7 months

Post #35by JOS » 11.01.2023, 18:47

Hi Markerz

And I put the script under /Users/your user name/Library/Containers/space.celestia.Celestia/Data/Documents, it works for me.

the basic script also works for me

Added after 2 hours 16 minutes:
Lines between stars or fictional planet systems

Code: Select all

Edited to add: the date announced by this debug version is wrong: it says 2022 where it should be 2023. *sigh* to be fixed in final version.

At least I can fix this myself :biggrin:

First, I couldn't find a way to launch the app from a terminal AND display the logs in that terminal on my Mac. No content to give yet :oops:

Ok know tests results
test 1 : celx script in /Applications/Celestia2.app/Contents/Resources/CelestiaResources/extras/nroutes
chmod 777 on the nroutes folder
nroutes.csv & nroutes.celx in the folder
=> I can see all the displays mentioned in your message
=> I've a message error at the end
screenshot 2023-01-11 21.06.25.png

=> no file created

test 2 : celx script in /Applications/Celestia.app/Contents/Resources/CelestiaResources/extras/nroutes
chmod 777 on the nroutes folder
nroutes.csv & nroutes.celx in the folder
=> I can see all the displays mentioned in your message
=> no error message
=> no file created

test 3 : celx script in Users/***/Library/Containers/space.celestia.Celestia/Data/Document
=> I can see all the displays mentioned in your message
=> no error message
=> cmod & dsc files files created in the folder

Do you need the screen capture for further investigations ?

anyway thank you again for the time you are spending on that subject :smile:

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #36by selden » 11.01.2023, 23:56

@JOS

You wrote
First, I couldn't find a way to launch the app from a terminal AND display the logs in that terminal on my Mac. No content to give yet :oops:
Celestia's terminal output (what it writes to stdout and stderr) should appear in that same terminal window when Celestia exits.
I don't expect there to be very much output, just a few lines, perhaps even less than shows up in the popup error box, but I could be wrong. Every little bit of information helps.

You could try doing a screengrab of the terminal window after Celestia exits as I've done below. My screengrab shows what Celestia 1.7 writes to the terminal window on my Windows 10 computer when there is a Lua error and when there isn't. (I'm using Cygwin to provide a Linux-like environment.)

Re: "Operation not permitted."

When I did a Web search for that error, I came across this suggestion:
In the instance anyone else comes across this problem,
the issue for me ended up being that the folder was "locked".
To remedy this, right click / ctrl+click your user folder and select Get Info.
Under the General subheading, deselect "Locked".
See https://www.grepper.com/tpc/operation not permitted

Please give that a try before you run Celestia and let us know what happens.

Re: files not showing up

I'm wondering if the files are actually being written, but somewhere unexpected.

MacOS has several ways to find out where files have been written. Please try the suggestions provided at https://support.apple.com/guide/mac-help/if-you-cant-find-a-file-on-mac-mchlp2305/mac
Do they show nroutes.cmod or nroutes.dsc appearing somewhere else?
Attachments
celestia_in_terminal.png
Example terminal output.
Selden

Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 7 months
Location: Suzhou, China

Post #37by Markerz » 12.01.2023, 00:55

macOS version's Celestia's default directory is /Applications/Celestia.app (depending on where you put it)/Contents/Resources/CelestiaResources. So if you use relative path or file name, the actual path will be under this path. And this path is not writable!!! That's why you get permission issues.

You have to use something under /Users/your user name/Library/Containers/space.celestia.Celestia/Data/Documents

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 22 years
Location: NY, USA

Post #38by selden » 12.01.2023, 01:35

@Markerz

The script does *not* specify relative paths. They're all absolute, pointing to the directory where the nroutes script is.

However, the directory containing the script does need to be writable by the userid which invokes the script. I don't use MacOS and can only guess what might cause a particular MacOS directory not to be writable.

In principle, the script should work in *any* writable directory. It should not have to be in a directory tree which contains Celestia. If Celestia has been installed "properly" (whatever that means) selecting a .CELX script automatically invokes Celestia to interpret it no matter where Celestia is and no matter where the script is. The user then can manually copy the output .cmod and .dsc files to whatever Celestia extras subdirectory is appropriate.
Selden

Markerz
Developer
Posts: 274
Joined: 29.01.2009
Age: 29
With us: 15 years 7 months
Location: Suzhou, China

Post #39by Markerz » 12.01.2023, 04:04

let's clear up on permissions for Celestia (on macOS, it is similar on iOS). User permission to a directory does not equa Celestia app's permissions.

Files and folders inside app bundle, (read access, no write access):
Any things under /Applications/Celestia.app (could have different names)/Contents

Files and folders under sandbox folder, (read and write access)
Any thing under /Users/your user name/Library/Containers/space.celestia.Celestia/Data/

Files opened by Celestia, (read and write access)
For example, a script opened by Celestia. Note that Celestia only has access to the file, no access to the directory the file is in

All other files and directories (no access)

JOS
Posts: 8
Joined: 09.01.2023
With us: 1 year 7 months

Post #40by JOS » 12.01.2023, 06:38

@Selden

You could try doing a screengrab of the terminal window after Celestia exits as I've done below. My screengrab shows what Celestia 1.7 writes to the terminal window on my Windows 10 computer when there is a Lua error and when there isn't. (I'm using Cygwin to provide a Linux-like environment.)

I finally found out how to do it :
launch from the terminal the command : /Applications/Celestia2.app/Contents/MacOS/Celestia
See the results for my test 1
2023-01-12 07.34.32.png


Re: "Operation not permitted."

When I did a Web search for that error, I came across this suggestion:
In the instance anyone else comes across this problem,
the issue for me ended up being that the folder was "locked".
To remedy this, right click / ctrl+click your user folder and select Get Info.
Under the General subheading, deselect "Locked".
See https://www.grepper.com/tpc/operation not permitted

Please give that a try before you run Celestia and let us know what happens.

2023-01-12 à 07.23.49.png

The folders are not locked. I get "the Operation not permitted error" despite the setup

Added after 6 minutes 51 seconds:


@Markerz

Files and folders inside app bundle, (read access, no write access):
Any things under /Applications/Celestia.app (could have different names)/Contents

I agree whatever the rights on the files there is an error on the permissions

Files and folders under sandbox folder, (read and write access)
Any thing under /Users/your user name/Library/Containers/space.celestia.Celestia/Data/

I agree, the test3 on my previous post give the expected result

Files opened by Celestia, (read and write access)
For example, a script opened by Celestia. Note that Celestia only has access to the file, no access to the directory the file is in

It doesn't work since there is no access to the directory

Code: Select all

’Error: [string "/Users/jos/Downloads/nroutes/nroutes.celx"]:112: bad argument #1 to 'lines' (/Users/jos/Downloads/nroutes/nroutes.csv: Operation not permitted)

Last edited by JOS on 12.01.2023, 12:49, edited 1 time in total.


Return to “Celestia Users”