Compiling Error

Users who are viewing this thread

Hello,

I'm getting an error I don't understand when compiling:

Code:
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Traceback (most recent call last):
  File "process_party_tmps.py", line 52, in <module>
    save_party_templates()
  File "process_party_tmps.py", line 33, in save_party_templates
    if (len(members) > 6):
TypeError: object of type 'int' has no len()
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...
Exporting mission_template data...

This confuses me greatly because I compiled, got an error because I spelled 'aggressiveness' with one s, corrected the issue, compiled again, and then I'm getting this new error. Does anyone know what I'm dealing with here and how to solve it?
 
Solution
I must stress I am not an ace of Python at all; however, the issue is quite straightforward and easy to deduce.

Len() is an abbreviation of 'length' in Python and it returns the length of something. The function yields the number of characters in a string or items in an object. I do not know what lies in your file, but check for 'members' and if it is a valid object (no integer).
members is a tuple array for the troop stacks in the module_party_templates.py file.
("village_farmers","Village Farmers",icon_peasant|pf_civilian,0,fac_innocents,merchant_personality, [ ( trp_farmer, 5, 10), (trp_peasant_woman, 3, 8 ) ] ),
He probably added aggressiveness value with a comma instead of '|' (combining flags with 'or'...
File "process_party_tmps.py", line 52, in <module>
save_party_templates()
File "process_party_tmps.py", line 33, in save_party_templates
if (len(members) > 6):
TypeError: object of type 'int' has no len()
It simply says you messed up the tuple order somewhere in the module_party_templates file. Post some lines from that file including the one you misspelled "aggressiveness" and other ones you edited recently.
 
Upvote 0
I must stress I am not an ace of Python at all; however, the issue is quite straightforward and easy to deduce.

Len() is an abbreviation of 'length' in Python and it returns the length of something. The function yields the number of characters in a string or items in an object. I do not know what lies in your file, but check for 'members' and if it is a valid object (no integer).
 
Upvote 0
I must stress I am not an ace of Python at all; however, the issue is quite straightforward and easy to deduce.

Len() is an abbreviation of 'length' in Python and it returns the length of something. The function yields the number of characters in a string or items in an object. I do not know what lies in your file, but check for 'members' and if it is a valid object (no integer).
members is a tuple array for the troop stacks in the module_party_templates.py file.
("village_farmers","Village Farmers",icon_peasant|pf_civilian,0,fac_innocents,merchant_personality, [ ( trp_farmer, 5, 10), (trp_peasant_woman, 3, 8 ) ] ),
He probably added aggressiveness value with a comma instead of '|' (combining flags with 'or' statements). We should see the code to be certain.
 
Upvote 0
Solution
members is a tuple array for the troop stacks in the module_party_templates.py file.

He probably added aggressiveness value with a comma instead of '|' (combining flags with 'or' statements). We should see the code to be certain.
I just checked and I did add it with a comma instead. Thanks so much for pointing it out. Amazing that such a small mistake can stop everything in its tracks.
 
Upvote 0
@shar_N
I think i should say 2 more things.

Firstly, there are two flag variables in each party template.
("village_farmers","Village Farmers",icon_peasant|pf_civilian,0,fac_innocents,merchant_personality, [ ( trp_farmer, 5, 10), (trp_peasant_woman, 3, 8 ) ] ),
Blue part is the normal flags and red part is the personality flags. Aggressiveness and courage flags must be added to the personality flags otherwise they mess with the map icon which uses first 8 bits of the normal flags.

Secondly, there are mainly two uses of party templates.
First one is add troops to existing parties.
("kingdom_1_reinforcements_a", "{!}kingdom_1_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_swadian_recruit,5,10),(trp_swadian_militia,2,4)]),
These don't need flags cause target party has those flags. Something to point is if you add a flag to 0, you don't have to use '|'. You can simply replace the 0 cause using or operation with 0 does nothing.
0 | aggressiveness_5
is equal to
aggressiveness_5
Second use is to create new parties.
("steppe_bandits","Steppe Bandits",icon_khergit|carries_goods(2),0,fac_outlaws,bandit_personality,[(trp_steppe_bandit,4,5:cool:]),
These need some flags cause the created party uses them too. These party templates use variables in header_parties as personality flags.
soldier_personality = aggressiveness_8 | courage_9
merchant_personality = aggressiveness_0 | courage_7
escorted_merchant_personality = aggressiveness_0 | courage_11
bandit_personality = aggressiveness_3 | courage_8 | banditness
As you can see each one already has an aggressiveness flag included. If you add a second aggressiveness flag,it produces unstable results.
Examples:
soldier_personality | aggressiveness_7 becomes aggressiveness_15
bandit_personality | aggressiveness_2 is still aggressiveness_3
You should only use one of the flags that uses the same bits.
As an example, let's create a more aggressive steppe bandits template. We can either write the flags seperately,
("aggressive_steppe_bandits","Aggressive Steppe Bandits",icon_khergit|carries_goods(2),0,fac_outlaws, aggressiveness_5 | courage_8 | banditness,[(trp_steppe_bandit,4,5:cool:]),
or we can create a new variable in header_parties and use it.
aggressive_bandit_personality = aggressiveness_5 | courage_8 | banditness
("aggressive_steppe_bandits","Aggressive Steppe Bandits",icon_khergit|carries_goods(2),0,fac_outlaws, aggressive_bandit_personality,[(trp_steppe_bandit,4,5:cool:]),

I just checked and I did add it with a comma instead.
This implies you added aggressiveness flag to some already existing fla value. I think you should check the custom party templates you created. They might contain something wrong especially the last thing i said above about variables.
 
Upvote 0
@shar_N
I think i should say 2 more things.

Firstly, there are two flag variables in each party template.

Blue part is the normal flags and red part is the personality flags. Aggressiveness and courage flags must be added to the personality flags otherwise they mess with the map icon which uses first 8 bits of the normal flags.

Secondly, there are mainly two uses of party templates.
First one is add troops to existing parties.

These don't need flags cause target party has those flags. Something to point is if you add a flag to 0, you don't have to use '|'. You can simply replace the 0 cause using or operation with 0 does nothing.

is equal to

Second use is to create new parties.

These need some flags cause the created party uses them too. These party templates use variables in header_parties as personality flags.

As you can see each one already has an aggressiveness flag included. If you add a second aggressiveness flag,it produces unstable results.
Examples:
soldier_personality | aggressiveness_7 becomes aggressiveness_15
bandit_personality | aggressiveness_2 is still aggressiveness_3
You should only use one of the flags that uses the same bits.
As an example, let's create a more aggressive steppe bandits template. We can either write the flags seperately,

or we can create a new variable in header_parties and use it.




This implies you added aggressiveness flag to some already existing fla value. I think you should check the custom party templates you created. They might contain something wrong especially the last thing i said above about variables.
Thanks for the detailed information, I'm learning a lot.

Instead of making a new thread maybe I will pose a new question here: does anyone know how to edit the wages paid to you as a mercenary group? I don't want the salary to cover the entire cost of my army as I feel like that is a bit unbalanced.
 
Upvote 0
Thanks for the detailed information, I'm learning a lot.

Instead of making a new thread maybe I will pose a new question here: does anyone know how to edit the wages paid to you as a mercenary group? I don't want the salary to cover the entire cost of my army as I feel like that is a bit unbalanced.
A new question is always a new thread.

For your question take a look here:
 
Upvote 0
does anyone know how to edit the wages paid to you as a mercenary group?
I think there is a misunderstanding here. @Eärendil Ardamírë you understood it as the wage of mercenary troops in your party but he is talking about the money a faction pays you weekly after joining them as a mercenary party.
Budget screen you see weekly is a presentation. They are stored at module_presentations.py. The one you're looking for is "budget_report"
("budget_report", 0, mesh_load_window,
related code
Code:
      (try_begin),
        (gt, "$players_kingdom", 0),
        (neq, "$players_kingdom", "fac_player_supporters_faction"),
        (neq, "$players_kingdom", "fac_player_faction"),
        (eq, "$player_has_homage", 0),
        (str_store_faction_name, s0, "$players_kingdom"),
        (create_text_overlay, reg1, "str_mercenary_payment_from_s0", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (call_script, "script_party_calculate_strength", "p_main_party", 0),
        (assign, ":offer_value", reg0),
        (val_div, ":offer_value", 2),
        (val_add, ":offer_value", 30),
        (call_script, "script_round_value", ":offer_value"),
        (val_add, ":net_change", reg0),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (overlay_set_color, reg1, 0x00AA00),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":cur_y", 27),
      (try_end),
I don't want the salary to cover the entire cost of my army as I feel like that is a bit unbalanced.
I think the salary sucks :grin: It doesn't cover your wages if you have a decent party.
 
Upvote 0
Back
Top Bottom