More Coding help (Game locks when loading)

Users who are viewing this thread

GameDrifter

Veteran
Ok so here is what I have..

Compiles code fine. But get a Unexpected End of File while reading file: Modules\test\menus.txt error when attempting to load game.

I'm in the process of editing my module_game_menus.py file.
Goal: Change the way player makes a character, moving them into different factions right from start of game based on what options they pick.

Note: I like to use #@ for commenting in my code to tell which is mine.

Here is what I've done so far. A lot of code ahead.  :mrgreen: (Also ignore my bad spelling in the strings of my code I plan to spell check later. Only interested in syntax at this time.)  :lol:

  (
    "start_character",mnf_disable_all_keys,
    "You were born years ago. You...",
    "none",
    [
    (str_clear,s10),
    (str_clear,s11),
    (str_clear,s12),
    (str_clear,s13),
    (str_clear,s14),
#@    (str_clear,s15),
    ],
    [
    ("start_noble",[],"where born into a noble family. And you intend to someday lead the family to greatness.",[
      (assign,"$background_type",cb_noble),
      (assign, reg3, "$character_gender"),
      (str_store_string,s10,"@You came into the world a {reg3?daughter:son} of one the few remaining noble houses,\
owning a number of villages and towns. Your family has seen to your education\
and trained you from childhood for the rigors of aristocracy and life at court."),
(jump_to_menu,"mnu_start_character"),
    ]),
    ("start_merchant",[],"spent your youth wandering aimlessly. But now you have discovered a path to Enlightenment.",[
      (assign,"$background_type",cb_merchant),
      (assign, reg3, "$character_gender"),
      (str_store_string,s10,"@You were born the {reg3?daughter:son} of travelling merchants,\
always moving from place to place in search of a profit. Although your parents were wealthier than most\
and educated you as well as they could, you found little opportunity to make friends on the road,\
living mostly for the moments when you could sell something to somebody."),
(jump_to_menu,"mnu_start_character"),
    ]),
    ("start_guard",[],"intend to master all things from wealth, building, to war.",[
      (assign,"$background_type",cb_guard),
      (assign, reg3, "$character_gender"),
      (str_store_string,s10,"@As a child, your family scrabbled out a meagre living from your father's wages\
as a guardsman to the local lord. It was not an easy existence, and you were too poor to get much of an\
education. You learned mainly how to defend yourself on the streets, with or without a weapon in hand."),
(jump_to_menu,"mnu_start_character"),
    ]),
    ("start_forester",[],"follow the winds, and seek your own destiny.",[
      (assign,"$background_type",cb_forester),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@{reg3?daughter:son}"),
      (str_store_string,s10,"@You were the {reg3?daughter:son} of a family who lived off the woods,\
doing whatever they needed to make ends meet. Hunting, woodcutting, making arrows,\
even a spot of poaching whenever things got tight. Winter was never a good time for your family\
as the cold took animals and people alike, but you always lived to see another dawn,\
though your brothers and sisters might not be so fortunate."),
(jump_to_menu,"mnu_start_character"),
    ]),
    ("start_nomad",[],"led a failed uprising against the lord of your village, And are now on the running.",[
      (assign,"$background_type",cb_nomad),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@{reg3?daughter:son}"),
      (str_store_string,s10,"@You were a child of the steppe, born to a tribe of wandering nomads who lived\
in great camps throughout the arid grasslands.\
Like the other tribesmen, your family revered horses above almost everything else, and they taught you\
how to ride almost before you learned how to walk. "),
(jump_to_menu,"mnu_start_character"),
#@    ]),
#@    ("start_thief",[],"A thief.",[
#@      (assign,"$background_type",cb_thief),
#@      (assign, reg3, "$character_gender"),
#@      (str_store_string,s10,"@As the {reg3?daughter:son} of a thief, you had very little 'formal' education.\
#@ Instead you were out on the street, begging until you learned how to cut purses, cutting purses\
#@ until you learned how to pick locks, all the way through your childhood.\
#@ Still, these long years made you streetwise and sharp to the secrets of cities and shadowy backways."),
#@ (jump_to_menu,"mnu_start_character_2"),
    ]),
##    ("start_priest",[],"Priests.",[
##      (assign,"$background_type",cb_priest),
##      (assign, reg3, "$character_gender"),
##      (str_store_string,s10,"@A {reg3?daughter:son} that nobody wanted, you were left to the church as a baby,\
## a foundling raised by the priests and nuns to their own traditions.\
## You were only one of many other foundlings and orphans, but you nonetheless received a lot of attention\
## as well as many years of study in the church library and before the altar. They taught you many things.\
## Gradually, faith became such a part of your life that it was no different from the blood coursing through your veins."),
## (jump_to_menu,"mnu_start_character_2"),
##    ]),
    ("go_back",[],"Go back",
    [(jump_to_menu,"mnu_start_game_1"),
    ]),
    ]
  ),

1. This bit of code I just renamed start_character_1 to start_character since I wont be going as deep into building the characters background as native does.
2. Commented out start_thief string and menu option since I wont need that many options.
3. Changed each options wording to reflect my finally menu for that screen. At this point it complied and worked fine. Things where as they should be.
4. Edited option 1 to goto start_noble part of script. I just copy pasted start_character_2 (Commenting out original start_character_2 in the process) and remade it to start_noble as a template. (Hadn't complied tested code from that point on)
5. Redirected the other options on that menu to the same menu hoped to loop them back at same screen as a disable till I could get around to fleshing out the code for each sub-menu of each option. This could be where my game error comes into play not sure.

start_noble (again ignore the bad spelling in strings) :mrgreen:
#@ Noble Family Start
  (
    "start_character_noble",0,
    "{s10}^^ Over the centuries Calradia has suffered countless pity wars, famines, and plagues.\
Five great nobel houses have managed to servive the resently ended Darkages. Of which you where born to..",
    "none",
    [],
    [
      ("House Hillgath",[
          ],"House Hillgath of the West.",[
#@      (assign,"$background_answer_noble", cbn_hillgath),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@As a {reg3?girl:boy} growing out of childhood,\
You noticed that your father favored the male hiers of the family more so then female members.\
Asking him about that once got you a long lecture on the primacy of the male as ruler,\
and the long and glorious history of the male rulers of House Hillgath."),
(jump_to_menu,"mnu_start_character_3"),
    ]),
      ("House Rayland",[
          ],"House Rayland of the Northeast.",[
#@      (assign,"$background_answer_noble", cbn_rayland),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@As a {reg3?girl:boy} growing out of childhood,\
You have always been proud of your noble heritage and of House Rayland.\
After all what other great house could be so open to the modern ideals of the day?\
Truly you feel blessed for having been born to this family at this time."),
(jump_to_menu,"mnu_start_character_3"),
    ]),
      ("House Alkar",[
          ],"House Alkar of the South.",[
#@      (assign,"$background_answer_noble", cbn_alkar),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@As a {reg3?girl:boy} growing out of childhood,\
As it has always been, the first born son shale rule in there fathers place when the time comes.\
This is the way of the world, the way of our people since the begging of time.\
Any who challgen the order of things will find life to be very difficult."),
(jump_to_menu,"mnu_start_character_3"),
    ]),
      ("House Novera",[
          ],"House Novera of the North.",[
#@      (assign,"$background_answer_noble", cbn_novera),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@As a {reg3?girl:boy} ,\
You remember as a small child the cold touch of your dead fathers skin apon his deathbed.\
Of the sorrow and tears your mother shead in private when she thought others wheren't looking.\
And the years at her side watching her consolidate power as ruler over her beloved\
dead husbands lands."),
(jump_to_menu,"mnu_start_character_3"),
    ]),
      ("House Durand",[
          ],"House Durand of the Southwest.",[
#@      (assign,"$background_answer_noble", cbn_durand),
      (assign, reg3, "$character_gender"),
      (str_store_string,s11,"@As a {reg3?girl:boy} growing out of childhood,\
You admire your fathers kin sence of knowing how to make a profit. Under his\
stewardship you have seen your families estates grown ten fold over the course\
of your lifetime. And you hope to follow in his footsteps someday."),
(jump_to_menu,"mnu_start_character_3"),
    ]),
      ("go_back",[],"Go back.",
    [(jump_to_menu,"mnu_start_character"),
    ]),
    ]
  ),

1. Setup constants for my five faction listed for future coding use.. Mainly for banner picking time.
2. After a compile told me I haven't used $background_answer_noble I commented out those lines in my code till I could work on that section of coding that needs it.
3. Finally a compile error told me $background_answer_2 wasn't being used I tracked down all remaining code involving that and commented it out. It was listed under begin_adventuring script section.
#@    (try_begin),
#@        (eq,"$background_answer_2",cb2_page),
#@        (troop_raise_attribute, "trp_player",ca_charisma,1),
#@        (troop_raise_attribute, "trp_player",ca_strength,1),
#@        (troop_raise_skill, "trp_player","skl_power_strike",1),
#@        (troop_raise_skill, "trp_player","skl_persuasion",1),
#@        (troop_raise_proficiency, "trp_player",wpt_one_handed_weapon,15),
#@        (troop_raise_proficiency, "trp_player",wpt_polearm,5),
#@    (else_try),
#@        (eq,"$background_answer_2",cb2_apprentice),
#@        (troop_raise_attribute, "trp_player",ca_intelligence,1),
#@        (troop_raise_attribute, "trp_player",ca_strength,1),
#@        (troop_raise_skill, "trp_player","skl_engineer",1),
#@        (troop_raise_skill, "trp_player","skl_trade",1),
#@    (else_try),
#@        (eq,"$background_answer_2",cb2_urchin),
#@        (troop_raise_attribute, "trp_player",ca_agility,1),
#@        (troop_raise_attribute, "trp_player",ca_intelligence,1),
#@        (troop_raise_skill, "trp_player","skl_spotting",1),
#@        (troop_raise_skill, "trp_player","skl_looting",1),
#@        (troop_raise_proficiency, "trp_player",wpt_one_handed_weapon,15),
#@        (troop_raise_proficiency, "trp_player",wpt_throwing,5),
#@    (else_try),
#@        (eq,"$background_answer_2",cb2_steppe_child),
#@        (troop_raise_attribute, "trp_player",ca_strength,1),
#@        (troop_raise_attribute, "trp_player",ca_agility,1),
#@        (troop_raise_skill, "trp_player","skl_horse_archery",1),
#@        (troop_raise_skill, "trp_player","skl_power_throw",1),
#@        (troop_raise_proficiency, "trp_player",wpt_archery,15),
#@        (call_script,"script_change_troop_renown", "trp_player", 5),
#@    (else_try),
#@        (eq,"$background_answer_2",cb2_merchants_helper),
#@        (troop_raise_attribute, "trp_player",ca_intelligence,1),
#@        (troop_raise_attribute, "trp_player",ca_charisma,1),
#@        (troop_raise_skill, "trp_player","skl_inventory_management",1),
#@        (troop_raise_skill, "trp_player","skl_trade",1),
## (else_try),
##        (eq,"$background_answer_2",5),
##        (troop_raise_attribute, "trp_player",ca_intelligence,1),
##        (troop_raise_attribute, "trp_player",ca_charisma,1),
##        (troop_raise_skill, "trp_player",skl_leadership,1),
##        (troop_raise_skill, "trp_player",skl_athletics,1),
##        (troop_raise_skill, "trp_player",skl_riding,1),
##        (troop_raise_proficiency, "trp_player",1,5),
##        (troop_raise_proficiency, "trp_player",2,5),
##        (call_script,"script_change_troop_renown", "trp_player", 15),
## (else_try),
##        (eq,"$background_answer_2",6),
##        (troop_raise_attribute, "trp_player",ca_charisma,3),
##        (troop_raise_attribute, "trp_player",ca_agility,1),
##        (troop_raise_skill, "trp_player",skl_weapon_master,1),
##        (troop_raise_proficiency, "trp_player",0,15),
##        (troop_raise_proficiency, "trp_player",2,10),
##        (troop_raise_proficiency, "trp_player",4,10),
##        (call_script,"script_change_troop_renown", "trp_player", 20),
## (else_try),
##        (eq,"$background_answer_2",7),
##        (troop_raise_attribute, "trp_player",ca_intelligence,1),
##        (troop_raise_attribute, "trp_player",ca_charisma,2),
##        (troop_raise_skill, "trp_player",skl_leadership,1),
##        (troop_raise_skill, "trp_player",skl_tactics,1),
##        (troop_raise_proficiency, "trp_player",0,10),
##        (troop_raise_proficiency, "trp_player",1,10),
##        (call_script,"script_change_troop_renown", "trp_player", 15),
## (else_try),
##        (eq,"$background_answer_2",:cool:,
##        (troop_raise_attribute, "trp_player",ca_agility,1),
##        (troop_raise_attribute, "trp_player",ca_intelligence,1),
##        (troop_raise_attribute, "trp_player",ca_charisma,1),
##        (troop_raise_skill, "trp_player",skl_leadership,1),
##        (troop_raise_skill, "trp_player",skl_surgery,1),
##        (troop_raise_skill, "trp_player",skl_first_aid,1),
##        (troop_raise_proficiency, "trp_player",2,10),
##        (call_script,"script_change_troop_renown", "trp_player", 5),
#@ (try_end),

After that I had a clean compile. And then the failed game load/error...

That's about where I am stuck now. Am I missing something that lets me compile but crashes game in the coding? I suspect my redirection menu's back onto themselves as possible issue. But still learning the in's and out's of coding mods..

Oh this is M&B I'm doing this for not Warband  :mrgreen:
 
have you compared actual menu.txt before and after your changes? Does end of file is actually the same? It should be, unless you changed other things too

Also, I'm not sure that meny labels work when spaced and Capitalized.
Code:
 ("House Hillgath",[ ...
 
GetAssista said:
have you compared actual menu.txt before and after your changes? Does end of file is actually the same? It should be, unless you changed other things too

Also, I'm not sure that meny labels work when spaced and Capitalized.
Code:
 ("House Hillgath",[ ...

Yeah that past the compiler test but at the time I saw no other examples of the original code needing the label so figured it was mainly for the coders use.
 
Yeah checked over my menu.txt in my mod vs one in native mine is a tad smaller.. Guess I'll backup my work and recopy a fresh example of the file. I do hate when I reach points in tweaking the code where I am forced to do a lot of editing at once in order to even hope to re-compile/run the mod.. It's always when the problems come up.. :roll:
 
Decapitalize and delimit your menu option labels with underslashes.
Open up menu.txt and search for tab characters. I have a feeling that your editor has tabs enabled by default to align text when you break off a line in the middle.

    "{s10}^^ Over the centuries Calradia has suffered countless pity wars, famines, and plagues.\
---> Five great nobel houses have managed to servive the resently ended Darkages. Of which you where born to..",
    "none",
 
Back
Top Bottom