Browsing articles from "May, 2013"

Naracea 1.5.0

May 31, 2013   //   by jIRI   //   Announcements, Blog  //  Comments Off on Naracea 1.5.0

And 1.5.0 is out! I’ve spent last couple of weeks testing the editor intensively, and I have some ideas for what to focus on in future releases (yes, it is mainly performance and some minor annoyances). However generally 1.5.0 is in good shape as far as I can tell, thus it gets released.

So, what’s new in 1.5.0?

There is first wave of small changes which were bugging me for long time: tabs (both document and branch) can now be reordered, I fixed several of the most obvious bugs and added syntax highlighting for twee. And of course – Naracea now has plug-in model, which allowed me to implement IronPython scripting.

There is new ribbon tab for scripting related operations:

Basically any scripts can be placed in proper directory which is auto-created for you when you click Open folder button, however for convenience you can also create new Naracea document which would be configured automatically (so it exports its branches to script folder with proper file extensions, sets syntax highlighting etc.) by clicking on Edit button (in case the file already exists, it will just open it). Location of the script folder is in your profile’s AppData folder (something like C:\Users\<username>\AppData\Roaming\Naracea\Plugins\PyScript). There is console, which can be opened by Show log button and whenever you add some script to the script folder you need to click on Refresh button to update list of scripts. Clicking on script button will run the script, Stop button is there to allow you to cancel script when you do something wrong (like writing infinite loop).

So in the end you can very quickly do something like this:

As you probably noticed there is button Debug mode. When this button is checked, Naracea configures IronPython runtime in such a way, that you can attach Visual Studio 2012 to the Naracea.exe and debug the script:

What I usually do to debug my scripts is, that I enable debugging in the editor, then I open the script folder, drag and drop the script file in to VS2012, attach to Naracea.exe (from Visual Studio menu Debug->Attach to Process), setup some break points and run script in Naracea.

You can even inspect Naracea’s internals from debugger, since IronPyhon is publishing PluginHost interface object, but please, do not abuse this. Only things which are defined in IPluginHost interface are somehow guaranteed to be safe (see folder Naracea.Plugins/Plugin/Interfaces in this repository for details; it is also the only reference for the plug-in interface I have right now). Everything else is implementation detail and subject to change.

So, Python scripting solves lots of problems with missing features in the editor (see e.g. this blog post which shows how to setup Naracea to build Twine stories written in twee) and I’ll try to post some interesting script snippets here. I currently do not plan to extend the documentation for plug-ins too much, however if you feel that you need to write a Naracea plug-in, let me know and I’ll provide you some guidance.