Simple stuff.
Add a comma at the end of the tuple above the one you just added.
So this:
...
#checking if the party is away from his original faction parties
(assign, ":end_cond", kingdom_heroes_end),
(try_for_range, ":enemy_troop_no", kingdom_heroes_begin, ":end_cond"),
(troop_get_slot, ":enemy_party_no", ":enemy_troop_no", slot_troop_leaded_party),
(gt, ":enemy_party_no", 0),
(store_faction_of_party, ":enemy_faction_no", ":enemy_party_no"),
(eq, ":enemy_faction_no", ":faction_no"),
(store_distance_to_party_from_party, ":dist", ":party_no", ":enemy_party_no"),
(lt, ":dist", 4),
(assign, ":end_cond", 0),
(try_end),
(neq, ":end_cond", 0),
(assign, ":continue", 1),
(try_end),
(eq, ":continue", 1),
(call_script, "script_change_troop_faction", ":troop_no", ":new_faction_no"),
(troop_set_slot, ":troop_no", slot_troop_change_to_faction, 0),
(try_begin),
(is_between, ":new_faction_no", kingdoms_begin, kingdoms_end),
(str_store_troop_name_link, s1, ":troop_no"),
(str_store_faction_name_link, s2, ":faction_no"),
(str_store_faction_name_link, s3, ":new_faction_no"),
(display_message, "@{s1} has switched from {s2} to {s3}."),
(try_begin),
(eq, ":faction_no", "$players_kingdom"),
(call_script, "script_add_notification_menu", "mnu_notification_troop_left_players_faction", ":troop_no", ":new_faction_no"),
(else_try),
(eq, ":new_faction_no", "$players_kingdom"),
(call_script, "script_add_notification_menu", "mnu_notification_troop_joined_players_faction", ":troop_no", ":faction_no"),
(try_end),
(try_end),
(try_end),
]),
Instead of this:
...
#checking if the party is away from his original faction parties
(assign, ":end_cond", kingdom_heroes_end),
(try_for_range, ":enemy_troop_no", kingdom_heroes_begin, ":end_cond"),
(troop_get_slot, ":enemy_party_no", ":enemy_troop_no", slot_troop_leaded_party),
(gt, ":enemy_party_no", 0),
(store_faction_of_party, ":enemy_faction_no", ":enemy_party_no"),
(eq, ":enemy_faction_no", ":faction_no"),
(store_distance_to_party_from_party, ":dist", ":party_no", ":enemy_party_no"),
(lt, ":dist", 4),
(assign, ":end_cond", 0),
(try_end),
(neq, ":end_cond", 0),
(assign, ":continue", 1),
(try_end),
(eq, ":continue", 1),
(call_script, "script_change_troop_faction", ":troop_no", ":new_faction_no"),
(troop_set_slot, ":troop_no", slot_troop_change_to_faction, 0),
(try_begin),
(is_between, ":new_faction_no", kingdoms_begin, kingdoms_end),
(str_store_troop_name_link, s1, ":troop_no"),
(str_store_faction_name_link, s2, ":faction_no"),
(str_store_faction_name_link, s3, ":new_faction_no"),
(display_message, "@{s1} has switched from {s2} to {s3}."),
(try_begin),
(eq, ":faction_no", "$players_kingdom"),
(call_script, "script_add_notification_menu", "mnu_notification_troop_left_players_faction", ":troop_no", ":new_faction_no"),
(else_try),
(eq, ":new_faction_no", "$players_kingdom"),
(call_script, "script_add_notification_menu", "mnu_notification_troop_joined_players_faction", ":troop_no", ":faction_no"),
(try_end),
(try_end),
(try_end),
])