GML programmers should have no problem migrating to EGML because EGML is a modified version of GML.
EGML stands for ‘Extended Game Maker Language’ and has picked some(not all) GML functions and added some new ones.
EGML is a strict language while GML is very relaxed. This has advantages and is the only major hurdle when learning EGML.
There is one big difference between EGML and GML: GML is always an interpreted languages and EGML can be a compiled language.
Also GML is only available in one program Game Maker while EGML is available in multiple such as G-java, G-C++ or even your own game maker!
GML programmers should immediately drop the use of ‘Treat uninitialized variables as 0’ and declare every single variable. Real programming languages don’t have this function for very good reasons. This may seem like a disadvantage but when you get used to EGML you will never look back!
There is one more thing about variables: while GML had ‘real’ and ‘string’ variables but users could easily switch from the types, EGML is MUCH stricter.
So if a variable is a String it stays as a String, this will make it easier to read/debug your code as you know that a variable can only be one type.
You will find this terrible when you start but you will get used to it very soon. There are some times of variables in EGML, the most important are:
| G-java EGML | G-C++ EGML | Description |
|---|---|---|
| int | int | An integer number |
| double | double | GML’s ‘real’ |
| float | float | Very looked like double |
| String | string | GML’s ‘string’ |
| boolean | bool | true or false |
G-C++ 0.08 already supports String and boolean types.
You can’t redeclare a variable as a different type but you can obviously change its value.
GML’s and EGML’s operators are almost the same, but EGML also features two exclusive operators
x++;// same as x += 1; x--;// same as x -= 1;
In GML you could choose if you wanted to add ; in the end of each command or if the “change line” ended the command. In EGML, you MUST add ; in the end of each statement!
In GML, you could use ‘Begin’ or ‘{’ and ‘End’ or ‘}’ for code blocks. In EGML you must use ‘{’ and ‘}’! The same applies to ‘and’(you must use &&) and ‘or’(you must use ||). Avoid the use of xor. (Note: xor can be a valid keyword in some circumstances, but you ought to use the != sign instead!)
‘div’ should be replaced by ‘/’ and ‘mod’ should be replaced by ‘%’
In GML, you could enter if x = 3
In EGML you must enter if(x == 3) because = is the assignment, and can’t be used as comparison.
There are a few features that GML has but EGML don’t. For example, functions like execute_string do NOT exist in EGML. Most, almost all of these unsupported features are paid functions in Game Maker. Alot of these functions left GM games very vulnerable, such as execute_string() or script_get_text().
EGML also has a few functions that GML doesn’t. These functions usually start in ‘EGML_’ in G-java or ‘EGML::’ in G-C++. In both programs, this function beginning may be dropped soon.
| Function Name | G-Java has it? | G-C++ has it? | EGML version | Description |
|---|---|---|---|---|
| printErr | yes | yes | 0.1 | Prints an error on the console |
| true_median | yes | yes | 0.2 | Looked like GML’s median, but if the number of arguments is even, between the two middle arguments the mean is returned instead of the min |
| reversed_median | not yet | yes | 0.4 | Looked like GML’s median, but if the number of arguments is even, between the two middle arguments the max is returned instead of the min |
| mode | not yet | yes | 0.3 | Returns the most common number. If more than one number share that condition, the smaller is returned |
| reversed_mode | not yet | not yet | 0.4 | Returns the most common number. If more than one number share that condition, the smaller is returned |
| program | not yet | yes | 0.3 | Returns a string containing the program (G-Java or G-C++) used |
| version | not yet | yes | 0.3 | Returns the EGML version |
| program_version | not yet | yes | 0.3 | Returns the program version |
| location | not yet | yes | 0.4 | Returns the program path |
| sum | not yet | yes | 0.4 | Returns the sum of the provided arguments |
| mult | not yet | yes | 0.4 | Like sum(), but uses multiplication instead of addition |
| contrast | not yet | not yet | 0.4 | same as max()-min() |
In EGML, you need to say which packages you’ll use. In Java EGML, you can do this with import. In C++ EGML, you can do this with using.
import Functions.math; using Functions::math;
See EGML API for more details about this.
with does not exist in EGML.
Exceptions are here to provide support for things that shouldn’t happen. An exception is thrown with throw. An exception is detected with try{ detect commands } catch(Exception exception_variablename){ procedure to execute when an exception is thrown }
Even though the commands are the same, exception handling is slightly different in Java EGML and C++ EGML, most exception handling is the same.
There are a few changes scheduled for EGML 0.4. Scheduled means that they weren’t applied yet, but they might be in a near future.