Skip to content
This repository has been archived by the owner on Feb 17, 2019. It is now read-only.
/ subl-sc2-galaxy Public archive

## No longer maintained in favor of https://github.com/Talv/vscode-sc2-galaxy ## Plugin for Sublime Text 3, introduces support for SC2 Galaxy Script.

License

Notifications You must be signed in to change notification settings

Talv/subl-sc2-galaxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SC2 Galaxy script package for Sublime Text editor

Plugin for Sublime Text editor (tested on Build 3083) that introduces support for SC2 Galaxy Script language.

Installation

Linter installation

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:

  1. Install Python and pip.

  2. Install nectan by typing the following in a terminal:

    [sudo] pip install https://github.com/Talv/nectan/archive/master.zip
    

Plugin installation

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

Configuration

Ensure that galaxylint is enabled by using command Sublime Linter: Enable linter (might be enabled by default).

Features

Syntax highlighting

syntax highlighting

Code linter

Basic code linting - currently performs only syntax checking. syntax check

Completion of native functions

Native functions and constants are mapped into sublime-completions. natives completion (will expand into UnitGetFacing(unit inUnit))

Snippets

  • st struct
  • stref structref
  • tgs trigger simple formatting
  • tgc trigger complex formatting
  • for for loop
  • foru for loop iterating units
  • forp for loop iterating players

How to use this plugin in combination with SC2 Editor?

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:

trigger editor

  • 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"));
}

About

## No longer maintained in favor of https://github.com/Talv/vscode-sc2-galaxy ## Plugin for Sublime Text 3, introduces support for SC2 Galaxy Script.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published