Plugin for Sublime Text editor (tested on Build 3083) that introduces support for SC2 Galaxy Script language.
Requires SublimeLinter package to be installed.
Before using this plugin, you must ensure that nectan is installed on your system. To install nectan
, do the following:
-
Install
nectan
by typing the following in a terminal:[sudo] pip install https://github.com/Talv/nectan/archive/master.zip
Clone this repository into a subdirectory named subl-sc2-galaxy
in a Packages directory of the sublime editor.
~/.config/sublime-text-3/Packages
(Linux)
C:\Users\YOUR_NAME\AppData\Roaming\Sublime Text 3\Packages
(Windows)
cd ~/.config/sublime-text-3/Packages
git clone https://github.com/Talv/subl-sc2-galaxy.git
Ensure that galaxylint is enabled by using command Sublime Linter: Enable linter
(might be enabled by default).
Basic code linting - currently performs only syntax checking.
Native functions and constants are mapped into sublime-completions.
(will expand into UnitGetFacing(unit inUnit)
)
st
structstref
structreftgs
trigger simple formattingtgc
trigger complex formattingfor
for loopforu
for loop iterating unitsforp
for loop iterating players
To avoid copy-pasting code from sublime to trigger editor, or manually reimporting .galaxy files after every change, you must save your map in an unpacked format - that is .SC2Component in save dialog.
This will expose your map files to be accessed through the filesystem. Take advantage of it and open your map's directory as sublime project.
Then you can just save your scripts directly into the map, without any additional importing in SC2 editor. Your scripts will be read on demand - always up to date.
It's also advised to not write your code directly into MapScript.galaxy
as it might be easly overriden by sc2 editor. The better way is to create a custom script block in trigger editor and include your scripts from there.
For Example:
- Note the Initialization Function (Optional) on bottom
Navigate into your MAPFILE.SC2Map directory and create a scripts
directory. Inside it, create two files:
// scripts/bootstrap.galaxy
// This is the primary bootstrap file. It will bootstrap main, among other required environment files needed.
include "scripts/main.galaxy"
void bootstrap() {
//Comment out the below line after confirming it works.
UIDisplayMessage(PlayerGroupActive(), c_messageAreaSubtitle, StringToText("Bootstrap"));
main(); //Call main, it is suggested most internal systems should hook off main's initialization.
}
// scripts/main.galaxy
// here you might insert sub includes, e.g.
//include "scripts/foo.galaxy"
bool onInit(bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupActive(), c_messageAreaSubtitle, StringToText("HELLO WORLD"));
return true;
}
void main() {
// this is your entry point
TriggerAddEventMapInit(TriggerCreate("onInit"));
}