Script reference guide or

  • Anonymous - 2012-01-24

    Hi all, i wrote a script to mine some data instead os using and astronomical
    anuary, but to finish my project i need to write the data in a file, the thing
    is, i can´t find the reference guide to script language. Tried some, and the
    ones that are said to be used didn´t had the Math.round function wich i found
    god knows how . Anyone knows how to do it? How to write the output of a script
    in a file??

    Thank´s a lot;

  • qam1

    qam1 - 2012-01-29

    The scripting guide can be found here

    But warning, it is written using extreme techno-babble and many(most?) of the
    functions don't work and unfortunately they don't tell you (i.e. with an
    "Under Construction" sign) which ones are functioning and which ones aren't.

    Writing the output of a script to a file I don't think is possible, but if you
    figure it out do post back.

  • Matthew Gates

    Matthew Gates - 2012-02-03

    As the "they" author of most of the scripting engine documentation, I invite
    anyone who wishes to improve the documentation to do so. We are grateful for
    any contributions we get. The whole project is not yet complete, hence the <
    1.0 version number.


  • Matthew Gates

    Matthew Gates - 2012-02-03

    With respect to writing out a file, no that is not possible. This is not an
    accident - the scripting engine is sandboxed in an attempt to prevent a whole
    category of security problems which can arise by letting the scripting engine
    edit files on your computer. Just look at acrobat reader. Do not want.


  • qam1

    qam1 - 2012-02-06

    How about writing text to the log file?

    As in the StelLogger Class

    For instance, suppose I have script that goes move time forward until the sun
    sets, once it reaches the sun set could I write the Julian date in the log
    file? If I run the sunset script for a hundred years or more can I send the
    dates to the log.txt file? The log file will get pretty big but I can also
    open it in notepad and cut and paste what I need

  • qam1

    qam1 - 2012-02-15

    Well I tried

    StelLogger.writeLog("Write Something");

    core.writeLog("Write Something");

    and just plain

    writeLog("Write Something");

    None of them worked. So I guess this isn't working

  • qam1

    qam1 - 2012-02-25

    When there's a will there's a way, I found a backdoor way of outputting data
    from Stellarium

    You can use the core.setDate() function to send data to the last run log, the
    log.txt file

    For example, if you use this line in a script

    core.setDate("*Lets go Mets*");

    in the log file, a this line will appear

    StelMainScriptAPI::jdFromDateString error: date string "*Let's go Mets*"
    not recognised, returning "now"

    Just open the log.txt file and remove all the top system information and
    replace everything before and after the "Let's go Mets" and you have your data

    Here's an example script, that when you run it it will record the date and
    Mars' RA and Dec in the Last Run Log

    Mars to log.ssc

  • qam1

    qam1 - 2012-02-25

    Ok, try again

    Here's the script file to log.ssc

    And sorry, I don't know why my post have lots of space below them

  • qam1

    qam1 - 2012-02-25

    WTF, @^!@(

    One last try


  • Matthew Gates

    Matthew Gates - 2012-02-25

    Nice hack qam1 :) I think I will implement a "writeLogMessage" function in the
    core object at some point. Be aware that I will probably put a limit on the
    length of data passed - perhaps a 1000 characters or something like that. What
    do you think?


  • Kajaji

    Kajaji - 2012-02-25

    I use an indirect way through the script console and core.debug, then copy and
    paste to a file.

    Open the script console and run your script from there.

    then copy and paste into your file.

    Ex. to output moon altitude every 30 Sec.


    for (i=0; i<20; i++)
    core.setDate("+30 seconds")
    MoonData = core.getObjectPosition("Moon");
    MoonAlt = MoonData

  • qam1

    qam1 - 2012-02-28

    The writeLogMessage sounds like a good idea. I assume 1000 characters per
    message instead of total 1000 which is probably more than enough.

    One problem with my system is the error message is lots of words, so the file
    size of the log.txt file could get unwieldy.

    You could also instead of writing to the log.txt file, you could have a
    separate dedicated file just for script output. Call it scriptoutput.txt or
    something. This way you can keep your data over multiple runs of Stellarium.

  • Anonymous - 2013-10-13

    i must say that is necessary to have a legal way to save the data to a file. Not cover the hacks with dirt or erase the answers. in new version 0.12.4 cant be done.




Cancel  Add attachments

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

Sign up for the SourceForge newsletter:

No, thanks