# \[Resource\] ChoiceScript for Sublime Text

**URL:** <https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087>\
**Category:** Game Development\
**Tags:** tips\
**Created:** [June 26, 2021, 11:23pm UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087 "2021-06-26T23:23:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fawkes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fawkes/32/66518_2.png) [@Fawkes](https://forum.choiceofgames.com/u/Fawkes)\
**Post date:** [June 26, 2021, 11:23pm UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087/1 "2021-06-26T23:23:39Z")

</div>

# ChoiceScript Syntax Highlighter

## 🔗 [[Github](https://github.com/fawkesy/choicescript-syntax) | [Package Control](https://packagecontrol.io/packages/ChoiceScript) ]

❕ **Current version:** 1.0.0

##### ⚠ Compatible with Sublime 3/4. Not an IDE. Requires a copy of [ChoiceScript](https://github.com/dfabulich/choicescript) or [CSIDE](https://github.com/ChoicescriptIDE/main/releases) to playtest your game. View the [README](https://github.com/fawkesy/choicescript-syntax/blob/main/README.md) for more information.

* * *

I decided to start using [Sublime](https://www.sublimetext.com) to write ChoiceScript. I immediately went to look for a syntax highlighter, and while I found one, it was not what I hoped it would be. So I decided to make my own, and I’m happy enough with the result that I decided to share!

## 💎 Features

- Custom syntax highlighting for the ChoiceScript language.
- Full support for multireplace and stat charts.
- Optional custom color scheme for enhanced syntax highlighting.
- Autocomplete commands to quickly create common lines of code (page breaks, line breaks, choices, if/else statements, stat charts, comments, etc).
- Auto-indent following appropriate lines of code ( `*choice`, `#options`, `*if/else`, `*stat_chart`).
- Spell check for plain text, text for choice options, and text in multireplace.
- Word wrap automatically enabled, tabs to indent conversion enabled, auto match disabled (to keep from matching quotes).

### 💡 For information on the included autocomplete commands and how to modify the syntax highlighter, its settings, or the color scheme, as well as additional screenshots and tips, view the README on Github.
  

* * *

## 🛠 Installation
  

> **📦 Package Control (RECOMMENDED)**
>
> 1. In Sublime, go to Tools \> Install Package Control…
> 2. Open the Command Palette by pressing (MAC) CMD + Shift + P **OR** (PC) CTRL + Shift + P.
> 3. Type `Package Control: Install Package` into the Command Palette.
> 4. In the new Package Control window, type `ChoiceScript` with no spaces.
> 5. Select “ChoiceScript” to install the syntax and color scheme.
> 6. On a `.txt` scene file, go to the bottom right of the Sublime window where it says “Plain Text.” Click it and select “ChoiceScript” from the list of syntaxes.
> 7. You’re now ready to write ChoiceScript in Sublime!

  

> **🛠 Manual Installation**
>
> 1. On the [ChoiceScript Syntax repository](https://github.com/fawkesy/choicescript-syntax), click “Code” above the files.
> 2. Select “Download ZIP” and if prompted, choose where to save the folder.
> 3. Extract the contents of the zipped folder.
> 4. In Sublime, go to (MAC) Sublime Text \> Preferences \> Browse Packages… **OR** (PC) Preferences \> Browse Packages… to open your Sublime `Packages` folder.
> 5. Copy and paste the extracted `ChoiceScript` files directly into the `Packages` folder.
> 6. In Sublime, on a `.txt` scene file, go to the bottom right of the Sublime window where it says “Plain Text.” Click it and select “ChoiceScript” from the list of syntaxes.
> 7. You’re now ready to write ChoiceScript in Sublime!

  

* * *

## 🎨 Color Scheme

Included is an optional color scheme designed for the syntax. Since it was created for this specific syntax definition, it is able to target more specific parts of code to allow for enhanced highlighting.

It recognizes:

- Variables vs plain text in multireplace.
- Variables vs operators in `*if/*else` statements, including `and` and `or`.
- Variables and multireplace vs plain text in choice options.
- Image file names in `*image` and `*text_image` commands.
- When an `*if/else` or `*selectable_if` is immediately followed by an `#option` without a line break.
- When a value is set to `true` vs `false` in `*create`, `*temp`, and `*set`.
- When a `*page_break` is followed by plain text.
- Commands vs variables vs plain text in `*stat_chart`.

Some of this does carry over rather well to other color schemes, but the custom color scheme was designed alongside the syntax highlighter to highlight with greater thoroughness and accuracy for ChoiceScript.

> **🌈 Using the Color Scheme**
>
> 1. Go to (MAC) Sublime Text \> Preferences \> Select Color Scheme **OR** (PC) Preferences \> Select Color Scheme. (On Sublime 3, it’s “Color Scheme…”)
> 2. Select the “ChoiceScript” color scheme.
> 3. You’re now all set with the ChoiceScript syntax highlighter and custom color scheme!

  

* * *

## 📷 Screenshots
  

> **Here are screenshots of the syntax highlighter using the optional custom color scheme.**
>
> ![Choice of the Dragon](https://global.discourse-cdn.com/choiceofgames/original/3X/5/5/556a7d6d8d5a0f2f4f07df019f0e5552b2de8d71.png)  
> ![Choice of the Dragon](https://global.discourse-cdn.com/choiceofgames/original/3X/4/2/4297e5e2a46b47124313f14ed62d26290a7ecb26.png)  
> ![The Seven Heirs of Ophaesia](https://global.discourse-cdn.com/choiceofgames/original/3X/6/0/607b82e4aa21c2f3e507576dc714a0c07382d037.jpeg)

#### ❕ View the [README](https://github.com/fawkesy/choicescript-syntax/blob/main/README.md) to see screenshots of the highlighter with other color schemes.
  

* * *

As of right now, there are plans to include additional highlighting to support [CSLIB](https://forum.choiceofgames.com/t/tool-cslib-choicescript-library/) code in the next update. If you come across any bugs or issues, please let me know and I’ll try to resolve it as soon as possible.

I hope you guys find this helpful!

# 🦊

---

<div class="post-metadata">

**Author:** ![rinari](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rinari/32/86277_2.png) [@rinari](https://forum.choiceofgames.com/u/rinari)\
**Post date:** [June 27, 2021, 11:01pm UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087/2 "2021-06-27T23:01:54Z")

</div>

This is a game-changer! I’ve desperately needed a way to highlight and view CS syntax in Sublime, so this is literally a godsend 😂 Thank you so much for developing this and sharing it, it’s working fantastic already!

---

<div class="post-metadata">

**Author:** ![Fawkes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fawkes/32/66518_2.png) [@Fawkes](https://forum.choiceofgames.com/u/Fawkes)\
**Post date:** [June 28, 2021, 12:22am UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087/3 "2021-06-28T00:22:56Z")

</div>

Thank you!! I had a lot of fun working on it, and I’m very excited to share. I really hope people find it useful. 😊

---

<div class="post-metadata">

**Author:** ![anon61760289](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@anon61760289](https://forum.choiceofgames.com/u/anon61760289)\
**Post date:** [June 28, 2021, 5:50am UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087/4 "2021-06-28T05:50:12Z")

</div>

This is a life saver! I’ve been using a different syntax ever since I downloaded sublime, and having a CS-compatible syntax completely changes the game 😍

A quick question: is the text autocompletion/prediction disabled? I notice the word palette doesn’t come up for me whenever I use this syntax but it works on a different one.

Again, thank you so much for this! ❤

---

<div class="post-metadata">

**Author:** ![Fawkes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fawkes/32/66518_2.png) [@Fawkes](https://forum.choiceofgames.com/u/Fawkes)\
**Post date:** [June 28, 2021, 2:58pm UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087/5 "2021-06-28T14:58:19Z")

</div>

Ah, I’m so glad you like it!! 😊

> [@anon61760289](#):
>
> A quick question: is the text autocompletion/prediction disabled? I notice the word palette doesn’t come up for me whenever I use this syntax but it works on a different one.

It is, except for the specific autocomplete commands I made! I have all the syntax-specific settings listed on the [README here](https://github.com/fawkesy/choicescript-syntax#%EF%B8%8F-syntax-specific-settings), as well as how to change them.

To re-enable autocomplete, it can be a little convoluted, but the easiest way to do it would be to download the `ChoiceScript.sublime-settings` on the Github repository, place that in your Sublime `Packages` folder, which you can get to via (MAC) Sublime Text \> Preferences \> Browse Packages… **OR** (PC) Preferences \> Browse Packages…

From there, open `ChoiceScript.sublime-settings` and remove `"auto_complete_selector": "keyword.trigger",`. Autocomplete will now work on every part of your ChoiceScript files.

I disabled it because of how much plain text ChoiceScript involves. Having an autocomplete come up every time you’re writing can be — for me, anyway — a little annoying, lol.

Hope this helps! ❤

---

<div class="post-metadata">

**Author:** ![daydames](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/daydames/32/149142_2.png) [@daydames](https://forum.choiceofgames.com/u/daydames)\
**Post date:** [June 28, 2021, 5:37pm UTC](https://forum.choiceofgames.com/t/resource-choicescript-for-sublime-text/103087/6 "2021-06-28T17:37:20Z")

</div>

This is life changing! I use Sublime Text for my work and it will be amazing to be able to use it for my hobby 😄 Thanks so much for doing this!
