report on new features
I have added some features and improvements to both compiler (sslc) and decompiler (int2ssl):
Here's a brief changelog for sslc:
Code:
- completed namespace compression optimization with respect to imported/exported variables
- changed 'for' and 'foreach' syntax to allow parentheses which are easier to read IMHO
- heavy code refactoring - split "parse.c" into several files, replaced all dirty workaround code in "lex()" (some syntax features) with parser-level equivalents
- added syntax to reference elements in multi-dimensional arrays (unlimited sequence of brackets [] and dots . )
- added fully featured "break" and "continue" statements for loops
For int2ssl: it was updated to respect "break" and "continue" statements and also some nasty bug was fixed (when using "if" statement as the first statement in "else" block, it produced incorrect code).
Documentation on new syntax was written and will be included in next sfall_modderspack.
Also some new possibilities for sfall global scripts were implemented:
1) You can now safely pass values between global scripts and all other kinds of scripts using "export", "import". Variable export is a feature of original Star Trek language and used in almost every map script in the game. The problem was that if you export variable from a global script, it will be removed at next map change (the reason of this - all "vanilla" script types - map scripts, objects, spatial, etc. - have their life-cycle tied to specific map. when you exit the map, all scripts are removed from memory along with all exported variables; this conflicts with logic of global and hook scripts - they "live" until you re-load the game). Now variable exported from global or hook scripts will be "alive" and available for import in every other script (but you must "export" those variables in global/hook script only!).
While this doesn't really add new abilities for scripts, it helps to make your code as well as user savegames cleaner (not using sfall globals in cases you don't really need them)
2) New function "register_hook_proc" allows to "attach" specific event (hook script) to specific procedure in a global scripts. You can attach several different hook scripts to a single global script, which allows for better mods modularity (one mod can contain all it's logic in a single independent script).
3) New hook scripts:
- hs_keypress - triggers when any keyboard key was pressed or released (args - key code, pressed state)
- hs_mouseclick - triggers when mouse button state changed (args - button number, pressed state)
Along with (2) you should be able to make *proper* hotkeys in mods (I'm looking at party orders addon...)
4) Requirement to define "start" procedure as first procedure in you script is gone (for both global and hook scripts), sfall will find those wherever they are