Stellarium Scripting - Starting with a Key Press

  • Anonymous - 2013-12-02

    I'm trying to develop a script to give a planetarium presentation soon.
    I wanted to start the presentation by hitting (for example) the <SPACE> key, but I can't find the slot to use for this. I have looked at the forum here, but have not found anything.
    Any suggestions?

    Also, scripting does not seem to be repeatable, although I have "set up" code at the front of the script, including "core.clear("natural");" and a time setting. I find the constellation lines seem to behave inconsistently.
    How do I ensure the system always starts with exactly the same set up?

    I am a Stellarium scripting novice, but have some programming knowledge!

  • Bogdan Marinov

    Bogdan Marinov - 2013-12-02

    You can assign a key to start a script, but for now you need to edit manually the configuration file to do this - there's no GUI.

    Find and open the shortcuts.json file in the /data sub-directory of your user data directory (location varies on different OS).

    Within the file, look for the "scriptLandscapes" key in the "scripts" section for an example of defining a script file as assignable to a key. You can probably just replace the name and the values of "text" and "scriptFile" with whatever values you need - after that, you'll be able to change the assigned key with the shortcuts editor GUI from within Stellarium.

    If you have problems dealing with JSON files, ask. :)

    As for the repeatability, it's a problem - there are a lot of properties that can be changed and keeping track of them is hard. I'm not one of the scripting experts, but I may be able to help. What exactly is the problem with constellation/asterism lines?

  • Anonymous - 2013-12-03

    Bogdan, Thanks for the pointer to JSON, I'll follow this up.

    The Constellation lines are controlled within the script using:
    ConstellationMgr.setFlagIsolateSelected(true); and
    core.selectObjectByName(objName, true); to select an object objName (from a list).
    This sequence turns lines on for the selected constellation object e.g. "Orion".
    But when I select a non-constellation object e.g. "Pleiades" ALL the constellation lines turn on! Not just the last selected one.
    Selecting the next constellation object turns all lines off except the new object.
    If I later use:
    core.selectObjectByName("", true);
    to deselect all objects, the last constellation object lines are still visible.

    I have also decided to start each session of the show from a newly started instance of Stellarium. I'm running on XP Pro, SP3.

  • Anonymous - 2013-12-04

    Another problem: How do you adjust the Star Twinkle? I want to emphasise the twinkle to show that Planets don't twinkle like the stars, but I can't find any mention of "twinkle" in all the listed ...Mgr classes.
    What am I not understanding? Where is the command, please?



Cancel  Add attachments

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks