• The forum has been updated. For an explanation of some of the changes, head over here.

Python compiled but getting error during game load

Currently viewing this thread:

I have made some changes to game_menus.py and constants.py and the module compiled with no errors but when I load the mod I get the C++ Error when the start up bar hits "loading settings data".

Any idea what could be the problem?
 

Somebody

Code Pope
Baron
WBWF&S
Your game menu has tabs instead of spaces from within the description string, search for \t at the beginning of your lines.
 
Thanks for the reply. Do you mean in the generated txt file?

All I have done in the game_menus is expand the character creation options and expand the skills they get for them. I have triple checked and everything is inputted properly. You are supposed to put an \ on the end of the lines and I have. I did battle with errors for a while but I figured that a complete compilation will mean everything is ok.

I have increased the amount of character menus from 4 to 36, could that be too many? I doubt it but I could not see any obvious problem with the python file.
 

Lumos

Archduke
WBWF&SNWM&BVC
I believe Somebody meant that there are tabs in your .py file, after you hit the enter after the backslash at each line's end. To avoid such a problem, I'd recommend you use the caret (^) instead, like this: "This is the menu's string.^And this is the second line of the menu's string.", without doing backslash-cr-lf everywhere. I had the same problems, but "careting" fixed them. :razz:
 
So instead of this

      ("ferryman",[],"A ferryman.",[
        (assign,"$background_answer_27",cb27_ferryman),
      (str_store_string,s14,"@{reg3?daughter:man}"),
      (str_store_string,s12,"@You always liked being outdoors no matter what and this gave you a chance to use your best weapons, your ears and your brain.\
You spent your time as a ferryman across the busiest stretches of water listening in to the conversations of your patrons and seeing if you can divulge any\
information your band could use for profit. Hidden at either side of the crossing were highwaymen who would wait for your signal that one or\
more of the travellers were worth following."),
(jump_to_menu,"mnu_start_character_4"),
        ]),

I should put?

        ("ferryman",[],"A ferryman.",[
        (assign,"$background_answer_27",cb27_ferryman),
      (str_store_string,s14,"@{reg3?daughter:man}"),
      (str_store_string,s12,"@You always liked being outdoors no matter what and this gave you a chance to use your best weapons, your ears and your brain.^You spent your time as a ferryman across the busiest stretches of water listening in to the conversations of your patrons and seeing if you can divulge any^information your band could use for profit. Hidden at either side of the crossing were highwaymen who would wait for your signal that one or^more of the travellers were worth following."),
(jump_to_menu,"mnu_start_character_4"),
        ]),

With the text all on one line.


Thanks for helping, I put weeks into this so would be gutted if it fell at the final hurdle.
 

Lumos

Archduke
WBWF&SNWM&BVC
Yeah, this should work. You could also comment the larger part of your new menus (seriously, 36 pages, holy crap, that's a lot! Welcome to the club... :grin:), leaving only the first one, then tracking the error menu by menu to see when it appears. But that's probably going to be quite some work, I wouldn't do it.
 
Those two are different. A "\" at the end of line means the string continues in the next line, while "^" means a new line when the code actually executes.
As Somebody said, try to fix the first version by removing all white space, including tabs, in front of the string continuation lines like these:
You always liked your ears and your brain.\
[problem here, don't put tabs or anything else in front!]You spent your time as a ferryman...

To get rid of tab problems completely, make them expand into 4 spaces in your editor options. Tabs are evil.
 

Lumos

Archduke
WBWF&SNWM&BVC
MadVader said:
Those two are different. A "\" at the end of line means the string continues in the next line, while "^" means a new line when the code actually executes.
Sure, but is the outcome not the same? In either case, it's a new line in-game, and the caret way is the easy way. isn't it?
 
No, there are no carets in the first code sample, so no newlines. The "\" is only interpreted by Python and is not included in the final string.
I agree that writing the string in one line (and having word wrap set in your editor) is the most failsafe method. In addition, generous use of carets/newlines is also appreciated by the players as they don't like walls of text.
 

Lumos

Archduke
WBWF&SNWM&BVC
Oh, damn, now I want to stick my head in a pile of sand or something. All this time I'd thought that using the backslash give you a newline in the string. Well, I never use it anyway, so I guess I haven't lost much. :grin:
 
MadVader said:
Those two are different. A "\" at the end of line means the string continues in the next line, while "^" means a new line when the code actually executes.
As Somebody said, try to fix the first version by removing all white space, including tabs, in front of the string continuation lines like these:
You always liked your ears and your brain.\
[problem here, don't put tabs or anything else in front!]You spent your time as a ferryman...

To get rid of tab problems completely, make them expand into 4 spaces in your editor options. Tabs are evil.

Thanks for the example madvader. I just went through every one and made sure there was no spaces before the first letter in the lines. Unfortunately the error still appeared at "loading settings data". I will now try the caret style and turn word wrap on and see what happens.

Any ideas if that does not work?
 

dunde

Count
WB
In my experience, spaces at mno_ids will crash the game on loading stage too.
If you're too lazy to find where you put the space at your module_game_menus.py, then you can modify the process_game_menus.py like this :
Code:
def save_game_menu_item(ofile,variable_list,variable_uses,menu_item,tag_uses,quick_strings):
  # Dunde BEGIN
  mno_id = convert_to_identifier(menu_item[0])
  ofile.write(" mno_%s "%(mno_id))
  #ofile.write(" mno_%s "%(menu_item[0]))
  # Dunde END
  save_statement_block(ofile,0, 1, menu_item[1], variable_list, variable_uses,tag_uses,quick_strings)
  ofile.write(" %s "%(string.replace(menu_item[2]," ","_")))
  save_statement_block(ofile,0, 1, menu_item[3], variable_list, variable_uses,tag_uses,quick_strings)
  door_name = "."
  if (len(menu_item) > 4):
    door_name = menu_item[4]
  ofile.write(" %s "%(string.replace(door_name," ","_")))
 
I tried the character texts in madvaders failsafe mode and the error is still there. If it is not in the text then it is either the skill delegation code for each choice which is straight forward in nature and seems fine or the module constants but all I did in there is add the new character backgrounds with groups and a number next to each one,

like this

cb17_scout = 1
cb17_spy    = 2
cb17_fightschool =  3
cb17_prison  = 4
cb17_interpreter  = 5
cb17_caravan = 6


Unless it is because of the "$background_type" and "$background_answer_?" assignment in the text code. As far as I can tell they both seem to mean the same thing. The original code has background_type as the code for the first set of options and background_answer for the next 3 so I did mine like that for the new factions. I did make them all "background_answer_?" to test and it made no difference so it may not be this.


The way this character creation works (if it makes a difference) is not that there are 36 different screens to go through but we have 13 factions and each of them has their own set of options.

So 1 faction would go 1-11-24, another 3-17-30 and another 7-20-33, for example. Maybe the game cannot deal with that much text?
 
dunde said:
In my experience, spaces at mno_ids will crash the game on loading stage too.
If you're too lazy to find where you put the space at your module_game_menus.py, then you can modify the process_game_menus.py like this :
Code:
def save_game_menu_item(ofile,variable_list,variable_uses,menu_item,tag_uses,quick_strings):
  # Dunde BEGIN
  mno_id = convert_to_identifier(menu_item[0])
  ofile.write(" mno_%s "%(mno_id))
  #ofile.write(" mno_%s "%(menu_item[0]))
  # Dunde END
  save_statement_block(ofile,0, 1, menu_item[1], variable_list, variable_uses,tag_uses,quick_strings)
  ofile.write(" %s "%(string.replace(menu_item[2]," ","_")))
  save_statement_block(ofile,0, 1, menu_item[3], variable_list, variable_uses,tag_uses,quick_strings)
  door_name = "."
  if (len(menu_item) > 4):
    door_name = menu_item[4]
  ofile.write(" %s "%(string.replace(door_name," ","_")))


Thank you so much, I went through over 200 pieces of text with a fine tooth comb and it did not work but that piece of code has made the bar get to the end and start the game. I am wondering now if the problem is in the character creation skill points code because the amount of points given when you reach the character screen is way too high and in the wrong place for many. Could be unrelated though.

Either way thank you, does that code change tell the game to ignore the spaces?
 

dunde

Count
WB
Nameless Warrior said:
I am wondering now if the problem is in the character creation skill points code because the amount of points given when you reach the character screen is way too high and in the wrong place for many. Could be unrelated though.
That's unrelated error. May be you use add_xp_to_troop somewhere else without 2nd param, or with 2n param=0 that mean the xp will be given to trp_player.

Nameless Warrior said:
Either way thank you, does that code change tell the game to ignore the spaces?
The code converts spaces found at mno_ids into '_' before they're written into txt files, just the same way native have done to any other ids (like troop_ids, item_ids, etc). I don't know why they forgot to do it to mno_ids, may be because not like other ids, mno_ids must not be unique.
 
dunde said:
Nameless Warrior said:
I am wondering now if the problem is in the character creation skill points code because the amount of points given when you reach the character screen is way too high and in the wrong place for many. Could be unrelated though.
That's unrelated error. May be you use add_xp_to_troop somewhere else without 2nd param, or with 2n param=0 that mean the xp will be given to trp_player.

Nameless Warrior said:
Either way thank you, does that code change tell the game to ignore the spaces?
The code converts spaces found at mno_ids into '_' before they're written into txt files, just the same way native have done to any other ids (like troop_ids, item_ids, etc). I don't know why they forgot to do it to mno_ids, may be because not like other ids, mno_ids must not be unique.

Good thing it works too, I never would have found the space on my own, thanks again  :grin:

I don't think the stats problem is an add_xp_to_troop thing, I have searched game_menus and scripts and nothing in their corresponds. In my test build I choose options which are supposed to give 1 in power strike and nothing in ironflesh, power draw and shield yet when the skill choice screen comes the character already has iron flesh 6, power strike 8  :shock: , shield 5, etc.

Strength and agility are up near 20 which is ridiculous, however the intelligence and charisma number looks good as do most of the middle to low skills. It is like the character gets a super boost in all the combat based stats and attributes pre skill selection yet there is nothing in the game menus which is causing this. I have put the file side by side with the default game_menus and there is no extra text beyond the menu expansion. I have looked through both trigger files as well and nothing really seems to be related to attributes and skills or the start of the game.

I have been modding on and off for 3 years and one thing I have found with python/ mount and blade module is that I always have to go many extra miles to get it to work as I envisage  :lol:





Somebody said:
Why not just have separate variables for each level of menus?

Do you mean that instead of having an option in "start_character_25" being assigned "cb25_bowman" for the skill assignment code it could instead be assigned "cb3_bowman" and the same goes for all options at that level even if they are in different character menus?. Would that make a difference?

As it stands they all have different character menu options at all levels apart from the "and soon everything changed...." level which they all share.
 
Top Bottom