Comment 14 for bug 1299092

Revision history for this message
Gabriele Pacaccio (gabrielepacaccio01) wrote :

After thinking a bit and taking a look at the source code I decided to add my custom scripts directly into the code and recompile Stellarium.

For me this should be a great alternative way to do what I want, because I don't need to change the scripts once added the first time. In addition, this can be a more powerful way to make custom functions because I can make changes directly in the source code.

I think that I can make a custom function for each script and add a shortcut to them with the addAction() method.

I need only a couple of informations:
- how can I correctly add a .cpp and .hpp file to the source code? (I will add the functions in these new files just to make easy to find them)

- how can I make a function for a script? I mean, is the syntax the same of the scripts?

for example, how can I make a function to replace for an embedded script like this:

"scriptgoto_Sun":
{
 "text" : "GotoSun",
 "primaryKey" : "Ctrl+P, 1, 2, 0",
 "script" : "core.selectObjectByName(\"Sun\", false);
                    StelMovementMgr.setFlagTracking(true);",
 "checkable" : "0",
 "autorepeat" : "0",
 "global" : "0"
}

Do I need to #include some files?

Please, let me know these informations and then you can go ahead with your ideas and forget the problem of the default_shortcuts.json file