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

Users who are viewing this thread

:lol:
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.
 

tocan03.12.2020​

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.
 
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:

Code:
skel_human 1.000000
2 3
0


zombie 0
 man_body dummy_mesh zombie_m_handL

and change it to

Code:
skel_human 1.000000
2 3
0

zombie 0
 man_body dummy_mesh zombie_m_handL

between each of the new entries.
 
Last edited by a moderator:
Addition to plugin_ms_extension.py

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

Python:
(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.

Python:
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.2 fully integrated (google drive) supports 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.
Code:
str_register_s4 = 4
will display
Code:
"{!}{s4}"
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).
Swyter's tools

WRECK v1.0.7 (google drive) supports python 2.6, 2.7

1) WRECK v1.0.x works on Python version 2.6.x or 2.7.x! WRECK v1.1.x 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".
Python:
import __main__
if __main__.__file__ == 'compile.py':#This is WRECK compiler?
   for mission in mission_templates:
      mission[5].append(*global_common_triggers)
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.2
1) Added "plugin_item_factions_limit_remover.py". It helps to bypass 16 faction limit for items. Uncomment in 'module_info.py' for usage.
2) Updated to WSE v1.1.1.0

v1.1.1
1) Troops flags moved to trp_troop_flags to fix auto_menu entering when game started.
2) Added placeholder strings of animation's names up to 200 so it is possible to add new animations.
3) Added triggers_paranoia mode that checks non-timer triggers in mission_templates that used more than once if trigger parameters changed. This usually caused by operators that fires different non-timer trigger inside another non-timer trigger. On release remove parameter `triggers_paranoia` from compile.bat.
4) WSE updated up to v1.1.0.7

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.

v1.0.7
1) Fixed bug of processing animations. If there were no subsequent animation then string "none 0 0" was added wich crashed engine at loading.

v1.0.6
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.
Python:
#process_factions.py
       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.
compile.bat:
Code:
python compile.py tag cap fac %1 %2 %3 %4 %5 %6 %7 %8 %9

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

v1.0.4
1) In mission templates added unused operand to the end of each trigger:
Code:
(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.

v1.0.3
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.

v1.0.2
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.

v1.0.1
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:
This is some great work Lav & Vetrogor! Can highly recommend.
I modified my wrecker to not convert runtime variables (eg ":trp_xyz" will not become ":trp.xyz") and to not touch python file encoding info, if anyone wants it.
Here is a tiny plugin that lets you use (str_print, "x = :var_x, y = $g_var_y") syntax for debugging (it just converts this to assigns and display_message).
Python:
import re
from compiler import *
from header_common import reg0 as reg0
register_plugin()

cur_reg = 64
def str_print(s, *argl):
  global cur_reg
  if s == "":
    return

  p = re.compiler"{?([:$][a-zA-Z_]\w*)\b}?")

  cur_reg = 64
  assigns = []
  def replacer(match):
    global cur_reg

    val = match.group(1)
    cur_reg -= 1
    assigns.append( (assign, reg0+cur_reg, val) )
    return "{reg" + str(cur_reg) + "}"

  s = re.sub(p, replacer, s)

  if s[0] != "@":
    s = "@" + s

  return assigns + [(display_message, s)]
extend_syntax(str_print)
 
Last edited:
Back
Top Bottom