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

Users who are viewing this thread

Brytenwalda trading currently lacks  much diversity. Could this be a source of the errors?
How would I rephrase it to include all those factions?
I removed the brackets below. Your advice?

["raw_flax","Flax Bundle", [("raw_flax",0)], itp_merchandise|itp_type_goods, 0, 200,weight(40)|abundance(90),imodbits_none,[],[fac_kingdom_4,fac_kingdom_5,fac_kingdom_17,fac_kingdom_19,fac_kingdom_27,fac_kingdom_28,fac_kingdom_29,fac_kingdom_30,fac_kingdom_31]],
 
If that's done, where else would one assign certain regions as being producers of certain regions.
The Script code is very confusing and it doesn't allow one to assign towns for trade goods from what I've seen.

If I did continue to list all of this, do you believe that the mod will still only read the first-listed faction?
["raw_flax","Flax Bundle", [("raw_flax",0)], itp_merchandise|itp_type_goods, 0, 200,weight(40)|abundance(90),imodbits_none,[],[fac_kingdom_4,fac_kingdom_5,fac_kingdom_17,fac_kingdom_19,fac_kingdom_27,fac_kingdom_28,fac_kingdom_29,fac_kingdom_30,fac_kingdom_31]],

Thanks,
GDWitt
 
(sigh) gdwitt, if your questions are about modding and not W.R.E.C.K, please post them in Q&A thread. There are many people there and only one me here.
 
The compiler is suddenly rejecting the following script at the bottom of module_items.
1) Why would it reject this now? I have compiled this successfully at least 5 times with these exact lines.
The only thing I did to module_items is remove all the extra kingodm entries
2) Why do I need to include no-swing weapons?

*** Warband Refined & Enhanced Compiler Kit (W.R.E.C.K.) version 0.6.7.5 RC2 ***
Please report errors, problems and suggestions at http://lav.lomskih.net/wreck/

Loading module... FAILED.
MODULE `scripts` ERROR:
Traceback (most recent call last):
  File "compile.py", line 129, in <module>
    from module_scripts import *
  File "C:\Program Files (x86)\Steam\SteamApps\common\MountBlade Warband\_modsextra\Module_system 1.
157 - Brytenwalda 1.41_WORKING\Module_system 1.157 - Brytenwalda 1.41\module_scripts.py", line 18, i
n <module>
    from module_items import items
  File "C:\Program Files (x86)\Steam\SteamApps\common\MountBlade Warband\_modsextra\Module_system 1.
157 - Brytenwalda 1.41_WORKING\Module_system 1.157 - Brytenwalda 1.41\module_items.py", line 3442
    def modmerge(var_set):
      ^
SyntaxError: invalid syntax


COMPILATION FAILED.

Compilation 1 pointed at "from copy import deepcopy" as the bad syntax. So I # out that from copy line and got the result above.
Here is the problematic section at the bottom of module_items.py
MOTO generate no-swing versions of weapons
from copy import deepcopy

def modmerge(var_set):
try:
var_name_1 = "items"
orig_items = var_set[var_name_1]

add_item = deepcopy(orig_items)
for i_item in range(1,len(orig_items)):
type = add_item[i_item][3] & 0x000000ff
# if itp_type_one_handed_wpn <= type <= itp_type_polearm and add_item[i_item-1][3] & itp_next_item_as_melee == 0 and (get_thrust_damage(add_item[i_item][6]) % 256) > 0 and "tutorial" not in add_item[i_item][0] and "arena" not in add_item[i_item][0] and "practice" not in add_item[i_item][0] and "tpe" not in add_item[i_item][0]:
if itp_type_one_handed_wpn <= type <= itp_type_polearm and (get_thrust_damage(add_item[i_item][6])&0xff) > 0 and "tutorial" not in add_item[i_item][0] and "arena" not in add_item[i_item][0] and "practice" not in add_item[i_item][0] and "tpe" not in add_item[i_item][0]:
#Above checks that it is a weapon with thrust damage; also checks that it isn't a tournament-type weapon by checking the item ID (just to prevent not-used items)
add_item[i_item][0] = 'noswing_'+add_item[i_item][0]                  #add noswing_ to the item's name
add_item[i_item][6] = add_item[i_item][6] & ~(ibf_damage_mask << iwf_swing_damage_bits) #should set new item's swing damage to 0
add_item[i_item][4] = add_item[i_item][4] & ~itcf_overswing_polearm  #remove itcf_ capabilties to prevent swinging without damage 
add_item[i_item][4] = add_item[i_item][4] & ~itcf_slashright_polearm                   
add_item[i_item][4] = add_item[i_item][4] & ~itcf_slashleft_polearm
add_item[i_item][4] = add_item[i_item][4] & ~itcf_overswing_onehanded 
add_item[i_item][4] = add_item[i_item][4] & ~itcf_slashright_onehanded                   
add_item[i_item][4] = add_item[i_item][4] & ~itcf_slashleft_onehanded
add_item[i_item][4] = add_item[i_item][4] & ~itcf_overswing_twohanded
add_item[i_item][4] = add_item[i_item][4] & ~itcf_slashright_twohanded                   
add_item[i_item][4] = add_item[i_item][4] & ~itcf_slashleft_twohanded
if type == itp_type_polearm and add_item[i_item][3] & itp_two_handed == 0:
add_item[i_item][4] = add_item[i_item][4] | itcf_thrust_onehanded  #so that the polearms use 'bent elbow' with shields, but normal without
add_item[i_item][3] = add_item[i_item][3] & ~itp_merchandise
# orig_items.insert((len(orig_items)-1), add_item[i_item])        #add right above itm_items_end
orig_items.append(add_item[i_item])

except KeyError:
errstring = "Variable set does not contain expected variable: \"%s\"." % var_name_1
raise ValueError(errstring)

try:
    component_name = "items"
    var_set = { "items" : items }
    modmerge(var_set)
except:
    raise
 
I went back and found that I was missing 3 brackets.
It now compiles without that error.
I find that the error that it points to are always after the actual hidden bug.

By the way, I got the flaxbundle to compile without warnings using this method:[factionx,factiony,factionz]

["raw_flax","Flax Bundle", [("raw_flax",0)], itp_merchandise|itp_type_goods, 0, 200,weight(40)|abundance(90),imodbits_none,[],[fac_kingdom_4,fac_kingdom_5,fac_kingdom_17,fac_kingdom_19,fac_kingdom_27,fac_kingdom_28,fac_kingdom_29,fac_kingdom_30,fac_kingdom_31]],

Now I need to test if works.

Thank you for the tool.
 
Whenever I run WRECK, I get this error:
  unassigned local variable <l.final_price_for_secondary_input[@1224979098644774926]> used by operation store_div in script.process_player_enterprise on line 35

I get this error in Native compilations as well.

Are you seeing it? What can I do to fix it? Is it causing a fail or is this a garbage message?

Here is the relevant script from line 45639 of module_scripts:
    (try_begin),
      (lt, ":number_of_inputs_required", 0),
      (store_div, ":final_price_for_secondary_input", ":final_price_for_secondary_input", 2),
    (else_try),
      (store_mul, ":final_price_for_secondary_input", ":final_price_for_secondary_input", ":number_of_inputs_required"),
    (try_end),

    (store_mul, ":final_price_for_secondary_input", ":base_price", ":cur_price_modifier"),
    (val_div, ":final_price_for_secondary_input", 1000),
  (else_try),
    (assign, ":final_price_for_secondary_input", 0),
  (try_end),
 
  (store_sub, ":profit_per_cycle", ":final_price_for_total_produced_goods", ":final_price_for_total_inputs"),
  (val_sub, ":profit_per_cycle", ":price_of_labor"),
  (val_sub, ":profit_per_cycle", ":final_price_for_secondary_input"),
 
  (assign, reg0, ":profit_per_cycle"),
  (assign, reg1, ":final_price_for_total_produced_goods"),
  (assign, reg2, ":final_price_for_total_inputs"),
  (assign, reg3, ":price_of_labor"),
  (assign, reg4, ":final_price_for_single_produced_good"),
  (assign, reg5, ":final_price_for_single_input"),
  (assign, reg10, ":final_price_for_secondary_input"),
]),

Thank you for any help you can provide.
GDWitt

 
That's a super-old Native error, just fix it by moving (store_mul, ":final_price_for_secondary_input", ":base_price", ":cur_price_modifier"), above the try-begin (and change those useless store_mul/div with the extraneous parameter to val_mul/div)
 
Amazing, it works now.
Thank you for the advice on putting the stor_mul before the try_begin
I like wreck. It consistently finds little errors.
If I get an error that doesn't block compilation, should I let it pass and assume that everything is working?
I'm trying to fix all the bugs in Brytenwalda (mostly missing try_ends) but it is compiling fine with errors.
 
W.R.E.C.K. v1.0.0 Officially Released

Due to successfully passing the stability testing period W.R.E.C.K. latest version (0.6.7.5 Release Candidate 2) has been re-designated as the official release 1.0.0.

My thanks go to all who have tried W.R.E.C.K. so far, as a lot of issues have been identified and fixed with your help.

Not publishing a download link in this post as 1.0.0 is still the same 0.6.7.5 RC2. Not publishing a changelog since nothing changed. Still, you can go to first post in this thread and update your compiler to 1.0.0 to get a sense of achievement. :wink:

The official release will now serve as a stable baseline to start further development of W.R.E.C.K. features, of which quite a number has been planned already but put on hold as I was waiting for stability testing period to expire.
 
I have a question.

I got a failed compilation due to allegedly "undeclared identifiers". But all "undeclared identifiers" are properly declared. They follow all the following scheme: itm.WTribalArab1
All these are declared properly in module_items.py and the module system compiled without any problems, after I added them there. Referencing them in module_troops.py then led to the failed compilation.

Now the weird thing: When I reference them as itm.wtribalarab1 (with all lower case letters) then the compilation seemingly works. What am I doing wrong here?
 
Nothing. WRECK will ignore case for quoted identifiers, same as vanilla compiler, but it currently expects lowercase identifiers when using advanced syntax.
 
Lav said:
Nothing. WRECK will ignore case for quoted identifiers, same as vanilla compiler, but it currently expects lowercase identifiers when using advanced syntax.
OK, thank you for the explanation. I will adapt the code accordingly! Just wanted to thank ou again for WRECK. It makes coding and testing so much easier (I use the integrated ms)! Thank you!
 
Hello, I aint no master within the scripting world.... xD

But I got this problem >> http://prntscr.com/6j1s0m
The vanilla compiler shows no errors.. its only in your compiler.

And your website doesn't work so I figured to post it here
 
Whiticus said:
Hello, I aint no master within the scripting world.... xD

But I got this problem >> http://prntscr.com/6j1s0m
The vanilla compiler shows no errors.. its only in your compiler.
Yes, W.R.E.C.K. is more strict with the code than vanilla compiler (and will be even more strict as new versions roll out). I can't see the screenshot for some reason, but you should post to Q&A thread as it seems your issue is related to your code, not to W.R.E.C.K.
 
Lav said:
Whiticus said:
Hello, I aint no master within the scripting world.... xD

But I got this problem >> http://prntscr.com/6j1s0m
The vanilla compiler shows no errors.. its only in your compiler.
Yes, W.R.E.C.K. is more strict with the code than vanilla compiler (and will be even more strict as new versions roll out). I can't see the screenshot for some reason, but you should post to Q&A thread as it seems your issue is related to your code, not to W.R.E.C.K.

Alright will do! Thanks lav :grin:
 
Back
Top Bottom