Manitas
Grandmaster Knight
as far as I have tested, it works with 0.891, please let me know if there are any problems
V 0.04: Bugfix - fixed a bug with quoted identifiers in arithmetic expressions
V 0.03: Bugfix - fixed a bug in config file causing module_mission_templates not being processed
I find the official module scripting syntax somewhat puzzling in the long run, and not very readable.
The tool introduces alternative syntax to use in your scripts, while maintaining full backward compatibility with traditional system.
Features:
- Compatible with all module system versions so far, expected to be compatible with all upcoming .8xx versions, probably will be compatible with upcoming major releases too
- Brand new programming-like syntax, symbolic arithmetic operations, no redundant parentheses and commas
- Customizable aliases for the most frequently used operations.
- Can be applied to mods being in progress already.
Installation:
1. Unzip contents of the archive into the module system directory, preserving directory structure (all 5 files must be present in the 'mobo' folder)
2. Run install_mobo.bat. This does the following:
- create backup[timestamp].zip archive in your official module directory containing all the module*.py files
- import all the module* files into the mobo directory, from now on you will edit these files instead those from official module.
3. After the install completes successfully, it's advised to delete install_mobo.bat and init_mobo.py.
Usage:
Just place your code between #mobo# tags like this:
Code:
("script_name",
[#mobo#
:var = 12
{agents reg(5) begin end
|!agent_is_alive reg(5)
agent_is_ally
agent_get_position reg(10) :xxx
$v2 = 5
{
$v1 == 3
reg(2) += $var1
reg3 = 2/2
?
$varabool = reg(5) % 2
}
}
#mobo#
]),
Code:
("script_name",
[
(assign,':var',12),
(try_for_agents,reg(5),begin,end),
(this_or_next|neg|agent_is_alive,reg(5)),
(agent_is_ally),
(agent_get_position,reg(10),':xxx'),
(assign,'$v2',5),
(try_begin),
(eq,'$v1',3),
(val_add,reg(2),'$var1'),
(store_div,reg3,2,2),
(else_try),
(assign,':mobo_tmp',reg(5)),
(val_mod,':mobo_tmp',2),
(assign,'$varabool',':mobo_tmp'),
(try_end),
(try_end),
]),
To build a module: just run the mobo.bat. If precompile phase finishes without errors build_module.bat from official module system will be invoked automaticly.
Additional remarks:
- no need to enclose variables in quotes (identifiers should still be enclosed in quotes though)
- operation modifiers: "!" stands for neg|, "|" - this_or_next|
- a += b works like a = a + b, other operators work analogicly: -=, *=, /=, %=
Ok, this is not gonna be very helpfull if you are going to write a three-liner, but if you try to deal with something more complex with lots of math, this might come in handy.
Please let me know if it will be of any use to anyone.