• Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

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

Users who are viewing this thread

kalarhan said:
What happens when you open a terminal/console and type “python” and hit Enter?

>python

Thanks for helping me out, kalarhan.

First time I type in "python" it says:
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

I try it again, and it yields:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined

So now I'm thoroughly confused. First seems like it recognizes python, but then it says it's not defined... But I'm guessing you know what these mean?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
The Textbook Philosopher said:
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)] on win32
you know what these mean?
that was checking if Python 2.x was installed on your system (first step).

now move your code to a folder you know you have permission. Most people test on desktop folder. It is temporary. And try to compile from there (step 2, verify you can modify files)

"c:\Users\You_name\Desktop\my_mod\" -> something similar to this, you need to find the folder on your current Win installation (win7, 8, 10, ...)
 
kalarhan said:
that was checking if Python 2.x was installed on your system (first step).

"c:\Users\You_name\Desktop\my_mod\" -> something similar to this, you need to find the folder on your current Win installation (win7, 8, 10, ...)

So, you mean exporting the ModSys from winrar to a folder on my desktop?

Trying this...Ok, I've exported to desktop, and ran compile.bat again, it gave an error for improper syntax where I put in the "from compiler import *" in the module_game_menus.py . . . So I took that bit out, tried again, and after a few dozen lines of files it says are "in_deepcopy", it fails and I get:
TypeError: __call__() takes exactly 4 arguments (2 given)
 

kalarhan

Python Saint
Count
WBNWVCWF&S
The Textbook Philosopher said:
So, you mean exporting the ModSys from winrar to a folder on my desktop?

why are you trying to run code from the winrar file? That wont work. You need to decompress the files into a coding folder.

The Textbook Philosopher said:
Trying this...Ok, I've exported to desktop, and ran compile.bat again, it gave an error for improper syntax where I put in the "from compiler import *" in the module_game_menus.py . . . So I took that bit ou
if your leg hurts what do you do? Cut if off, or try to find the cause and treat it?

Now if you the compilation going you need to fix the bugs you have like that one.

You should create a new thread on the Forge (or try here if its about WRECK) and post your issues there. Remember that when talking about code  you need to show it. Copy and paste it using the code tag. And also copy the log message from compiler/game.
 

PiEtiarna

Recruit
I was eventually able to compile the game without any more errors stopping it from completing, (still two reported) but the game will still not start.


This is where it stops: (large image)
gahJnh7.jpg


Here's my completed compilation, with some errors reported:
PvHe92i.jpg
 

kalarhan

Python Saint
Count
WBNWVCWF&S
PiEtiarna said:
I was eventually able to compile the game without any more errors stopping it from completing, (still two reported) but the game will still not start

compile without error message is not the same as not having errors on your compilation.

Example: from 1000 things that can go wrong, the compiler tests only 50. The game launcher tests another 500. The rest is up to when the code is called.

so check if your generated code is OK (compare files size with the download VC files), like scripts.txt and so on. If any of them is smaller or even empty, you know something went wrong in there.

you will then have to go deeper to find what you did wrong and fix it.
 

KratosMKII

Squire
Is there any way to organize my files into subfolders and make the compiler work while using modmerger? By this i mean:

ID files go to ID subfolder
Freelancer files go to Freelancer subfolder
CTT files go to CTT subfolder
etc

???
 

kalarhan

Python Saint
Count
WBNWVCWF&S
KratosMKII said:
Is there any way to organize my files into subfolders and make the compiler work while using modmerger? By this i mean:

ID files go to ID subfolder
Freelancer files go to Freelancer subfolder
CTT files go to CTT subfolder
etc

???

sure

easiest way - for non coders - is to use a build folder for the compilation. Copy all your source files to there at that moment, run the process, delete the files.

/source
  /subfolder1
  /subfolder2
      /subsubfolder1
  ...
/build
/compiled


you can use any language you like for that, from a simple batch job to code in Python or whatever you know how to use

the alternative is to mess with Python imports, which is doable, just requires actual Python know-how
 

KratosMKII

Squire
kalarhan said:
KratosMKII said:
Is there any way to organize my files into subfolders and make the compiler work while using modmerger? By this i mean:

ID files go to ID subfolder
Freelancer files go to Freelancer subfolder
CTT files go to CTT subfolder
etc

???

sure

easiest way - for non coders - is to use a build folder for the compilation. Copy all your source files to there at that moment, run the process, delete the files.

/source
  /subfolder1
  /subfolder2
      /subsubfolder1
  ...
/build
/compiled


you can use any language you like for that, from a simple batch job to code in Python or whatever you know how to use

the alternative is to mess with Python imports, which is doable, just requires actual Python know-how
Thank you.

I organized all the files into subfolders (compiler files included) in the main source directory, then made a batch file that does the following:

1. Creates a build folder if it doesn't already exist
2. Copies all files from the subfolders into this build folder
3. Executes the compile.bat
4. Waits 10-15 seconds
5. Copies all ID files to ID subfolder in the main source folder
6. Deletes build folder.

I hope this helps someone else in the future that wishes to do a similar thing.
 

Arch3r

Count
M&BWBNW
For anyone looking to use the
plugin_list_system.py
note that there is a flaw in the list_at function. I made a fix though.

Code:
def list_at(destination, list_no, index):
  return [
    (troop_get_slot, ":num_elements", list_no, 0),
    (try_begin),
      (ge, index, 1),
      [color=green](val_add, ":num_elements", 1),[/color]
      (le, index, ":num_elements"),
        (troop_get_slot, destination, list_no, index),
    (else_try),
      (assign, destination, 0),
    (try_end),
  ]

Adding the (val_add, ":num_elements", 1), fixes it, as there is an upper bound check, that does not take into account that the slot index of 0 is used for the list size. Therefor, the num_elements should always add 1, as it also does with the other functions. I ran into bugs without it, but this fix solved it according to my test.

Unsure if this is the right thread, but the plugin is included in the download and I could not find a separate thread.
 

Vetrogor

Sergeant at Arms
I have integrated WRECK and use l.var1*l.var2 expressions. But I have a compile warnings that this variables declared but never used. It's annoying. How can I turn them off?
 

Vetrogor

Sergeant at Arms
For anyone looking to use the
plugin_list_system.py
note that there is a flaw in the list_at function. I made a fix though.

Code:
def list_at(destination, list_no, index):
  return [
    (troop_get_slot, ":num_elements", list_no, 0),
    (try_begin),
      (ge, index, 1),
      [color=green](val_add, ":num_elements", 1),[/color]
      (le, index, ":num_elements"),
        (troop_get_slot, destination, list_no, index),
    (else_try),
      (assign, destination, 0),
    (try_end),
  ]

Adding the (val_add, ":num_elements", 1), fixes it, as there is an upper bound check, that does not take into account that the slot index of 0 is used for the list size. Therefor, the num_elements should always add 1, as it also does with the other functions. I ran into bugs without it, but this fix solved it according to my test.

Unsure if this is the right thread, but the plugin is included in the download and I could not find a separate thread.

Where is that file plugin_list_systems.py?

I found a bug in plugin_ms_extension.py. Replace "timers_storage" to "timer_storage".
Python:
def start_mission_timer(timer_index, *argl):
	return [
		(store_mission_timer_c_msec, l._cached_),
		(troop_set_slot, timer_storage, timer_index, l._cached_),
	]
def store_mission_timer(destination, timer_index, *argl):
	return [
		(store_mission_timer_c_msec, destination),
		(troop_get_slot, l._cached_, timer_storage, timer_index),
		(val_sub, destination, l._cached_),
	]

New macro operand
str_store_anim_name # (str_store_anim_name, <string_reg_no>, <animation_id>),
# Stores specified animation name to string register, as specified in module_animations.py.
Python:
strings = [
...
]

for cur_id in range(0, 670):
  strings.append( ("animation_{:0>3}".format(cur_id), "animation_{:0>3}".format(cur_id)), )

    # Retrieve animation names
	for index in xrange(len(glob['animations'])):
		str_id = ('animation_00%d' if index < 10 else 'animation_0%d' if index < 100 else 'animation_%d') % index
		animation_real_name = glob['animations'][index][0]
		str_offset = int(getattr(WRECK.s, str_id)) & 0xFFFFFFF # Strip opmask
		glob['strings'][str_offset][1] = animation_real_name

def str_store_anim_name(string_reg, value, *argl):
  return [
    (store_add, l._cached_, s.animation_000, value),
    (str_store_string, string_reg, l._cached_),
  ]

extend_syntax(str_store_anim_name)             # (str_store_anim_name, <string_reg_no>, <animation_id>),
                                               # Stores specified animation name to string register, as specified in module_animations.py.
 

Asokanta

Recruit
WBNWVC
It gives me this error:
Bash:
Checking module syntax... FAILED.
MODULE `sounds` ERROR:
failed to parse element #150
  failed to parse element #0
    value ['brit_huzzah1.wav', 6] is not a valid filename


COMPILATION FAILED.

Anyway to fix this?
Module: NW
 

Asokanta

Recruit
WBNWVC
Show your code entry at module sounds for that one and the one before.

It goes like that, and it gives me errors on every sound data array. Like there's a file name and faction id.

Python:
 ("man_hit_cut_strong",sf_priority_5|sf_vol_7, [#"man_hit_5.wav","man_hit_6.wav","man_hit_7.wav","man_hit_8.wav","man_hit_9.wav","man_hit_10.wav","man_hit_11.wav","man_hit_12.wav","man_hit_13.wav","man_hit_14.wav","man_hit_15.wav","man_hit_17.wav","man_hit_18.wav","man_hit_19.wav","man_hit_22.wav","man_hit_29.wav","man_hit_32.wav","man_hit_57.wav","man_hit_47.wav"]),
 "man_pain_1.wav","man_pain_2.wav","man_pain_3.wav","man_pain_4.wav","man_pain_5.wav"
 ,"man_pain_6.wav","man_pain_7.wav","man_pain_8.wav","man_pain_9.wav","man_pain_10.wav"
 ,"man_pain_11.wav","man_pain_12.wav","man_pain_13.wav","man_pain_14.wav","man_pain_15.wav"
 ,"man_pain_16.wav","man_pain_17.wav","man_pain_18.wav","man_pain_19.wav","man_pain_20.wav"
 ,"man_pain_21.wav","man_pain_22.wav","man_pain_23.wav","man_pain_24.wav"
 ]),
 
 ("man_victory",sf_priority_8|sf_vol_13, [
   ["brit_huzzah1.wav", fac_britain],["brit_godsave2.wav", fac_britain],["brit_king2.wav", fac_britain],["brit_rule1.wav", fac_britain],["brit_nosey1.wav", fac_britain],
   ["fren_empereur1.wav", fac_france],["fren_empereur3.wav", fac_france],["fren_vivala1.wav", fac_france],["fren_vibatrie1.wav", fac_france],["fren_alabataille1.wav", fac_france],
   ["prus_fuerkoenig1.wav", fac_prussia], ["prus_gottschuetze3.wav", fac_prussia], ["prus_fuervater2.wav", fac_prussia], ["prus_hurra1.wav", fac_prussia],["prus_schlagt2.wav", fac_prussia],
   ["rus_battlecry3.wav", fac_russia],["rus_battlecry9.wav", fac_russia],["rus_battlecry5.wav", fac_russia],["rus_battlecry8.wav", fac_russia],["rus_battlecry11.wav", fac_russia],
   ["aus_kaiser1.wav", fac_austria],  ["aus_gottschuetzekaiser1.wav", fac_austria], ["prus_fuervater2.wav", fac_austria], ["prus_hurra1.wav", fac_austria],["prus_schlagt2.wav", fac_austria],
   ["prus_fuerkoenig1.wav", fac_rhine], ["prus_gottschuetze3.wav", fac_rhine], ["prus_fuervater2.wav", fac_rhine], ["prus_hurra1.wav", fac_rhine],["prus_schlagt2.wav", fac_rhine],
   "man_victory_4.ogg","man_victory_5.ogg"]),
 ("fire_loop",sf_priority_9|sf_vol_4|sf_looping|sf_start_at_random_pos, ["Fire_Torch_Loop3.wav"]),
 ("torch_loop",sf_priority_9|sf_vol_4|sf_looping|sf_start_at_random_pos, ["Fire_Torch_Loop3.wav"]),
 ("dummy_hit",sf_priority_9, ["shield_hit_cut_3.wav","shield_hit_cut_5.wav"]),
 ("dummy_destroyed",sf_priority_9, ["shield_broken.ogg"]),
 ("gourd_destroyed",sf_priority_9, ["shield_broken.ogg"]),#TODO
 ("tutorial_fail", sf_2d|sf_vol_7,["cue_failure.ogg"]),
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
This is nearly, with the exception of a space, the exact entry at the NW source already, you didn't edit anything there. Did you really edit something at the sounds? Or did you edit something at the factions?
 

Tocan

Sergeant Knight at Arms
copy and paste from discord:

Skobelev03.12.2020​

There are factionalised sounds in Napoleonic Wars




The Senate03.12.2020​

Sounds



[16:34]
@Skobelev Yeah, and in Native Warband, I can do them. But the compiler I use, WRECK didn't support it



[16:34]
Tocan sent me a solution



[16:35]
I haven't tried it yet, once I do, I'll post for anyone interested




Earendil03.12.2020​

What do you mean with it 'the compiler does not support it'? Is it organised in some extra py files?




The Senate03.12.2020​

?



[17:13]
I mean that WRECK flags the factionalized sounds as errors, while the Native compiler has no problem




Earendil03.12.2020​

Ah, interesting. Whatever witchcraft compiler Tocan has send to you, we might never know now ^^(Bearbeitet)




The Senate03.12.2020​

Ah, no, when I'll try, I'll post the findings, dw




tocan03.12.2020​

don't let wreck proceed the sounds file, it's the easiest solution.
:flushed:
 
Top Bottom