Warband Refined & Enhanced Compiler Kit (v1.0.0 @ Mar 01, 2015)

Users who are viewing this thread

while we are on the subject, WRECK has also trouble with the module_skins, when you add new races it makes a line spacing too much which leads to the openbrf error messages/not working. DSTN can confirm this.


don't let wreck proceed the sounds file, it's the easiest solution.

When I bypass sounds module it says skins using sounds module. Have you found the solution?

Also, I just need to compile serverside files. I'm trying to decrease time on building.
while we are on the subject, WRECK has also trouble with the module_skins, when you add new races it makes a line spacing too much which leads to the openbrf error messages/not working. DSTN can confirm this.
Provide sample of code and screenshot of error, please.
i don't have a screen ready, check some Mods using WRECK, if the Mod adds new Skins you surely have almost a 50% chance, that wen you scan with openbrf on module usage you get an error message or that the openbrf function no longer correctly read the entries. If you want to take a look simply add a new race and compile with WRECK.

The cause is one space too many:

skel_human 1.000000
2 3

zombie 0
 man_body dummy_mesh zombie_m_handL

and change it to

skel_human 1.000000
2 3

zombie 0
 man_body dummy_mesh zombie_m_handL

between each of the new entries.
Last edited by a moderator:
There is one empty line less at the second one. I haven't seen it neither when Tocan wrote about it the first time and it seems like he does still think it's easy to see for everyone ^^

In mission_templates when one trigger aplied to many missions. Only first math expression will be changed to operands by compiler. I.e. only first trigger will work others will miss operands.
Addition to plugin_ms_extension.py

This is division rounded up. For negative values it will round down.

(val_divup, <destination>, <value>),	              # Divide destination with round up. Negatives will be rounded down.
(store_divup, <destination>, <value1>, <value2>),	   # Divide destination := value1/value2 with round up. Negatives will be rounded down.

def val_divup(destination, value, *argl):
	return [
		(assign, l._sign_, destination),
		(val_abs, destination),
		(val_div, l._sign_, destination),
		(assign, l._y_, value),
		(val_mul, l._sign_, l._y_),
		(val_abs, l._y_),
		(val_div, l._sign_, l._y_),
		(val_add, destination, l._y_),
		(val_sub, destination, 1),
		(val_div, destination, l._y_),
		(val_mul, destination, l._sign_),

def store_divup(destination, value1, value2, *argl):
	return [
		(assign, l._sign_, value1),
		(assign, l._y_, value2),
		(assign, l._x_, value1),
		(val_abs, l._x_),
		(val_div, l._sign_, l._x_),
		(val_mul, l._sign_, l._y_),
		(val_abs, l._y_),
		(val_div, l._sign_, l._y_),
		(val_add, l._x_, l._y_),
		(val_sub, l._x_, 1),
		(store_div, destination, l._x_, l._y_),
		(val_mul, destination, l._sign_),
Last edited:
Updated WRECK that supports WithFire&Sword and NapoleonicWars module systems. It produces 99% of vanilla compiler code.
WRECK v1.1.0 fully integrated (google drive) support python 3
This module system has addition to module_strings.py. It adds 124 strings with displaying string registers from s4 up to s127. This will help some operators that don't use string registers as parameter normally, for example, overlay_set_text. Such operators will display strings with the same ID as string register.
str_register_s4 = 4
will display
Macro operators expanded. See plugins code.
WRECK will show notices about scene prop - you need to fix sco files before you remove them (decap ID).
How to use SublimeText

WRECK v1.0.6 (google drive) support python 2.6, 2.7

1) WRECK v1.0 works on Python version 2.6.x or 2.7.x! Doesn't work with 2.5.x, WRECK v1.1 works on Python 3
2) [WRECK integrated] Doesn't support ModMerger Framework and KT0 autoresolver script. Use WRECK plugin system instead.
3) Global variables are decapitalised (unlike vanilla compiler "built_module.bat") - "$g_My_Variable" and "$g_my_variable" are the same variable in WRECK but Vanilla compiler thinks they are different. Advanced expressions should be all lower case.
4) WRECK doesn't track usage of global variables. Native compiler add +1 to entry in the file "variable_uses.txt". So the warning "Global variable declared but never used" is shown only when you add new global variable but not when you remove code where it was used. You need to delete file "variable_uses.txt" to see this warning. This file together with "variables.txt" is used to create reserved global variables for compatibility with new updates. For this you need to add reserved global variable to file "variables.txt" and add 1 to the same line in the file "variable_uses.txt". This is redundant work. Also why you need reserved order of identificators for global variables? There is no operators like try_for_global_variables. Use slots of troops instead.
5) [WRECK integrated] Unlike vanilla it was not possible to copy with python function entities (party, item, troop, etc) because they are complex recursive wreck objects. Example - generation of no-swing weapons in Motomataru formation script. For this use new function <newcopy()> it was added in v1.0.3.
6) Viking Conquest module system adds trigger to all mission templates automatically. So you need to add code for WRECK in the end of "module_mission_templates.py".
import __main__
if __main__.__file__ == 'compile.py':#This is WRECK compiler?
   for mission in mission_templates:
7) For WSE users. Has no limit for skins. (The game engine hardcoded limit is 16. WSE can use more than 16 with adjustments.)
:cool: It is not possible to implement multiprocessing in WRECK compiler because it creates a new python process and loads all modules again.

v1.1.0 (all changes mainly for fully integrated version)
1) Works on python version 3 wich has improved performance. I used iniznet version as a base https://github.com/iniznet/mbw-wreck-native-py3.
2) New command line parameter: 'test'. WRECK will compile the module but won't save anything on disk. Essentially a syntax check.
3) New command line parameter: 'time' - showing performace.
4) New command line parameter: 'prsnt_helper' - add scripted help panel to presentations to speed up layout process, required plugin_presentations.py and plugin_ms_extension.py.
This panel can change any overlay position and size. HotKey [F]- switch panel position (bottom/top/hide). When mouse cursor hovering over overlay its ID will be displayed in log.
Scripted code added by compiler to all presentations. If overlay created with macros then information about its type, size and position will be remembered.
When changed unknown overlays its information also remembered. There are some bugs, for example when panel intersects with other containers. Some buttons don't work yet (Grid).
5) Added Lav's license information
6) Added integrated module system with WSE v1.0.9.9
7) Added modified WRECKER originally devoloped by mercury19.

1) Improved compatibility with vanilla compiler. WRECK produces 99% of vanilla code with 2 exceptions. First - mission template triggers have counters (trigger_ID) in the last number of fake (useless) operand. Second - items don't generate hit_point values if they don't have them.
2) Identifiers and global variables decapitilised and white spaces changed to underscore. WRECK shows notices about them. You need to change names of identifiers for compatibility with vanilla compiler which not always "cure" them. To disable decapitalisation add "cap" to command line. Only music tracks are exception for this rule because it is actually file name. Recreating(deleting) variables.txt is needed to reduce global variable notices.
3) Faction relations use the last relation value in module like vanilla. WRECK shows notices to resolve conflicts. To reduce notices add "fac" to command line.
More detailed explanation. Vanilla compiler memorises relations between factions to an array.
       relations[other_pos][i_faction] = rel[1]
       relations[i_faction][other_pos] = rel[1]
As you can see it copies one value to both factions. So I think that intention was that relations need to be symmetric. Vanilla compiler use the latest value. So this notification will give to dev more control over result value.

Keep in mind that "cap" and "fac" options are only temporary. Better to fix all notices for compatibility with vanilla compiler and reducing bugs.
python compile.py tag cap fac %1 %2 %3 %4 %5 %6 %7 %8 %9

1) Added more detailed explanation to hint of syntax errors.

1) In mission templates added unused operand to the end of each trigger:
(lt, -1, id),
where ID is the number of this trigger starting from 0. Helper for debugging engine error messages.
2) Removed duplicate notices about unused local variable of repeatable mission triggers.
3) When compiler message show trigger name, it will be more informative - with each of the three timers if trigger is not simple. Previously was only the first.

1) [WRECK integrated] fixed expressions in module_mission_template.py triggers. They were bugged if used more than once.
2) Added checking audio file extensions.
3) WRECK will check output dialog states like in Native compiler.

1) Script that can fail will be checked for letters "cf_" in the begining of its name.
2) Local variables that have "unused" in their name will not be checked for warning "Variable declared but never used".
3) [WRECK integrated] Warning "Variable declared but never used" will now check expressions.
4) [WRECK integrated] Local variables declared by WRECK expressions in the loop conditions (try_for_range) will not be overriden by temp variable inside loop body.

1) Fixed processing module_skins.py - removed extra spaces wich led to errors in OpenBrf
2) Fixed processing module_sounds.py - sound file can now be declared as list with faction ["sound_file.flac", fac_outlaw]. WRECK works with WithFire&Sword and NapoleonicWars MS now.
3) try_for_range_backwards will not show unused variable warning.

Last edited:
Top Bottom