SCUMSLang is a modern StarCraft User Map Settings programming language that has its goal to supersede the normally used language in StarEdit (nowadays superseded by ScmDraft) to define custom behaviour in maps.
.umsh
The extension
.umsh
stands for User Mapping Settings Header. It is a header file to expose an API that can be used in the actual program.
.umsl
The extension
.umsl
stands for User Mapping Settings Language. It is the source file that is getting compiled.
SCUMSLang-Keyword | SCUMSLang-Type | StarCraft-Type |
---|---|---|
int |
UInt32 |
UInt32 |
byte |
UInt8 |
UInt32 (shared) |
enum |
- | - |
bool |
Boolean |
|
string |
String |
String |
SCUMSLang-Type | Range |
---|---|
UInt32 | 0 to 4,294,967,295 numeric |
UInt8 | 0 to 255 numeric |
String | 0 to 1024 bytes (reference) |
File Index.umsh
may contain:
// Imports file "State.umsh" one folder above this file's directory.
import "../State.umsh";
// Imports file "State.umsh" in folder States of this file's directory.
import "./States/State.umsh";
// Makes false and true usable as constants.
// Both constants are still of type Boolean.
typedef enum { false, true } Boolean;
// A type definition where int is the alias for UInt32.
// Assumes that the type UInt32 already exists.
typedef UInt32 int;
The using static
directive designates a enum type whose field members you can access without specifying a enum type name. Its syntax is:
using static <fully-qualified-type-name>;
The static
keyword is used to define a variable in the global block scope. It's syntax is:
// Declaration without initial assignment.
static <type> <variable-name>;
// Declaration with initial assignment.
static <type> <variable-name> = <value>;
The function
keyword introduces a new function which has to be followed by a name and an argument list. For example:
// A non-generic function.
function function_name(...)
{ ... }
// A generic function
function function_name<generic_parameter_name>(...)
{ ... }
A event handler is a function with conditions. They represent the triggers in StarCraft.
// A named event handler.
function function_name()
when condition_name()
when another_condition_name(...)
{ ... }
The [...]
attribute defines an attribute which can be applied on functions. For example:
// COMPILER SPECIFIC, NOT PART OF EXAMPLE:
// Introduce AttributeExample as attribute.
[Attribute]
function AttributeExample();
// COMPILER SPECIFIC, NOT PART OF EXAMPLE:
// Introduce AnotherAttributeExample as attribute.
[Attribute]
function AnotherAttributeExample(int int_val);
[AttributeExample]
[AnotherAttributeExample(0x3)]
// Following function does now have these attributes above.
do_something();
The template function
expression creates a function which resolves template arguments at compile time and arguments at runtime like in non-template function
s.
// A template function that specifies two variables resolved at compile time and two arguments resolved at runtime.
template function<Unit UnitId, Player PlayerId>(<type> <argument_name>, <type> <another_argument_name>)
{ ... }
// A template block.
template
// Line-breaks just for visual purposes 😊
for (Player PlayerId) in (Player.Player1)
for (Unit UnitId) in (Unit.ZergZergling)
{
greet_player(UnitId, PlayerId);
}