ChoiceScript language module for TextWrangler

I’m in the very, very early stages of writing my own ChoiceScript game, and I quickly realized that if I was going to spend hours writing this stuff I would need some decent highlighting. I noticed the wiki has a syntax highlighter for Notepad++, but I use a Mac and I like TextWrangler. So, I rolled my own. And now that I’ve got it working, I’d like to share it with the community, in hopes someone might find it useful:

With this installed, TextWrangler will highlight commands (I’ve included all commands that have pages in the wiki), comments, and option text in your ChoiceScript files.

(And yes, that last is kind of a hack with the re-purposing of string delimiters… I make no apologies! ChoiceScript doesn’t need real string highlighting :smiley: )

To install the language module, save the .plist file to ~/Library/Application Support/TextWrangler/Language Modules. Then you should be able to select “ChoiceScript” from the language menu at the bottom of your TextWrangler window and see lovely highlighting.

For those who haven’t heard of it, TextWrangler is a free programmer’s text editor for Mac. I definitely recommend checking it out if you’ve been writing your games in TextEdit.

Finally, if you see anywhere the module could use some corrections or tweaks, please let me know! I’m going to be using this for writing my own games so I want it to be as good as possible. :slight_smile:

2 Likes

Thanks for the share!
I’m not sure how many use Macs, but I’m sure those who do will find it incredibly useful.
Am I good to add a link to it in the wiki?

Absolutely!

If a screenshot or any further documentation is needed, I’d be happy to provide it.

Screenshots would be great, but you’ve got the installation instruction sorted - unless there’s an easy way to edit the module (some people might want alternate colours etc)?

Uploaded a screenshot with the default TextWrangler colors here: http://tinypic.com/r/wqww7a/6

I think I should add one thing to the installation instructions: that folder is hidden by default in OS X Lion and above, so a way to get there that works for everyone is just to open Finder, press Shift+Command+G, and paste in the entire path.

The module itself doesn’t include any color info, since the color scheme is defined separately in the application. You can open up the preferences window in TextWrangler and set the colors under “Text Colors”. The “Keywords” color is used for commands, “String constants” for option text, and “Comments” for comments.

Other than that, the thing people would probably most likely want is to add more highlighted keywords - that’s easily done by opening up the file and adding a new line with new_keyword right at the end of the list of keywords after line 65. (times however many new keywords you want highlighted.)

Aw, it stripped the tags from my keyword example. Well, it’s pretty self-explanatory once you look at the file, anyway.