Notepad++: Syntax highlighting for GameMaker Studio 2

About 3 years after GMS2 release I decide that it might be a good idea to make a GMS2-specific UDL for Notepad++ instead of using my GMS1 UDL.


What it has:

  • Syntax highlighting for built-in keywords/functions/variables/constants.
  • Comments (incl. JSDoc).
  • Strings (incl. escape characters and verbatim strings).
  • Code folding for brackets, comments (//{..//}), and #regions.
  • Ability to specify shared resource names or prefixes (see customizing).


  • #region/#endregion labels highlight as code because you can't have something be both a delimiter and a fold start/end at once.
  • Can't fold #define..#define because NPP does not support using the same identifier as fold-start and fold-middle at once (thus the first #define would fold the entire file).
  • Obviously no contextual highlighting (local variables, enums, etc.).
  • Also no automatic resource highlighting unless you specify prefixes (see customizing).

If you need feature-complete highlighting for GML, there's GMEdit.


With that out of the way, here's the UDL itself:

Download UDL


The UDL has a few keyword groups reserved for project-specific resources,

  • Keywords 5: Full asset names (e.g. rm_test).
  • Keywords 6: Asset name prefixes (e.g. rm_ spr_ obj_).
  • Keywords 7: Script name prefixes (e.g. scr_) - highlighted differently from assets.

Unfortunately, if you are using camel-case resource names (objTest rather than obj_test) you'll need to either make the prefix just obj, or add 26 prefixes (objA, objB, ..).


As GMS2 updates, new functions are being added, and it might seem reasonable to allow to introduce these to UDL in a sane way.

First, you want to either take your existing GMS2 UDL (see above), or install this stripped down version:

    <UserLang name="GMLv2" ext="gml" udlVersion="2.1">
            <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="yes" Keywords7="yes" Keywords8="no" />
            <Keywords name="Comments">00// 01 02 03/* 04*/</Keywords>
            <Keywords name="Numbers, prefix1">$</Keywords>
            <Keywords name="Numbers, prefix2">0x</Keywords>
            <Keywords name="Numbers, extras1">a b c d e f A B C D E F</Keywords>
            <Keywords name="Numbers, extras2">a b c d e f A B C D E F</Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">= + - / * &amp; | ^ ! % ~ &lt; &gt; ( ) [ ] ; . , : @ ? [#</Keywords>
            <Keywords name="Operators2">#</Keywords>
            <Keywords name="Folders in code1, open">{ #region</Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close">} #endregion</Keywords>
            <Keywords name="Folders in code2, open">begin</Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close">end</Keywords>
            <Keywords name="Folders in comment, open">{ #region</Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close">} #endregion</Keywords>
            <Keywords name="Keywords1">#macro&#x000D;&#x000A;not and or xor div mod&#x000D;&#x000A;globalvar var global&#x000D;&#x000A;enum function&#x000D;&#x000A;if then else&#x000D;&#x000A;for while do until repeat break continue&#x000D;&#x000A;switch case default&#x000D;&#x000A;with self other all noone&#x000D;&#x000A;exit return&#x000D;&#x000A;try catch throw</Keywords>
            <Keywords name="Keywords2"></Keywords>
            <Keywords name="Keywords3"></Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8">@func @function&#x000D;&#x000A;@arg @param @argument&#x000D;&#x000A;@desc @description&#x000D;&#x000A;@return @returns&#x000D;&#x000A;@author</Keywords>
            <Keywords name="Delimiters">00@&quot; 01 02&quot; 03@&apos; 04 05&apos; 06&quot; 07\ 08&quot; 09#define 10 11((EOL)) 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="&#x000F;" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="&#x000F;" fontStyle="2" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="-1" fontStyle="2" nesting="131072" />
            <WordsStyle name="NUMBERS" fgColor="FA3232" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="1F1F99" bgColor="FFFFFF" fontName="1202" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="800000" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="800000" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="800000" bgColor="FFFFFF" fontName="&#xC890;&#xFD64;&#x01DA;" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="0078AA" bgColor="FFFFFF" fontName="&#xFAD0;&#xFD64;&#x01DA;" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="0078AA" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="800080" bgColor="FFFFFF" fontName="&#xFCE0;&#xFD64;&#x01DA;" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="914BAF" bgColor="FFFFFF" fontName="-1" fontStyle="2" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="no" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="1F1F99" bgColor="FFFFFF" fontName="E60-F11DB97C5CC7}" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="1F1F99" bgColor="FFFFFF" fontName="-1" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="008040" bgColor="FFFFFF" fontName="no" fontStyle="2" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="0000FF" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="0000FF" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="0000FF" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="7A81A9" bgColor="FFFFFF" fontName="&#xC4D0;&#xFD64;&#x01DA;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="FF80FF" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="FF0000" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="1024" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="-1" fontStyle="0" nesting="0" />

Then, to get the up-to-date function/variable/constant definitions, find your fnames file, usually in


open it with text editor, and copy contents to this field:

and press this button:
Keywords 2 (functions):
Keywords 3 (constants):
Keywords 4 (variables):

In conclusion

Although with some obvious limitations for lack of ability to specify custom logic, this UDL can still be handy for quickly viewing-editing GameMaker Studio 2 files.

Related posts:

6 thoughts on “Notepad++: Syntax highlighting for GameMaker Studio 2

  1. How does one install this? I used the import style option and imported the .xml file and nothing happens. It also doesn’t show up in style configuration.

    • Pick menu:Language➜User Defined Language➜Open User Defined Language Folder, and extract the .udl.xml there. Then restart Notepad++, and it should show up in Language menu.

    • Notepad++ is convenient for quickly looking at files and remains to be my default program for most text-y file types (even if I use something more fitting for actual editing – as is the case with GMEdit for GML, HaxeDevelop for Haxe, Visual Studio for C# and C++, etc.).

      The real reason why I got around to updating this, however, is because I was updating a GML “format” for Beyond Compare, and the data sets (keywords/functions/variables/constants) are identical between the two.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.