-
I have a project in mind that involves manipulating the yaw and pitch of the Stellarium camera using values from another program (which can be saved in a file using any format). I realized that for security reasons Stellarium's script engine doesn't allow manipulating files, but it does allow including them, so this was my attempt: With my external program I create the following
In the Stellarium console I try to repeatedly include the file:
all I get is:
which is weird because include works (once) if placed outside the function scope. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
Obvious solution: place include outside the function scope. Maybe rewrite as |
Beta Was this translation helpful? Give feedback.
-
You could just generate the whole function body instead of just the declarations of variables. |
Beta Was this translation helpful? Give feedback.
-
As @gzotti suggested, it is possible to achieve this by using the RemoteControl plugin to start a server with an API for Stellarium functions. To send the commands you will need to send HTTP requests using something like fetch or axios (both comes by default in nodejs), or curl. In the RemoteControl documentation you can find the "view" field which has 3 functions to rotate the camera:
To call the function with parameters you must follow this format: Example with curl: Example with nodejs fetch: const url = 'http://192.168.xxx.xxx:20180/api/main/view?j2000=[0.5,0.3,0.2]';
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
response.text().then(text => console.log('Raw response:', text));
return response.json();
}) That's all you need. Regarding the issue with "Received HTTP/0.9 when not allowed" or "invalid message type", it was resolved here. |
Beta Was this translation helpful? Give feedback.
As @gzotti suggested, it is possible to achieve this by using the RemoteControl plugin to start a server with an API for Stellarium functions.
Press F2 > Plugins > Remote Control > Load at startup > configure > [x] Server enabled
If the configure button is unavailable, simply restart Stellarium.
To send the commands you will need to send HTTP requests using something like fetch or axios (both comes by default in nodejs), or curl.
In the RemoteControl documentation you can find the "view" field which has 3 functions to rotate the camera:
To call the function with parameters you must follow this format:
j2000=[0.5,0.…