Scripting, Part 3

As the release of V2.0a1 approaches, some serendipity has greatly improved the scripting interface, and has bypassed the need I had to do some nasty Windows debugging (which I referred to in an earlier post). Non-geeks need read no further.


As I mentioned, the script editor was modified to allow syntax colouring. However, it was rather slow on the Mac, and hopelessly buggy on Windows. Well thanks to the release of a spiffy new widget by a third-party vendor, the editing window is a lot faster, less buggy, works fine on Windows and the Mac (without flicker), and offers some new functionality.

So here’s the revised script editor (Windows XP version):

winscript1.jpg

You’ll note that it now works in Windows, and that the lines are now numbered. I’ve tried this with 6,000+ lines of code and it works fine.

The options are also expanded:

winscript2.jpg

Not only can you change the syntax highlighting colours (or switch them off), but there are now options to

  • Automatically close brackets. If you type a left bracket, then a right bracket is automatically inserted to the right of the current insertion point. Very convenient.
  • Automatically indent new lines. When you hit enter, pad the next line to line up with the previous line. This was the default in V1.x, but if it irritates you, then you can switch it off.
  • Display invisible characters. If you want to see spaces and end-of-line characters, this is the option for you.
  • Display line numbers. If you don’t like the line numbers, turn them off here.
  • Auto-completion. The editor knows about keywords and other class and method names in the AstroPlanner scripting framework. If you start typing such a reserved word, you can get a list of possible candidates by hitting a certain key and the chosen word will be inserted automatically. If there’s only one candidate word, it will be inserted immediately.
  • Tab indent. Defaults to 2 spaces, but if you like bolder indentation, this is the setting for you.
  • and, of course, the text font and size.