Galaxy
From WarCraft3
Galaxy is an API scripting syntax that can be used by those with the Starcraft II Galaxy Editor to manipulate almost every part of the game. Galaxy is a scripting syntax based on C. Many maps will now, according to Blizzard, use less coding and more data editing via the Data Editor. Users can also access Galaxy directly, by creating a trigger and using the 'View Script' feature in the editor. You can also import libraries.
GUI triggers are converted into Galaxy when the map containing them is saved in the Galaxy Editor.
Basic Galaxy
Galaxy follows syntax based on C. A "Hello, World!" example function is below.
void HelloWorld() {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDirective, StringToText("Hello, World!"));
}
In Galaxy, users can create loops to repeat actions until a condition is met.
void Loop() {
int i = 0;
while (i <= 11) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDirective, StringToText("Hello, World!"));
i = i + 1;
}
}
A comment is written using double slashes (//). Everything after a comment declaration on the same line will be ignored by the Galaxy compiler.
void HelloWorld() {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDirective, StringToText("Hello, World!")); // Now that I have used double slashes, the rest of this line will be ignored.
// You can also start a line with a comment.
}