Parse Errors *&@#$

1 2 > >> (Page 1 of 2)
  • qam1

    qam1 - 2012-08-29

    The most annoying thing about writing scripts

    I wrote a nice long script, after many days & weeks of working on it it's
    almost all ready to go, I put some final touches on it and try to run it for
    one final test.

    And then........ nothing happens.

    I open the log text to see what happened and to my horror I see

    "script error: "SyntaxError: Parse error" @ line 9889"

    This means I have a error in one or more of my lines of code. I might be
    something simple like I left a comma or quote off somewhere or used a command
    in the wrong format or in the worst case I have too few or too many } brackets

    The frustrating part is there is no way to tell exactly where and what the
    error is. How in the &!@ do I find line 9889?

    Now instead of finishing the script and writing new ones, I have to spend lots
    of time searching over my code trying to find my error. This could take hours
    and sometimes it's just better to cut your loses and abandon the script and
    write a new one from scratch.

    Can something be outputed to the log file to show what exactly the error was?

    For example if instead of


    I leave the closing quote off


    When the error outputs to the log file

    instead of "script error: "SyntaxError: Parse error" @ line 9889"

    put the offending line in the error like

    "script error: "SyntaxError: Parse error" @ line 9889 -

    This way you know what the error is and you can do a quick search for it and
    fix it.

  • barrykgerdes

    barrykgerdes - 2012-08-29

    When I get an error in a line by number. I use an editor that has a line
    counter. The easiest one to find is the IDE in QBasic or QB64. The old editor
    for DOS was also the IDE for QBasic so it should work OK too. There are
    others. However if you are on Win 7 QBasic won't work but the identical
    performing IDE with QB64 (a free program) will work on the 64 bit platform.


  • qam1

    qam1 - 2012-08-29

    Thanks, but I don't think that works with larger scripts

    The error says line 9889 but when I paste the script in either my IDE for
    Freebasic or Microsoft Excel the last line of the script is line 6309.

    I am not doubling up any lines that it should count one line as two or more

  • barrykgerdes

    barrykgerdes - 2012-08-30

    I assume you are using windows

    Press Start. Run edit

    This will bring up the dos editor in a window
    change to you program directory and load the file

    Yes there is a line limit of 65280 lines

    I loaded a data file that has more than this but it loaded the first 65280
    lines without any bother


  • qam1

    qam1 - 2012-08-31

    I tried the dos edit but the last line is still 6309 while the error says line

    I tried on 2 different computers, same

    Here's a link to a copy of the broken script if you wish to see

  • Kajaji

    Kajaji - 2012-09-02

    I'm not sure but may be CRLF is counted as 2 lines. Your error should be at
    line 9889/2= 4944 or 4945


    //txt1 = LabelMgr.labelScreen("By Qam1";, 900*x, 10, false, 25, "#A0801D");
    LabelMgr.setLabelShow(txt1, true);

    You have a semicolon after By Qam1

    but then the script stops at 9707 so check 9707/2

  • barrykgerdes

    barrykgerdes - 2012-09-02

    I also got that script and placed it in an editor
    The last line is numbered 6309


  • Kajaji

    Kajaji - 2012-09-03

    add one to the line number and divide by 2, you get the code line number where
    the issue is:

    (9889+1)/2= 4945
    line 4945:
    //txt1 = LabelMgr.labelScreen("By Qam1";, 900*x, 10, false, 25, "#A0801D");
    LabelMgr.setLabelShow(txt1, true);
    Extra ";" at "By Qam1";,

    and then after correcting this, an error at 9707 meaning at line 9708/2 = 4854
    txt1 = LabelMgr.labelScreen(id.substring(5,7) + "/" + id.substring(0,4) + " to
    " + id_.substring(5,7) + "/" + id_.substring(0,4), 320x, 60y, false, 20,

    may be id_ should be id

    the script runs fine after this but I don't know if it runs correctly or

  • qam1

    qam1 - 2012-09-04

    Thanks, that seems to work. It would have been a long time before I found that
    one. I just darkened the color of "By Qam1" the be better seen on the title
    screen and have no idea how the semi-colon got there. I was going over the
    main sections of the program .

    I should have asked this question a long time ago.

    The script does run when the errors are fixed but it doesn't run correctly. I
    didn't make this script from scratch, I used another script as a base and some
    of the codes for events don't match so it messes up.

    But since this errors are now fixed I was able to complete it and the full
    working version can be downloaded here

    This script took a lot of working trying to calculate all the events, I had to
    write 17 Basic programs and other scripts just to obtain the dates so I was
    really ready to smash my computer when I was thwarted by silly parse errors.

    Thanks Again as always

  • barrykgerdes

    barrykgerdes - 2012-09-04

    I tried the script on the latest build (that works). Interesting script.
    However Jupiter drifted of screen very quickly unless I manually centered it
    then it ran OK
    I needed to speed it up of course to see the effects and then Stellarium
    locked out after Orbit the first time I ran it
    I think it needs a stop button that works too.
    Otherwise very good


  • qam1

    qam1 - 2012-09-06

    Thanks for the feedback

    The things you mention are mostly limitations on the scripting engine

    • Jupiter Drifting off the screen? It doesn't for me and I do have a setFlagTracking(true) command right before the 1st event runs so that shouldn't happen unless you (inadvertently) select another body or stop tracking by pressing the right mouse button, then yes while the script is running you will have to select and center Jupiter again.

    I would love to use the setFlagTracking(true) command every time an event
    displays to avoid this from happening, but the problem with the
    setFlagTracking(true) command is it isn't instant, that is it starts from
    where Jupiter was last (which may be below the horizon at the new time) and
    takes a second or two to center Jupiter. Unfortunately this effect gets
    dizzying and annoying and slows down the script if you do it for each event.

    • Stopping the script, pressing the ] key will always return the script to the main menu (where there is a quit option) and if you run it using screensaver mode also pressing any of the other change date keys - + [ will also return you to the main menu. Directions are shown in the script. I know these keys aren't commonly used and easily forgettable, but there's just no (working?) Keypress/Inkey /getkey function available in the scripting language that I can use. I would prefer to use the Escape key and arrow keys, but I can't so I have to "backdoor" a keypress function by having the script "look" for an immediate change of date, which of course happens whenever you press the - + keys

    A side note, not just scripts but Stellarium in general needs a "Go back to
    default/starting settings" button that when you click on it you return to your
    home longitude, latitude, landscape, current time etc.

    • Speeding up the script. I have had problems with adjusting the speed of scripts also. My whole computer will crash and freeze so I avoid touching those keys or using the change rate commands in the script.

    But I am not sure why you would have to speed up the script? In keypress mode,
    the script will run as fast as you can press the – or + key, or if you hold
    those keys down the script will run as fast as your computer can display the
    In screensaver mode, I set the events to last 3 seconds each. I figured this
    was a reasonable time to view the event and be fast enough to not be boring.

    Unfortunately with the increase/decrease script rate keys prone to crashing
    your computer and lack of keypress function there is really no way to change
    this rate while the script is running.

    If 3 seconds is too slow for you, the speed can be manually changed in the
    script file. It's the very 1st line after the script title and description

    spd = 3; // speed for screen saver mode in seconds

    Just change the 3 to whatever you prefer

  • barrykgerdes

    barrykgerdes - 2012-09-06

    Hi gam1

    I did not want to be too critical. Yes I was able to do many of the things you
    suggested. However I like to run the scripts in the "dumb' operator mode.

    Open the script menu.- select a script- press the start button and then stop
    with the stop button. Follow an on screen menu if necessary .The script did
    not do that for me. Particularly the stop button.

    I have not written a script for a few years now but I always made certain
    there was a stop button that returned the display to the screen that I started
    from.particularly a script that is designed to run for a long period.

    I selected the script and pressed the start arrow. Jupiter appeared on the
    screen and nothing else happened (except the clock ticked away at real time) +
    / - did nothing that I could see, pressing returned to Jupiter. I needed to
    press the speed up buttons before I got any increase in speed. That is
    probably what cause the break of lock.. These were the only obvious

    By fiddling around I was able to do many things but I could not follow what
    else was supposed to happen.


  • qam1

    qam1 - 2012-09-06

    By all means, be critical. I want my scripts to work perfectly and be as easy
    to use (KISS) as possible and what may appear to work on my home computer and
    be obvious to me may not be to another user. So I always appreciate feedback.
    No offense ever taken.

    But I am not exactly sure what is going on

    Here's what should happen, right after you run the script

    1) Up comes the title screen/main menu. Jupiter is displayed big on a purple
    background. There's a list of events to choose from running down on the right
    side of the screen. There is a red arrow --> pointing to the top event -

    2) If you want to see only a specific type of events you press + or – to move
    the arrow up or down next to the type of event.

    3) When the arrow is next to the type of events you want you press either for
    screensaver mode

    4) The purple background goes away and it becomes black and it zooms out to
    37° and the 1st event displays. There should be the name of event displayed in
    green top center of the screen and bottom left with Magnitude & Elongation
    also displayed. The directions are displayed in red center right.

    5) If you chose keypress mode you press + or – to go to the next/previous
    event, if you chose screensaver mode after 3 seconds the next event will
    automatically display.

    To avoid cluttering the screen the directions are only displayed on the 1st
    event then go away for following events.

    6) Pressing the ] key will stop the script and return you to the title
    screen/main menu in step 1.

    It seems you are missing doing step five, or you are expecting the script to
    do more than it actually does. All the script does is display Jupiter as it
    would look from Titan during certain astronomical events and display a few
    ephemeris. Nothing more, nothing less. I generated ephemeris for Jupiter from
    Titan and instead of making a boring table somewhere online, I made a script
    for Stellarium.

    Again, Steps 2 & 3 I would prefer to use the arrow keys, enter and the
    spacebar instead or even better use the mouse to select the events like 99.9%
    of every other program out there since 1990 but unfortunately I can't with the
    current script engine.

  • Kajaji

    Kajaji - 2012-09-07

    Hi qam1

    The degree sign in line 6378:

    xt1 = LabelMgr.labelScreen("Elongation:    " + elong.toFixed(2) + "°" + woes[i], 10*x, 560*y, false, 20, "#AAFFAA");

    is displayed as a question mark.

    I have changed the encoding from ANSI to UTF8 and iserted the degree sign
    according to UTF8. The display is ok.
    I use Notepad++ for windows to edit scripts. http://notepad-plus-

  • qam1

    qam1 - 2012-09-07

    Yes, the Question mark in the Diamond bug again. It was fixed in previous
    versions but it is back.

    I went back and switched the "°" with "\u00B0" and it works.

    Version 1.1 with the patch

    and I added Jupiter orbit as flagged, which is just a preference to see where
    Jupiter is in it's orbit when the event occurs,

    Hopefully, some settlers on Titan hundreds of years from now will enjoy my

  • qam1

    qam1 - 2012-09-15


    Are you using 11.4?

    I just downloaded it this weekend and I see there is a major bug with
    core.wait() in the new version

    core.wait(); is not working right in the new version 11.4

    If you put a value under 1 second, it will round up to 1

    For instance, if your line is core.wait(0.25);

    the script will wait a full 1 second instead of a quarter of a second. No
    matter what decimal you put in, it will wait 1 second

    It looks like somehow in version 11.4 core.wait() can only do integers of
    being able to do decimals (double).

    Here's an simple example to show, it advances 1 hour every tenth of a second.

    // Name: 1 Hour advance to check core.wait bug
    // License: Public Domain
    // Author: Qam1
    // Description: 1 Hour advance to check core.wait bug

    q = 1
    while (q == 1)
    core.setDate("+1 hours");

    It should take 2.4 seconds to do a full day, but as you can see it delays a
    full second between hour jumps and it takes over 24 seconds.

    I reported this as a bug and begged them to please make this a critical bug as
    most of my (and I am sure other people's) scripts I made for Stellarium (and
    my private ones) now don't work effectively.

  • qam1

    qam1 - 2012-09-15

    To clarify, in 11.4 in the Jupiter Titan script that's why the script appears
    to be doing nothing. There are many core.waits less than 1 second that if
    working properly wouldn't be noticeable but with the bug the program now
    crawls to a halt making it appear nothing is happening.

  • barrykgerdes

    barrykgerdes - 2012-09-15

    I use 0.12.0.

    There could be many bugs in the script engine. It is an unfinished section of
    stellarium. At the moment I don't think anyone is working on it so it could be
    some time before it is fully functional. At the moment there are over 40
    scripts in the distribution only about half of them work satisfactorily and
    there really should only be about 6 of the test scripts that were meant as a
    guide too help the writers to use the available facilities. The rest should be
    in the a section in the wiki available to interested people..


  • qam1

    qam1 - 2012-09-16

    Yes the script engine needs a lot of work/development.

    However; this bug is new, core.wait() worked fine since 10.2.

    It's only this version 11.4 that it now doesn't. Somehow, core.wait() became
    an integer only function. I made my script using 11.3 when it was working fine
    which is why I didn't understand why you were having trouble.

    So nobody maybe working on finishing/upgrading/fixing the script engine but
    hopefully someone can just repair this one work again. Core.wait is a simple

    User scripts potentially are one of the best things about Stellarium.

  • Kajaji

    Kajaji - 2012-09-16


    The test script seems to work as expected on my windows vista. For every 10
    hours jump there is a single second jump. I tested on 0.11.3 , 0.11.4 and 0.12

  • qam1

    qam1 - 2012-09-16

    I am using windows 7 and the 64 bit version of Stellarium 0.11.4

    On a hunch I downloaded, installed and ran the 32 Bit version of 0.11.4 and
    wa-la the bug is not there.

    So this bug is in the 64 bit version only.

  • Rich Schottler

    Rich Schottler - 2013-02-05

    Hi all, I'd like to add my voice to the request that the core.wait() issue on Win7 64-bit be looked into and fixed. It remains a problem for my scripts also in Stel 0.12.0.

    Did the Qt version change between 0.11.3 and 0.11.4? If so, might be worth a look at the change there...

    Alex - if you can point me to how core.wait() is implemented in the scripting engine, I might be able to help.

    • Alexander Wolf

      Alexander Wolf - 2013-02-06

      Yes, version was changed but 0.11.4 is first win64 release and here we have win64-specific bug. Tonight I try build Qt 4.8.4 for win64 and build 0.12.1/win64 for tests.

      Source code for wait() you can found within src/scripting/StelScriptMgr.cpp

  • qam1

    qam1 - 2013-02-06

    In 0.12 the Parse errors are now ¼ instead of ½

    In the script error above, a Parse Error at 9889 would be at line (9889+1)/4= 2473

    For the Titan Script

    In 0.12, it (attempts to) calculate solar day for whatever bodies you are on, but it doesn't work for Tidally locked bodies like Titan. So pressing the date keys - = [ ] when your on Titan in my script does nothing which is why it wasn't working for barrykgerdes.

    I too was hoping that core.wait() bug would have been fixed.

    Here is a quick work around

    spd = 0.1 // delay in seconds

    jdspd = 1/(246060) * spd // convert to Julian date seconds

    // The work around

    j = core.getJDay();

    pause = j + jdspd;

    while (j < pause)
    j = core.getJDay();

1 2 > >> (Page 1 of 2)


Cancel  Add attachments