OSP Code SP [WB v1.127] New presentations for reports (v1.2)

Users who are viewing this thread

jrider

Veteran
Here are some presentations I wrote to learn how they work (so the code it fairly commented) and to replace some of the reports menus (this is for Warband 1.127).

feel free to reuse or modify (these are v1.2), for Warband v1.127.

  • First attempt: a standalone presentation for faction relation, that extend things a bit
    Screenshot:
    factionsrelations.jpg
  • Second attempt: originaly planned as replacement for Known lord relations, it grew into doing Courtship and character/companions and including faction filters
    Screenshots:
    charrel1.jpg
    charrel2.jpg
    charrel3.jpg
    charrel4.jpg

Changelog:
  • v1.0 :
     
    • initial release
  • v1.1 :
     
    • Fixed scrollbar mishandling in Factions Relations report presentation (post #1).
  • v1.2 :
     
    • Fixed scrollbar mishandling in Character Relations report presentation (post #2 & 3).
       
    • Added current equipment for Player/Companions with item tooltip (without modifiers) (post #4)


I also started using a method to keep the new stuff I write separate from the native source file (except when changes in these are needed), to minimize the impact when merging with other mods code.
The basic principle is to reuse the method that's used in triggers.

all you'd have to do is add an import at the beginning of the native file for the external module like (example for scripts)
Code:
from module_jrider_scripts import *

add the new contents at the end of the tuple you want it in as it's done for triggers (example for scripts)
Code:
scripts = [
...
] + jrider_scripts

with the external code in a separate module (copy/paste the standard imports from it's native equivalent at the beginning so that it compiles) and declare a tuple for your own code (example as above in module_jrider_scripts.py):
Code:
jrider_scripts = [
...
]

I present the code below in the traditional way to add in native's module, when a part can be externalized in the fashion described above, I'll put the External tag in the spoiler.


The first presentation is pretty straightforward, it's just display with the calculations inside the presentation itself, it handles some extra value for the Diplomacy Mod, that you can comment (or keep, there's no Diplomacy specific variables used here):

I used an extra mesh, to access to an existing resource in CommonRes, so you just need to add this to the meshes in module_meshes.py, at the end is fine :
Code:
  # Jrider +
  ("message_window", 0, "message_window", 0, 0, 0, 0, 0, 0, 0.8, 0.5, 0.5), # in core_ui_meshes.brf
  # Jrider -

This goes into module_presentations.py
Code:
  # Jrider +
  # REPORTS PRESENTATIONS 1.2 :
  # Factions relations presentation report
  ("jrider_faction_relations_report", 0,
   mesh_message_window,
   [
     (ti_on_presentation_load,
      [
    (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),

        # Embed picture upper right
        (create_mesh_overlay, reg1, "mesh_pic_castledes"),
        (position_set_x, pos1, 180),
        (position_set_y, pos1, 180),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 795),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),

        # Embed picture upper left
        (create_mesh_overlay, reg1, "mesh_pic_looted_village"),
        (position_set_x, pos1, 170),
        (position_set_y, pos1, 170),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, -15),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),

    # Presentation title, centered at the top
        (create_text_overlay, reg1, "@_Faction Relations Report_", tf_center_justify),
    (position_set_x, pos1, 500), # Higher, means more toward the right
        (position_set_y, pos1, 670), # Higher, means more toward the top
        (overlay_set_position, reg1, pos1),
    (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
    (overlay_set_size, reg1, pos1),

    # Back to menu - graphical button
    (create_game_button_overlay, reg1, "@_Return to menu_"),
    (position_set_x, pos1, 500),
        (position_set_y, pos1, 23),
        (overlay_set_position, reg1, pos1),
        (assign, "$g_jrider_faction_report_Return_to_menu", reg1),

    # Set Headlines
    (assign, ":x_poshl", 215),
     (assign, ":y_pos", 597),
     (assign, ":headline_size", 0),
    (position_set_x, ":headline_size", 720),
        (position_set_y, ":headline_size", 775),
        
        (assign, ":hl_columnsep_size", 50),
    (position_set_x, ":hl_columnsep_size", 60),
        (position_set_y, ":hl_columnsep_size", 1600),

        (create_text_overlay, reg2, "@Player^Relation", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (position_set_x, pos1, ":x_poshl"),
        (position_set_y, pos1, ":y_pos"),
        (overlay_set_position, reg2, pos1),

        # Headlines for Faction 1, 5
        (create_text_overlay, reg2, "@Status", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 55),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # create a separator column
        (create_mesh_overlay, reg1, "mesh_white_plane"),
        (overlay_set_color, reg1, 0x000000),
        (overlay_set_size, reg1, ":hl_columnsep_size"),
        (store_sub, ":line_x", ":x_poshl", 21), # set it 21 pix left of current column start
        (position_set_x, pos2, ":line_x"),
        (position_set_y, pos2, ":y_pos"),
        (overlay_set_position, reg1, pos2),

        (create_text_overlay, reg2, "@Relation", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 110),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # Headlines for Faction 2, 6
        (create_text_overlay, reg2, "@Status", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 55),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # create a separator column
        (create_mesh_overlay, reg1, "mesh_white_plane"),
        (overlay_set_color, reg1, 0x000000),
        (overlay_set_size, reg1, ":hl_columnsep_size"),
        (store_sub, ":line_x", ":x_poshl", 21), # set it 21 pix left of current column start
        (position_set_x, pos2, ":line_x"),
        (position_set_y, pos2, ":y_pos"),
        (overlay_set_position, reg1, pos2),

        (create_text_overlay, reg2, "@Relation", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 110),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # Headlines Faction 3,7
        (create_text_overlay, reg2, "@Status", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 55),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # create a separator column
        (create_mesh_overlay, reg1, "mesh_white_plane"),
        (overlay_set_color, reg1, 0x000000),
        (overlay_set_size, reg1, ":hl_columnsep_size"),
        (store_sub, ":line_x", ":x_poshl", 21), # set it 21 pix left of current column start
        (position_set_x, pos2, ":line_x"),
        (position_set_y, pos2, ":y_pos"),
        (overlay_set_position, reg1, pos2),

        (create_text_overlay, reg2, "@Relation", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 110),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # Headlines Faction 4
        (create_text_overlay, reg2, "@Status", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 55),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # create a separator column
        (create_mesh_overlay, reg1, "mesh_white_plane"),
        (overlay_set_color, reg1, 0x000000),
        (overlay_set_size, reg1, ":hl_columnsep_size"),
        (store_sub, ":line_x", ":x_poshl", 21), # set it 21 pix left of current column start
        (position_set_x, pos2, ":line_x"),
        (position_set_y, pos2, ":y_pos"),
        (overlay_set_position, reg1, pos2),

        (create_text_overlay, reg2, "@Relation", tf_center_justify),
        (overlay_set_size, reg2, ":headline_size"),
        (val_add, ":x_poshl", 110),
        (position_set_x, pos1, ":x_poshl"),
        (overlay_set_position, reg2, pos1),

        # clear the string globals that we'll use
         (str_clear, s9),
    (str_clear, s8),
    (str_clear, s3),
    (str_clear, s60),
    (str_clear, s61),
    (str_clear, s0),

        # Scrollable area (all the next overlay will be contained in this, s0 sets the scrollbar)
        (create_text_overlay, reg1, s0, tf_scrollable_style_2),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 70),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 860),
        (position_set_y, pos1, 527),
        (overlay_set_area_size, reg1, pos1),
        (set_container_overlay, reg1),

        # set base position and size for lines
        (assign, ":line_size", 0),
        (assign, ":y_pos", 0),

        # set base color for line
    (assign, ":line_color", 0x000000),

        # Line faction loop begins here - fetching corresponding informations and printing the line title
        (try_for_range_backwards, ":faction_line", kingdoms_begin, kingdoms_end),
            (faction_slot_eq, ":faction_line", slot_faction_state, sfs_active), # continue if active

            # Base position for subheaders
            (assign, ":x_posfhl", 220),
            (assign, ":y_posfhl", ":y_pos"),

            # Loop other factions (columns)
            (try_for_range_backwards, ":faction_column", kingdoms_begin, kingdoms_end),
                (neq, ":faction_column", ":faction_line"),
                (faction_slot_eq, ":faction_column", slot_faction_state, sfs_active), # continue if active

                (str_store_faction_name, s8, ":faction_column"),

                # wrap y_pos if line end reached
                (try_begin),
                    (ge, ":x_poshl", 825),
                    (assign, ":x_poshl", 165),
                    (val_add, ":y_pos", 18),
                (try_end),

                # sub-faction excluding current faction line
                (try_begin),
                    # different from faction line, display status and relation with faction line
                    (neq, ":faction_column", ":faction_line"),
                    (call_script, "script_diplomacy_faction_get_diplomatic_status_with_faction", ":faction_line", ":faction_column"),
                    (assign, ":global_diplomatic_status", reg0),
                    (assign, ":extended_diplomatic_status", reg1),

                    (try_begin), # War
                        (eq, ":global_diplomatic_status", -2),
                        (str_store_string, s60, "@War"),
                        (assign, reg60, 0xDD0000),
                        (assign, reg59, 0),
                    (else_try), # Border incident
                        (eq, ":global_diplomatic_status", -1),
                        (str_store_string, s60, "@Casus Belli"),
                        (assign, reg60, 0xDD8000),
                        (assign, reg59, ":extended_diplomatic_status"),
                    (else_try), # Peace
                        (eq, ":global_diplomatic_status", 0),
                        (str_store_string, s60, "@Peace"),
                        (assign, reg60, 0xFFFFFF),
                        (assign, reg59, 0),
                    (else_try), # Truce (or agreement if usigng Diplomacy)
                        (eq, ":global_diplomatic_status", 1),
                        (str_store_string, s60, "@Truce"),
                        (assign, reg60, 0xDDDDDD),
                        (assign, reg59, ":extended_diplomatic_status"),

                        # for Diplomacy, comment if not using
                        (try_begin),
                            (ge, ":extended_diplomatic_status", 61),
                            (str_store_string, s60, "@Alliance"),
                            (assign, reg60, 0x00FF00),
                            (store_sub, reg59, ":extended_diplomatic_status", 60),
                        (else_try),
                            (ge, ":extended_diplomatic_status", 41),
                            (str_store_string, s60, "@Defense Pact"),
                            (assign, reg60, 0x00FFAA),
                            (store_sub, reg59, ":extended_diplomatic_status", 40),
                        (else_try),
                            (ge, ":extended_diplomatic_status", 21),
                            (str_store_string, s60, "@Trade Agreement"),
                            (assign, reg60, 0x00FFCC),
                            (store_sub, reg59, ":extended_diplomatic_status", 20),
                        (try_end),
                    (try_end),

                    (val_add, ":x_poshl", 55),

                     # create a sub-separator column
                     (create_mesh_overlay, reg1, "mesh_white_plane"),
                     (overlay_set_color, reg1, ":line_color"),
                     (position_set_x, pos3, 50),
                     (position_set_y, pos3, 1800),
                     (overlay_set_size, reg1, pos3),
        
                     (store_sub, ":line_x", ":x_posfhl", 20), # set it 20 pix left of current column start
                     (position_set_x, pos3, ":line_x"),
                     (store_add, ":line_y", ":y_pos", 2), # set it below 2 pix of current position

                     (position_set_y, pos3, ":line_y"),
                     (overlay_set_position, reg1, pos3),

                    # diplomatic status and duration block (set at current line)
                    # add diplomatic status 
                    (store_relation, ":kingdom_relation", ":faction_line", ":faction_column"),
                    (create_text_overlay, reg10, "@{s60}", tf_left_align|tf_with_outline),
                    (overlay_set_size, reg10, ":line_size"),
                    (overlay_set_color, reg10, reg60),

                    (store_sub, ":line_x", ":x_poshl", 15),
                    (position_set_x, pos1, ":line_x"),
                    (position_set_y, pos1, ":y_pos"),
                    (overlay_set_position, reg10, pos1),

                    # status duration left (same line, shift x to right)
                    (val_add, ":x_poshl", 110),
                    (create_text_overlay, reg10, "@{reg59?{reg59} days:}", tf_center_justify),
                    (overlay_set_size, reg10, ":line_size"),

                    (store_add, ":line_x", ":x_poshl", 5),
                    (position_set_x, pos1, ":line_x"),
                    (position_set_y, pos1, ":y_pos"),
                    (overlay_set_position, reg10, pos1),

                    # Faction name and relation (increase to previous line)
                    # Faction name headlines
                    (create_text_overlay, reg10, s8, tf_left_align|tf_with_outline),
                    (overlay_set_size, reg10, ":line_size"),
                    (faction_get_color, ":faction_color", ":faction_column"),
                    (overlay_set_color, reg10, ":faction_color"),

                    (store_sub, ":line_x", ":x_posfhl", 20),
                    (store_add, ":line_y", ":y_pos", 18),
                    (position_set_x, pos3, ":line_x"),
                    (position_set_y, pos3, ":line_y"),
                    (overlay_set_position, reg10, pos3),

                    # kingdom relation (same line as faction name)
                    (assign, reg61, ":kingdom_relation"),
                    (create_text_overlay, reg10, "@{reg61}", tf_center_justify),
                    (overlay_set_size, reg10, ":line_size"),

                    (store_add, ":line_x", ":x_poshl", 10),
                    (position_set_x, pos3, ":line_x"),
                    (position_set_y, pos3, ":line_y"),
                    (overlay_set_position, reg10, pos3),
                (try_end), # end select alternate display

                # increase column x position
                (val_add, ":x_posfhl", 165), # valid values 220, 385, 550, 715

                # wrap if line end for faction column name reached
                (try_begin),
                    (gt, ":x_posfhl", 715),
                    (assign, ":x_posfhl", 220),
                    (assign, ":y_posfhl", ":y_pos"),
                    (val_add, ":y_posfhl", 18),
                (try_end),        

                # starting new column
                (try_begin),
                    (eq, ":x_posfhl", 220),

                    # create a sub-separator line above current line
                    (create_mesh_overlay, reg1, "mesh_white_plane"),
                    (overlay_set_color, reg1, ":line_color"),
                    (position_set_x, pos1, 32800),
                    (position_set_y, pos1, 50),
                    (overlay_set_size, reg1, pos1),
        
                    (position_set_x, pos1, 200),
                    (store_add, ":line_y", ":y_pos", 38), # set it 20 pix above current line
                    (position_set_y, pos1, ":line_y"),
                    (overlay_set_position, reg1, pos1),

                    (val_add, ":y_pos", 18),
                (try_end),
            (try_end), # end of column faction loop

            # Faction line information, this is a 4 line block
            # reset x postion for next beginning column and decrease y position according to line count
            (assign, ":x_poshl", 165),

            (val_add, ":y_pos", 18), # linebreak

            # create a separator for faction line
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (overlay_set_color, reg1, 0x000000),
            (position_set_x, pos1, 42000),
            (position_set_y, pos1, 60),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 17),
            (store_add, ":line_y", ":y_pos", 20), # set it 20 pix above current line
            (position_set_y, pos1, ":line_y"),
            (overlay_set_position, reg1, pos1),

            # Set line title
            (str_store_faction_name, s9, ":faction_line"),
            (str_store_string, s1, "@{s9}"),
            (create_text_overlay, reg10, s1, tf_left_align|tf_with_outline),
            (faction_get_color, ":faction_color", ":faction_line"),
            (overlay_set_color, reg10, ":faction_color"),

            (position_set_x, pos3, 750),
            (position_set_y, pos3, 850),
            (overlay_set_size, reg10, pos3),

            (position_set_x, pos3, 10),
            (position_set_y, pos3, ":y_pos"),
            (overlay_set_position, reg10, pos3),

            # set position for columns
            (assign, ":x_poshl", 165),
            (assign, ":line_size", 0),
            (position_set_x, ":line_size", 700),
            (position_set_y, ":line_size", 800),

            ## Player relation (first column)
            (store_relation, reg1, "fac_player_supporters_faction", ":faction_line"),

            # no clean strings existing, doing it the same way it's done in game_menu
            (try_begin),
                (ge, reg1, 90),
                (str_store_string, s3, "@Loyal"),
            (else_try),
                (ge, reg1, 80),
                (str_store_string, s3, "@Devoted"),
            (else_try),
                (ge, reg1, 70),
                (str_store_string, s3, "@Fond"),
            (else_try),
                (ge, reg1, 60),
                (str_store_string, s3, "@Gracious"),
            (else_try),
                (ge, reg1, 50),
                (str_store_string, s3, "@Friendly"),
            (else_try),
                (ge, reg1, 40),
                (str_store_string, s3, "@Supportive"),
            (else_try),
                (ge, reg1, 30),
                (str_store_string, s3, "@Favorable"),
            (else_try),
                (ge, reg1, 20),
                (str_store_string, s3, "@Cooperative"),
            (else_try),
                (ge, reg1, 10),
                (str_store_string, s3, "@Accepting"),
            (else_try),
                (ge, reg1, 0),
                (str_store_string, s3, "@Indifferent"),
            (else_try),
                (ge, reg1, -10),
                (str_store_string, s3, "@Suspicious"),
            (else_try),
                (ge, reg1, -20),
                (str_store_string, s3, "@Grumbling"),
            (else_try),
                (ge, reg1, -30),
                (str_store_string, s3, "@Hostile"),
            (else_try),
                (ge, reg1, -40),
                (str_store_string, s3, "@Resentful"),
            (else_try),
                (ge, reg1, -50),
                (str_store_string, s3, "@Angry"),
            (else_try),
                (ge, reg1, -60),
                (str_store_string, s3, "@Hateful"),
            (else_try),
                (ge, reg1, -70),
                (str_store_string, s3, "@Revengeful"),
            (else_try),
                (str_store_string, s3, "@Vengeful"),
            (try_end),

            # Set relation to player numerical value (same line)
            (create_text_overlay, reg10, "@{reg1}", tf_right_align),
            (overlay_set_size, reg10, ":line_size"),
            (store_add, ":line_x", ":x_poshl", 20),
            (position_set_x, pos1, ":line_x"),
            (position_set_y, pos1, ":y_pos"),
            (overlay_set_position, reg10, pos1),
            (overlay_set_color, reg10, ":line_color"),

            # Set relation to player string value (second line)
            (create_text_overlay, reg10, "@{s3}", tf_right_align),
            (overlay_set_size, reg10, ":line_size"),
            (position_set_x, pos1, ":line_x"),
            (store_sub, ":line_y", ":y_pos", 20),
            (position_set_y, pos1, ":line_y"),
            (overlay_set_position, reg10, pos1),
            (overlay_set_color, reg10, ":line_color"),

            # Set Faction Coat of Arm for standard faction (left of relation string)
            (try_begin),
                (neq, ":faction_line", "fac_player_supporters_faction"),
                (store_sub, ":mesh_index", ":faction_line", kingdoms_begin),
                (val_add, ":mesh_index", "mesh_pic_recruits"),
                (create_mesh_overlay, reg10, ":mesh_index"),
                (position_set_x, pos1, 75),
                (position_set_y, pos1, 75),
                (overlay_set_size, reg10, pos1),
                (position_set_x, pos1, 165),
                (store_sub, ":line_y", ":y_pos", 37),
                (position_set_y, pos1, ":line_y"),
                (overlay_set_position, reg10, pos1),
            (try_end),

            # for current line_faction count lords and centers
            (assign, ":num_lords", 0),
            (assign, ":num_caravans", 0),
            (assign, ":num_centers", 0),
            (assign, ":unassigned_centers", 0),
            (try_for_parties, ":cur_party"),
                (store_faction_of_party, ":cur_faction", ":cur_party"),
                (eq, ":cur_faction", ":faction_line"),

                (try_begin),
                    (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_hero_party),
                    (val_add, ":num_lords", 1),
                (else_try),
                    (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_caravan),
                    (val_add, ":num_caravans", 1),
                (else_try),
                    (this_or_next|party_slot_eq, ":cur_party", slot_party_type, spt_town),
                    (this_or_next|party_slot_eq, ":cur_party", slot_party_type, spt_castle),
                    (party_slot_eq, ":cur_party", slot_party_type, spt_village),
                    (val_add, ":num_centers", 1),

                    (try_begin),
                        (party_slot_eq, ":cur_party", slot_town_lord, stl_unassigned),
                        (val_add, ":unassigned_centers", 1),
                    (try_end),
                (try_end),
            (try_end), # end of parties loop

            # Count prisoners
            (assign, ":prisoners", 0),
            (try_for_range, ":lord_id", active_npcs_begin, active_npcs_end),
                (troop_slot_eq, ":lord_id", slot_troop_occupation, slto_kingdom_hero),
                (troop_slot_ge, ":lord_id", slot_troop_prisoner_of_party, 0),
                (store_troop_faction, ":lord_faction", ":lord_id"),
                (eq, ":lord_faction", ":faction_line"),
                (val_add, ":prisoners", 1),
            (try_end),

            # add count to last line for faction line report (second, third and fourth line)
            (assign, reg61, ":num_centers"),
            (assign, reg58, ":unassigned_centers"),
            (create_text_overlay, reg10, "@{reg61} {reg58?({reg58} U) :}Centers", tf_left_align),
            (overlay_set_size, reg10, ":line_size"),
            (position_set_x, pos1, 15),
            (store_sub, ":line_y", ":y_pos", 17),
            (position_set_y, pos1, ":line_y"),
            (overlay_set_position, reg10, pos1),
            (overlay_set_color, reg10, 0x000000),

            (assign, reg62, ":num_caravans"),
            (create_text_overlay, reg10, "@{reg62} Caravans", tf_left_align),
            (overlay_set_size, reg10, ":line_size"),
            (position_set_x, pos1, 15),
            (val_sub, ":line_y", 17),
            (position_set_y, pos1, ":line_y"),
            (overlay_set_position, reg10, pos1),
            (overlay_set_color, reg10, 0x000000),

            (assign, reg60, ":num_lords"),
            (assign, reg59, ":prisoners"),
            (create_text_overlay, reg10, "@{reg60} {reg59?({reg59} P) :}Lords", tf_left_align),
            (overlay_set_size, reg10, ":line_size"),
            (position_set_x, pos1, 15),
            (val_sub, ":line_y", 17),
            (position_set_y, pos1, ":line_y"),
            (overlay_set_position, reg10, pos1),
            (overlay_set_color, reg10, 0x000000),

            # increase line for next faction block
            (val_add, ":y_pos", 18),#linebreak

        (try_end), # end of faction loop
        (set_container_overlay, -1),
   ]),
   ## END on load trigger

   ## Check for buttonpress
   (ti_on_presentation_event_state_change,
    [
        (store_trigger_param_1, ":button_pressed_id"),
        (try_begin),
             (eq, ":button_pressed_id", "$g_jrider_faction_report_Return_to_menu"), # pressed  (Return to menu)
        (presentation_set_duration, 0),
    (try_end),
    ]),
   ## END presentation event state change trigger

   ## Event to process when running the presentation
   (ti_on_presentation_run,
    [
        (try_begin),
      (this_or_next|key_clicked, key_escape),
      (key_clicked, key_right_mouse_button),
      (presentation_set_duration, 0),
      (jump_to_menu, "mnu_reports"),
        (try_end),

        ]),
   ]),
  # END presentation run trigger
  # END Faction relation presentation
  # Jrider -

and you need to hook it into the game menu inside module_game_menus.py, inside the reports find the follo:
Code:
      ("view_faction_relations_report",[],"View faction relations report.",
       [
           # Jrider + REPORTS PRESENTATIONS 1.2, comment to hook faction report presentation
           ##(jump_to_menu, "mnu_faction_relations_report"),
           (start_presentation, "prsnt_jrider_faction_relations_report"),
           # Jrider -
        ]
       ),

That's it for the first one.


continued in post #2
 
The second presentation (dubbed character relations for lack of better words since it keeps growing) it a bit more involved.

It consist in a single presentation reused for 4 differents reports (character and companions being merged in one), with dynamic content (UI element created according to external sources) and moving pictures (well, picture changing according to context that is) and using external scripts to process the workload.

Note 1: the character and companions part doesn't reuse all the functionnalities of the corresponding game menus so I just add extra hook for these instead of replacing the existing menu entries.
Note 2: I haven't tested courtship with a female character, so this might not work courtship if you're playing a female.

I used two meshes provided in common resource but which have no mesh mapping in the module system, so add these at the end of module_meshes.py :
Code:
  # Jrider + REPORTS PRESENTATIONS 1.0
  ("message_window", 0, "message_window", 0, 0, 0, 0, 0, 0, 0.8, 0.5, 0.5), # in core_ui_meshes.brf, same one as in 1st presentation
  ("face_gen_window", 0, "face_gen_window", 0, 0, 0, 0, 0, 0, 1, 1, 1), # in user_interface_b.brf, automatically loaded
  # Jrider -
[

I added some new scripts to provide and process information and dynamic creation in the presentation, add these at the end of module_scripts.py :
There 3 new scripts:
  • A common script, to create new UI element dynamically, used by each type of presentation to determine the list contents
  • Another common script, to provide information to display for character, lords and companions
  • A specific script for courtship, to return known poems to write in the main UI

since we're using some presentions items in the code, add the presentation header to the imports at the beginning of the file :
Code:
## Jrider +
from header_presentations import *
## Jrider -

Then add the code at the end of the scripts tuple :
Code:
   # Jrider +
   ###################################################################################
   # REPORT PRESENTATIONS v1.2 scripts
   # Script overlay_container_add_listbox_item
   # use ...
   # return ...
   ("overlay_container_add_listbox_item", [
        (store_script_param, ":line_y", 1),
        (store_script_param, ":npc_id", 2),

        (set_container_overlay, "$g_jrider_character_relation_listbox"),

        # create text overlay for entry
        (create_text_overlay, reg10, s1, tf_left_align),
        (overlay_set_color, reg10, 0xDDDDDD),
        (position_set_x, pos1, 650),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg10, pos1),
        (position_set_x, pos1, 0),  
        (position_set_y, pos1, ":line_y"),
        (overlay_set_position, reg10, pos1),

        # create button
        (create_image_button_overlay, reg10, "mesh_white_plane", "mesh_white_plane"),
        (position_set_x, pos1, 0), # 590 real, 0 scrollarea
        (position_set_y, pos1, ":line_y"),
        (overlay_set_position, reg10, pos1),
        (position_set_x, pos1, 16000),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg10, pos1),
        (overlay_set_alpha, reg10, 0),
        (overlay_set_color, reg10, 0xDDDDDD),

        # store relation of button id to character number for use in triggers
        (store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", reg10),
        (troop_set_slot, "trp_temp_array_b", ":current_storage_index", "$num_charinfo_candidates"),

        # reset variables if appropriate flags are up
        (try_begin),
            (try_begin),
                (this_or_next|eq, "$g_jrider_pres_called_from_menu", 1),
                (ge, "$g_jrider_reset_selected_on_faction", 1),

                (assign, "$character_info_id", ":npc_id"),
                (assign, "$g_jrider_last_checked_indicator", reg10),
                (assign, "$g_latest_character_relation_entry", "$num_charinfo_candidates"),
            (try_end),
        (try_end),

        # close the container
        (set_container_overlay, -1),
   ]),
  
   # script get_relation_candidate_list_for_presentation
   # return a list of candidate according to type of list and restrict options
   # Use ...
   ("fill_relation_canditate_list_for_presentation",
    [
        (store_script_param, ":pres_type", 1),
        (store_script_param, ":base_candidates_y", 2),
        
        # Type of list from global variable: 0 courtship, 1 known lords
        (try_begin),
        ## For courtship:
            (eq, ":pres_type", 0),

            (try_for_range_backwards, ":lady", kingdom_ladies_begin, kingdom_ladies_end),
                (troop_slot_ge, ":lady", slot_troop_met, 1), # met or better
                (troop_slot_eq, ":lady", slot_troop_spouse, -1), # unmarried
        
                # use faction filter
                (store_troop_faction, ":lady_faction", ":lady"),
                (val_sub, ":lady_faction", kingdoms_begin), 
                (this_or_next|eq, "$g_jrider_faction_filter", -1),
                (eq, "$g_jrider_faction_filter", ":lady_faction"),
        
                (call_script, "script_troop_get_relation_with_troop", "trp_player", ":lady"),
                (gt, reg0, 0),
                (assign, reg3, reg0),
                
                (str_store_troop_name, s2, ":lady"),
                
                (store_current_hours, ":hours_since_last_visit"),
                (troop_get_slot, ":last_visit_hour", ":lady", slot_troop_last_talk_time),
                (val_sub, ":hours_since_last_visit", ":last_visit_hour"),
                (store_div, ":days_since_last_visit", ":hours_since_last_visit", 24),
                (assign, reg4, ":days_since_last_visit"),
                
                #(str_store_string, s1, "str_s1_s2_relation_reg3_last_visit_reg4_days_ago"),
                (str_store_string, s1, "@{s2}: {reg3}, {reg4} days"),   
        
                # create custom listbox entry, set the container first
                (store_mul, ":y_mult", "$num_charinfo_candidates", 16), # adapt y position to entry number, was 18
                (store_add, ":line_y", ":base_candidates_y", ":y_mult"),

                (call_script, "script_overlay_container_add_listbox_item", ":line_y", ":lady"),

                # candidate found, store troop id for later use
                (store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", "$num_charinfo_candidates"),
                (troop_set_slot, "trp_temp_array_c", ":current_storage_index", ":lady"),

                # update entry counter
                (val_add, "$num_charinfo_candidates", 1),
            (try_end),
        ## End courtship relations
        (else_try),
        ## For lord relations
            (eq, ":pres_type", 1),

            # Loop to identify  
            (try_for_range, ":active_npc", active_npcs_begin, active_npcs_end),
                (troop_set_slot, ":active_npc", slot_troop_temp_slot, 0),
            (try_end),

            (try_for_range, ":unused", active_npcs_begin, active_npcs_end),

                (assign, ":score_to_beat", 101),
                (assign, ":best_relation_remaining_npc", -1),

                (try_for_range, ":active_npc", active_npcs_begin, active_npcs_end),
                        (troop_slot_eq, ":active_npc", slot_troop_temp_slot, 0),
                        (troop_slot_ge, ":active_npc", slot_troop_met, 1),
                        (troop_slot_eq, ":active_npc", slot_troop_occupation, slto_kingdom_hero),

                        (call_script, "script_troop_get_player_relation", ":active_npc"),
                        (assign, ":relation_with_player", reg0),
                        (le, ":relation_with_player", ":score_to_beat"),
        
                        (assign, ":score_to_beat", ":relation_with_player"),
                        (assign, ":best_relation_remaining_npc", ":active_npc"),
                (try_end),
                (gt, ":best_relation_remaining_npc", -1),

                (str_store_troop_name, s4, ":best_relation_remaining_npc"),
                (assign, reg4, ":score_to_beat"),

                (str_store_string, s1, "@{s4}: {reg4}"),
                (troop_set_slot, ":best_relation_remaining_npc", slot_troop_temp_slot, 1),

                # use faction filter
                (store_troop_faction, ":npc_faction", ":best_relation_remaining_npc"),
                (val_sub, ":npc_faction", kingdoms_begin), 
                (this_or_next|eq, "$g_jrider_faction_filter", -1),
                (eq, "$g_jrider_faction_filter", ":npc_faction"),        
  
                # candidate found,
                # create custom listbox entry, set the container first
                (store_mul, ":y_mult", "$num_charinfo_candidates", 16), # adapt y position to entry number, was 18
                (store_add, ":line_y", ":base_candidates_y", ":y_mult"),

                (call_script, "script_overlay_container_add_listbox_item", ":line_y", ":best_relation_remaining_npc"),

                #store troop id for later use (could be merged with the object id)
                (store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", "$num_charinfo_candidates"),
                (troop_set_slot, "trp_temp_array_c", ":current_storage_index", ":best_relation_remaining_npc"),

                # update entry counter  
                (val_add, "$num_charinfo_candidates", 1),
            (try_end),
        ## END Lords relations
        (else_try),
        ## Character and Companions
            (eq, ":pres_type", 2),

            # companions
            (try_for_range_backwards, ":companion", companions_begin, companions_end),
                (troop_slot_eq, ":companion", slot_troop_occupation, slto_player_companion),

                (str_store_troop_name, s1, ":companion"),

        (try_begin),
                    (troop_slot_eq, ":companion", slot_troop_current_mission, npc_mission_kingsupport),        
                    (str_store_string, s1, "@{s1}(gathering support)"),
                (else_try),
                    (troop_slot_eq, ":companion", slot_troop_current_mission, npc_mission_gather_intel),
                    (str_store_string, s1, "@{s1} (intelligence)" ),
                (else_try),                    
                    (troop_slot_ge, ":companion", slot_troop_current_mission, npc_mission_peace_request),
                    (neg|troop_slot_eq, ":companion", slot_troop_current_mission, 8),
                    (str_store_string, s1, "@{s1} (ambassy)"),
                (else_try),
                        (eq, ":companion", "$g_player_minister"),
                    (str_store_string, s1, "@{s1} (minister"),
                (else_try),
                    (main_party_has_troop, ":companion"),
                    (str_store_string, s1, "@{s1} (under arms)"),
                (else_try),    
                    (troop_slot_eq, ":companion", slot_troop_current_mission, npc_mission_rejoin_when_possible),
                    (str_store_string, s1, "@{s1} (attempting to rejoin)"),
                (else_try),
                    (troop_slot_ge, ":companion", slot_troop_cur_center, 1),
                    (str_store_string, s1, "@{s1} (separated after battle)"),
                (try_end), 
                # candidate found,
                # create custom listbox entry, set the container first
                (store_mul, ":y_mult", "$num_charinfo_candidates", 16), # adapt y position to entry number, was 18
                (store_add, ":line_y", ":base_candidates_y", ":y_mult"),

                (call_script, "script_overlay_container_add_listbox_item", ":line_y", ":companion"),

                #store troop id for later use (could be merged with the object id)
                (store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", "$num_charinfo_candidates"),
                (troop_set_slot, "trp_temp_array_c", ":current_storage_index", ":companion"),

                # update entry counter  
                (val_add, "$num_charinfo_candidates", 1),
            (try_end),
            # END companions

            # Wife/Betrothed
            # END Wife/Betrothed
        
            (try_begin),
            # Character
                (str_store_troop_name, s1, "trp_player"),

                # candidate found,
                # create custom listbox entry, set the container first
                (store_mul, ":y_mult", "$num_charinfo_candidates", 16), # adapt y position to entry number, was 18
                (store_add, ":line_y", ":base_candidates_y", ":y_mult"),

                (call_script, "script_overlay_container_add_listbox_item", ":line_y", "trp_player"),

                #store troop id for later use (could be merged with the object id)
                (store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", "$num_charinfo_candidates"),
                (troop_set_slot, "trp_temp_array_c", ":current_storage_index", "trp_player"),

                # update entry counter  
                (val_add, "$num_charinfo_candidates", 1),
            (try_end),
            # End Character

        (try_end),
        ## END Character and Companions
    ]),

    # script get_troop_relation_to_player_string
    # return relation to player string in the specified parameters
    #
    ("get_troop_relation_to_player_string",
     [
         (store_script_param, ":target_string", 1),
         (store_script_param, ":troop_no", 2),

         (call_script, "script_troop_get_player_relation", ":troop_no"),
         (assign, ":relation", reg0),
         (str_clear, s61),

         (store_add, ":normalized_relation", ":relation", 100),
         (val_add, ":normalized_relation", 5),
         (store_div, ":str_offset", ":normalized_relation", 10),
         (val_clamp, ":str_offset", 0, 20),
         (store_add, ":str_rel_id", "str_relation_mnus_100_ns",  ":str_offset"),

         ## Make something if troop has relation but not strong enought to warrant a string
         (try_begin),
           (neq, ":str_rel_id", "str_relation_plus_0_ns"),
           (str_store_string, s61, ":str_rel_id"),
         (else_try),
           (neg|eq, reg0, 0),
           (str_is_empty, s61),
           (str_store_string, s61, "@ knows of you."),
         (else_try),
           (eq, reg0, 0),
           (str_is_empty, s61),
           (str_store_string, s61, "@ has no opinion about you."),
         (try_end),

         ## copy result string to target string
         (str_store_string_reg, ":target_string", s61),
     ]),

    # script get_troop_holdings
    # returns number of fief and list name (reg50, s50)
    ("get_troop_holdings",
     [
         (store_script_param, ":troop_no", 1),
         
         (assign, ":owned_centers", 0),
         (assign, ":num_centers", 0),
         (try_for_range_backwards, ":cur_center", centers_begin, centers_end),
             (party_slot_eq, ":cur_center", slot_town_lord, ":troop_no"),
             (try_begin),
               (eq, ":num_centers", 0),
               (str_store_party_name, s50, ":cur_center"),
               (val_add, ":owned_centers", 1),
             (else_try),
               (eq, ":num_centers", 1),
               (str_store_party_name, s57, ":cur_center"),
               (str_store_string, s50, "@{s57} and {s50}"),
               (val_add, ":owned_centers", 1),
             (else_try),
               (str_store_party_name, s57, ":cur_center"),
               (str_store_string, s50, "@{!}{s57}, {s50}"),
               (val_add, ":owned_centers", 1),
             (try_end),
             (val_add, ":num_centers", 1),
         (try_end),
         (assign, reg50, ":owned_centers"),
     ]),


scripts continued in post #3
 
Code:
    # script generate_extended_troop_relation_information_string
    # return information about troop according to type (lord, lady, maiden)
    # Use (hm lots of registers and strings)
    # result stored in s1
    ("generate_extended_troop_relation_information_string",
     [
         (store_script_param, ":troop_no", 1),

         # clear the strings and registers we'll use to prevent external interference
         (str_clear, s1),
         (str_clear, s2),
         (str_clear, s60),
         (str_clear, s42),
         (str_clear, s43),
         (str_clear, s44),
         (str_clear, s45),
         (str_clear, s46),
         (str_clear, s47),
         (str_clear, s48),
         (str_clear, s49),
         (str_clear, s50),
         (assign, reg40,0),
         (assign, reg41,0),
         (assign, reg43,0),
         (assign, reg44,0),
         (assign, reg46,0),
         (assign, reg47,0),
         (assign, reg48,0),
         (assign, reg49,0),
         (assign, reg50,0),
         (assign, reg51,0),

         (try_begin),
             (eq, ":troop_no", "trp_player"),
             (overlay_set_display, "$g_jrider_character_faction_filter", 0),

             # Troop name
             (str_store_troop_name, s1, ":troop_no"),

             # Get renown - slot_troop_renown
             (troop_get_slot, ":renown", ":troop_no", slot_troop_renown),
             (assign, reg40, ":renown"),

             # Controversy - slot_troop_controversy
             (troop_get_slot, ":controversy", ":troop_no", slot_troop_controversy),
             (assign, reg41, ":controversy"),

             # Honor - $player_honor
             (assign, reg42, "$player_honor"),

             # Right to rule - $player_right_to_rule
             (assign, reg43, "$player_right_to_rule"),

             # Current faction
             (store_add, reg45, "$players_kingdom"),
             (try_begin),
                 (is_between, "$players_kingdom", "fac_player_supporters_faction", npc_kingdoms_end),
                 (str_store_faction_name, s45, "$players_kingdom"),
             (else_try),
                 (assign, reg45, 0),
                 (str_store_string, s45, "@Calradia."),
             (try_end),

             # status
             (assign, ":origin_faction", "$players_kingdom"),
             (try_begin),
                 (is_between, ":origin_faction", npc_kingdoms_begin, npc_kingdoms_end),
                 (str_store_string, s44, "@sworn man"), 
             (else_try),
                 (eq, ":origin_faction", "fac_player_supporters_faction"),
                 (str_store_string, s44, "@ruler"),
             (else_try),
                 (str_store_string, s44, "@free man"),
             (try_end),

             # Current liege and relation
             (faction_get_slot, ":liege", "$players_kingdom", slot_faction_leader),
             (str_store_troop_name, s46, ":liege"),
             (try_begin),
                 (eq, ":liege", ":troop_no"),
                 (assign, reg46, 0),
             (else_try),
                 (assign, reg46, ":liege"),
                 (str_clear, s47),
                 (str_clear, s60),

                 # Relation to liege
                 (call_script, "script_get_troop_relation_to_player_string", s47, ":liege"),
             (end_try),

             # Holdings
             (call_script, "script_get_troop_holdings", ":troop_no"),

             #### Final Storage
             (str_store_string, s1, "@{s1} Renown: {reg40}, Controversy: {reg41}^Honor: {reg42}, Right to rule: {reg43}^\
You are a {s44} of {s45}^{reg45?{reg46?Your liege, {s46},{s47}:You are the ruler of {s45}}:}^^Friends: ^Enemies: ^^Fiefs:^  {reg50?{s50}:no fief}"),
         #######################
         # END Player information
         (else_try),
         #######################
         # Lord information
             (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),

             # Troop name
             (str_store_troop_name, s1, ":troop_no"),

             # relation to player
             (str_clear, s2),
             (str_clear, s60),
             (call_script, "script_get_troop_relation_to_player_string", s2, ":troop_no"),

             # Get renown - slot_troop_renown
             (troop_get_slot, ":renown", ":troop_no", slot_troop_renown),
             (assign, reg40, ":renown"),
         
             # Controversy - slot_troop_controversy
             (troop_get_slot, ":controversy", ":troop_no", slot_troop_controversy),
             (assign, reg41, ":controversy"),

             # Get Reputation type - slot_lord_reputation_type
             (troop_get_slot, ":reputation", ":troop_no", slot_lord_reputation_type),
             (assign, reg42, "str_personality_archetypes"),
             (val_add, reg42, ":reputation"),
             (str_store_string, s42, reg42),

             (assign, reg42, ":reputation"),
             # Intrigue impatience - slot_troop_intrigue_impatience
             (troop_get_slot, ":impatience", ":troop_no", slot_troop_intrigue_impatience),
             (assign, reg43, ":impatience"),

             # Current faction - store_troop_faction
             (store_troop_faction, ":faction", ":troop_no"),
             (troop_get_slot, ":origin_faction", ":troop_no", slot_troop_original_faction),

             # Original faction - slot_troop_original_faction
             (try_begin),
               (val_sub, ":origin_faction", npc_kingdoms_begin),
               (val_add, ":origin_faction", "str_kingdom_1_adjective"),
               (str_store_string, s44, ":origin_faction"),
             (end_try),
             (str_store_faction_name, s45, ":faction"),

             # Current liege - deduced from current faction
             (faction_get_slot, ":liege", ":faction", slot_faction_leader),
             (str_store_troop_name, s46, ":liege"),
             (try_begin),
               (eq, ":liege", ":troop_no"),
               (assign, reg46, 0),
             (else_try),
               (assign, reg46, ":liege"),
               # Relation to liege
               (call_script, "script_troop_get_relation_with_troop", ":troop_no", ":liege"),
               (assign, reg47, reg0),
             (end_try),

             # Promised a fief ?
             (troop_get_slot, reg51, ":troop_no", slot_troop_promised_fief),

             # Holdings
             (call_script, "script_get_troop_holdings", ":troop_no"),

              # slot_troop_prisoner_of_party
              (assign, reg48, 0),
              (try_begin),
                (troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
                (assign, reg48, 1),
                (troop_get_slot, ":prisoner_party", ":troop_no", slot_troop_prisoner_of_party),
                (store_faction_of_party, ":party_faction", ":prisoner_party"),
                (str_store_faction_name, s48, ":party_faction"),
              (try_end),

              # Days since last meeting
              (store_current_hours, ":hours_since_last_visit"),
              (troop_get_slot, ":last_visit_hour", ":troop_no", slot_troop_last_talk_time),
              (val_sub, ":hours_since_last_visit", ":last_visit_hour"),
              (store_div, reg49, ":hours_since_last_visit", 24),

              #### Final Storage (8 lines)
              (str_store_string, s1, "@{s1}{s2} {reg46?Reputed to be {s42}:}^Renown: {reg40}, Controversy: {reg41} {reg46?Impatience: {reg43}:}^\
{s44} noble of the {s45}^{reg46?Liege: {s46}, Relation: {reg47}:Ruler of the {s45}}^^{reg48?Currently prisoner of the {s48}:}^\
Days since last meeting: {reg49}^^Fiefs {reg51?(was promised a fief):}:^  {reg50?{s50}:no fief}"),
        ###################### 
        ## END lord infomation
        (else_try),
        ######################### 
        # kingdom lady, unmarried
             (is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end),
             (troop_slot_eq, ":troop_no", slot_troop_spouse, -1),

             (str_store_troop_name, s1, ":troop_no"),

             # relation to player
             (str_clear, s2),
             (str_clear, s60),
             (call_script, "script_get_troop_relation_to_player_string", s2, ":troop_no"),

             # Controversy - slot_troop_controversy
             (troop_get_slot, ":controversy", ":troop_no", slot_troop_controversy),
             (assign, reg41, ":controversy"),

             # Reputation type
             (troop_get_slot, ":reputation", ":troop_no", slot_lord_reputation_type),
             (try_begin),
                 (eq, ":reputation", lrep_conventional),
                 (str_store_string, s42, "@conventional"),
             (else_try),
                 (eq, ":reputation", lrep_adventurous),
                 (str_store_string, s42, "@adventurous"),
             (else_try),
                 (eq, ":reputation", lrep_otherworldly),
                 (str_store_string, s42, "@otherwordly"),
             (else_try),
                 (eq, ":reputation", lrep_ambitious),
                 (str_store_string, s42, "@ambitious"),
             (else_try),
                 (eq, ":reputation", lrep_moralist),
                 (str_store_string, s42, "@moralist"),
             (else_try),
                 (assign, reg42, "str_personality_archetypes"),
                 (val_add, reg42, ":reputation"),
                 (str_store_string, s42, reg42),
             (try_end),

             # courtship state - slot_troop_courtship_state
             (troop_get_slot, ":courtship_state", ":troop_no", slot_troop_courtship_state),
             (try_begin),
               (eq, ":courtship_state", 1),
               (str_store_string, s43, "@just met"),
             (else_try),
               (eq, ":courtship_state", 2),
               (str_store_string, s43, "@admirer"),
             (else_try),
               (eq, ":courtship_state", 3),
               (str_store_string, s43, "@promised"),
             (else_try),
               (eq, ":courtship_state", 4),
               (str_store_string, s43, "@breakup"),
             (else_try),
               (str_store_string, s43, "@unknown"),
             (try_end),

             # Current faction - store_troop_faction
             (store_troop_faction, ":faction", ":troop_no"),
             (troop_get_slot, ":origin_faction", ":troop_no", slot_troop_original_faction),

             # Original faction - slot_troop_original_faction
             (try_begin),
               (val_sub, ":origin_faction", npc_kingdoms_begin),
               (val_add, ":origin_faction", "str_kingdom_1_adjective"),
               (str_store_string, s44, ":origin_faction"),
             (end_try),
             (str_store_faction_name, s45, ":faction"),

             # Father/Guardian
             (assign, reg46, 0),
             (try_begin),
                 (troop_slot_ge, ":troop_no", slot_troop_father, 0),
                 (troop_get_slot, ":guardian", ":troop_no", slot_troop_father),
                 (assign, reg46, 1),
             (else_try),
                 (troop_get_slot, ":guardian", ":troop_no", slot_troop_guardian),
             (try_end),
             (str_store_troop_name, s46, ":guardian"),

             # Relation with player
             (str_clear, s47),
             (str_clear, s60),
             (call_script, "script_get_troop_relation_to_player_string", s47, ":guardian"), 

             # courtship permission - slot_lord_granted_courtship_permission
             (try_begin),
                 (troop_slot_ge, ":guardian", slot_lord_granted_courtship_permission, 1),
                 (assign, reg45, 1),
             (else_try),
                 (assign, reg45, 0),
             (try_end),

             # betrothed
             (assign, reg48, 0),
             (try_begin),
                 (troop_slot_ge, ":troop_no", slot_troop_betrothed, 0),
                 (troop_get_slot, reg48, ":troop_no", slot_troop_betrothed),
                 (str_store_troop_name, s48, reg48),
                 (assign, reg48, 1),
             (try_end),

             # Days since last meeting
             (store_current_hours, ":hours_since_last_visit"),
             (troop_get_slot, ":last_visit_hour", ":troop_no", slot_troop_last_talk_time),
             (val_sub, ":hours_since_last_visit", ":last_visit_hour"),
             (store_div, reg49, ":hours_since_last_visit", 24),

             # Heard poems
             (assign, reg50, 0),
             (str_clear, s50),

             (try_begin),
                 (troop_slot_eq, ":troop_no", slot_lady_courtship_heroic_recited, 1),
                 (val_add, reg50, 1),
                 (str_store_string, s50, "@Heroic {s50}"),
             (try_end),
             (try_begin),
                 (troop_slot_eq, ":troop_no", slot_lady_courtship_allegoric_recited, 1),
                 (val_add, reg50, 1),
                 (str_store_string, s50, "@Allegoric {s50}"),
             (try_end),
             (try_begin),
                 (troop_slot_eq, ":troop_no", slot_lady_courtship_comic_recited, 1),
                 (val_add, reg50, 1),
                 (str_store_string, s50, "@Comic {s50}"),
             (try_end),
             (try_begin),
                 (troop_slot_eq, ":troop_no", slot_lady_courtship_mystic_recited, 1),
                 (val_add, reg50, 1),
                 (str_store_string, s50, "@Mystic {s50}"),
             (try_end),
             (try_begin),
                 (troop_slot_eq, ":troop_no", slot_lady_courtship_tragic_recited, 1),
                 (val_add, reg50, 1),
                 (str_store_string, s50, "@Tragic {s50}"),
             (try_end),

             #### Final Storage (8 lines)
             (str_store_string, s1, "@{s1}{s2} Controversy: {reg41}^Reputation: {s42}, Courtship state: {s43}^\
Belongs to the {s45}^{reg46?Her father, {s46}:Her guardian, {s46}}{s47}^Allowed to visit: {reg45?yes:no} {reg48?Betrothed to {s48}:}^^\
Days since last meeting: {reg49}^^Poems:^  {reg50?{s50}:no poem heard}"),
        ######################### 
        # END kingdom lady, unmarried
        (else_try),
        ######################### 
        # companions
            (is_between, ":troop_no", companions_begin, companions_end),
            (overlay_set_display, "$g_jrider_character_faction_filter", 0),

            (str_store_troop_name, s1, ":troop_no"),

            (troop_get_slot, ":reputation", ":troop_no", slot_lord_reputation_type),

            (assign, reg42, "str_personality_archetypes"),
            (val_add, reg42, ":reputation"),
            (str_store_string, s42, reg42),

            # birthplace
            (troop_get_slot, ":home", ":troop_no", slot_troop_home),
            (str_store_party_name, s43, ":home"),
         
            # contacts town - slot_troop_town_with_contacts
            (troop_get_slot, ":contact_town", ":troop_no", slot_troop_town_with_contacts),
            (str_store_party_name, s44, ":contact_town"),
         
            # current faction of contact town
            (store_faction_of_party, ":town_faction", ":contact_town"),
            (str_store_faction_name, s45, ":town_faction"),

            # slot_troop_prisoner_of_party
            (assign, reg48, 0),
            (try_begin),
                (troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
                (assign, reg48, 1),
                (troop_get_slot, ":prisoner_party", ":troop_no", slot_troop_prisoner_of_party),
                (store_faction_of_party, ":party_faction", ":prisoner_party"),
                (str_store_faction_name, s48, ":party_faction"),
            (try_end),

            # Days since last meeting
            (store_current_hours, ":hours_since_last_visit"),
            (troop_get_slot, ":last_visit_hour", ":troop_no", slot_troop_last_talk_time),
            (val_sub, ":hours_since_last_visit", ":last_visit_hour"),
            (store_div, reg49, ":hours_since_last_visit", 24),

            (try_begin), # Companion gathering support for Right to Rule
                (troop_slot_eq, ":troop_no", slot_troop_current_mission, npc_mission_kingsupport),
                (str_store_string, s50, "@Gathering support"),
            (else_try), # Companion gathering intelligence
                (troop_slot_eq, ":troop_no", slot_troop_current_mission, npc_mission_gather_intel),
                (troop_get_slot, ":contact_town", ":troop_no", slot_troop_town_with_contacts),
                (store_faction_of_party, ":town_faction", ":contact_town"),
                (str_store_faction_name, s66, ":town_faction"),
                (str_store_string, s50, "@Gathering intelligence in the {s66}"),
            (else_try), # Companion on peace mission
                (troop_slot_ge, ":troop_no", slot_troop_current_mission, npc_mission_peace_request),
                (neg|troop_slot_ge, ":troop_no", slot_troop_current_mission, 8),

                (troop_get_slot, ":troop_no", ":troop_no", slot_troop_mission_object),
                (str_store_faction_name, s66, ":faction"),

                (str_store_string, s50, "@Ambassy to {s66}"),
            (else_try), # Companion is serving as minister player has court
                (eq, ":troop_no", "$g_player_minister"),
                (str_store_string, s50, "@Minister"),
            (else_try),
                (str_store_string, s50, "@none"),
        (try_end),

            # days left
            (troop_get_slot, reg50, ":troop_no", slot_troop_days_on_mission),
         
            #### Final Storage (8 lines)
            (str_store_string, s1, "@{s1}, {s2}^Reputation: {s42}^\
Born at {s43}^Contact in {s44} of the {s45}.^\
^{reg48?Currently prisoner of the {s48}:}^Days since last talked to: {reg49}^^Current mission:^  {s50}{reg50?, back in {reg50} days.:}"),
        ######################### 
        # END companions
        (try_end),
    ]),

    # Script generate_known_poems_string
    # generate in s1 list of known poems filling with blank lines for unknown ones
    ("generate_knonwn_poems_string",
     [
        # Known poems string
        (assign, ":num_poems", 0),
        (str_store_string, s1, "str_s1__poems_known"),
        (try_begin),
            (gt, "$allegoric_poem_recitations", 0),
            (str_store_string, s1, "str_s1_storming_the_castle_of_love_allegoric"),
            (val_add, ":num_poems", 1),
        (try_end),
        (try_begin),
            (gt, "$tragic_poem_recitations", 0),
            (str_store_string, s1, "str_s1_kais_and_layali_tragic"),
            (val_add, ":num_poems", 1),
        (try_end),
        (try_begin),
            (gt, "$comic_poem_recitations", 0),
            (str_store_string, s1, "str_s1_a_conversation_in_the_garden_comic"),
            (val_add, ":num_poems", 1),
        (try_end),
        (try_begin),
            (gt, "$heroic_poem_recitations", 0),
            (str_store_string, s1, "str_s1_helgered_and_kara_epic"),
            (val_add, ":num_poems", 1),
        (try_end),
        (try_begin),
            (gt, "$mystic_poem_recitations", 0),
            (str_store_string, s1, "str_s1_a_hearts_desire_mystic"),
            (val_add, ":num_poems", 1),
        (try_end),

        # fill blank lines
        (try_for_range, ":num_poems", 5),
            (str_store_string, s1, "@{s1}^"),
        (try_end),
    ]),
   # Jrider -


last part in post #4
 
The presentation code, the load process is roughtly divided in 5 parts
  • presentation type specific initializations (title, layout, extra overlay).
  • create the commons overlays not dependent on value or which values can be changed easily (ie. text, combo button overlay).
  • populate the list and set up initial values.
  • create overlays depending on the value that need a restart of the presentation to be updated (common, then pres type specific).
Code:
# Jrider +
  ##############################################################################
  # REPORT PRESENTATIONS v1.2 
  ## Character relations report
  ("jrider_character_relation_report", 0,
   mesh_message_window,
   [
     ## Load Presentation
     (ti_on_presentation_load,
      # generic_ti_on_load +
      [
    (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),

        (str_clear, s0),
        (str_clear, s1),

        # Character presentation type variations
        (try_begin),
            ###############################
            ## Courtship Relations presentation
            (eq, "$g_character_presentation_type", 0),

            # Set presentation title string
            (str_store_string, s0, "@_Courtships in progress_"),

            # Set size of listbox
            (assign, ":base_scroll_y", 160),
            (assign, ":base_scroll_size_y", 480),
            (assign, ":base_candidates_y", 0), # scrollable area size minus (one line size + 2) 430

            # Set storage index
            (assign, "$g_base_character_presentation_storage_index", 1000),

            # presentation specific extra overlays
            (call_script, "script_generate_knonwn_poems_string"),

            # Extra text area for knowns poems (filling once so we use a register), filled from s1 generated in script call
            (create_text_overlay, reg1, s1, tf_left_align),
            (position_set_x, pos1, 590), # position
            (position_set_y, pos1, 55),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 750), # size
            (position_set_y, pos1, 850),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0xFF66CC), # color
        (else_try),
            ###############################
            ## Lord Relations presentation
            (eq, "$g_character_presentation_type", 1),

            # Set presentation title string
            (str_store_string, s0, "@_Known Lords by Relation_"),

            # Set size of listbox
            (assign, ":base_scroll_y", 110),
            (assign, ":base_scroll_size_y", 550), 
            (assign, ":base_candidates_y", 0), # scrollable area size minus 530

            # Set storage index
            (assign, "$g_base_character_presentation_storage_index", 2000),
        (else_try),
            ###############################
            ## Player and Companions presentation
            (eq, "$g_character_presentation_type", 2),

            # Set presentation title string
            (str_store_string, s0, "@_Character & Companions_"),

            # Set size of listbox
            (assign, ":base_scroll_y", 110),
            (assign, ":base_scroll_size_y", 550),
            (assign, ":base_candidates_y", 0), # scrollable area size minus (one line size + 2) 530

            # Set storage index
            (assign, "$g_base_character_presentation_storage_index", 3000),

            # Extra area for equipment display
            (assign, ":inv_bar_size", 0),
            (position_set_x, ":inv_bar_size", 400),
            (position_set_y, ":inv_bar_size", 400),

            (create_mesh_overlay, reg1, "mesh_mp_inventory_left"),
            (position_set_x, pos1, 67),
            (position_set_y, pos1, 300),
            (overlay_set_position, reg1, pos1),
            (overlay_set_size, reg1, ":inv_bar_size"),

            (create_mesh_overlay, reg1, "mesh_mp_inventory_right"),
            (position_set_x, pos1, 450),
            (position_set_y, pos1, 330),
            (overlay_set_position, reg1, pos1),
            (overlay_set_size, reg1, ":inv_bar_size"),
        (try_end),
        # END of presentation type specific init and static overlay

        ###############################
        # Create common overlays
        # set foreground mesh overlay (has some transparency in it, so can't use it directly)
        (create_mesh_overlay, reg1, "mesh_face_gen_window"),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
    (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
    (overlay_set_size, reg1, pos1),

    # Presentation title overlay, centered at the top of right pane (from s0, presentation type specific)
        (create_text_overlay, reg1, s0, tf_center_justify),
        (overlay_set_color, reg1, 0xDDDDDD),
    (position_set_x, pos1, 740), # Higher, means more toward the right
        (position_set_y, pos1, 680), # Higher, means more toward the top
        (overlay_set_position, reg1, pos1),
    (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
    (overlay_set_size, reg1, pos1),

    # Done button
        (create_game_button_overlay, "$g_jrider_character_report_Return_to_menu", "@_Done_"),
    (position_set_x, pos1, 290),
        (position_set_y, pos1, 10),
        (overlay_set_position, "$g_jrider_character_report_Return_to_menu", pos1),

        # Character Information text to fill when an entry is clicked in the list
        (create_text_overlay, "$g_jrider_character_information_text", "str_space", tf_left_align),
        (overlay_set_color, "$g_jrider_character_information_text", 0xFFFFFF),
        (position_set_x, pos1, 55), # Higher, means more toward the right
        (position_set_y, pos1, 60), # Higher, means more toward the top
        (overlay_set_position, "$g_jrider_character_information_text", pos1),
        (position_set_x, pos1, 700), # smaller means smaller font
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_jrider_character_information_text", pos1),

        # Character selection listbox overlay
        # use scrollable text area with global reference so objects can be put inside using overlay_set_container
        (create_text_overlay, "$g_jrider_character_relation_listbox", "str_empty_string", tf_scrollable_style_2),
        (position_set_x, pos1, 590),
        (position_set_y, pos1, ":base_scroll_y"),
        (overlay_set_position, "$g_jrider_character_relation_listbox", pos1),
        (position_set_x, pos1, 335),
        (position_set_y, pos1, ":base_scroll_size_y"),
        (overlay_set_area_size, "$g_jrider_character_relation_listbox", pos1),

        # Faction filter
        (create_combo_button_overlay, "$g_jrider_character_faction_filter", "str_empty_string",0),
        (position_set_x, pos1, 507),
        (position_set_y, pos1, 709),
        (overlay_set_position, "$g_jrider_character_faction_filter", pos1),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 650),
        (overlay_set_size, "$g_jrider_character_faction_filter", pos1),

        # add elements to filter button
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Your supporters"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Swadians"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Vaegirs"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Khergits"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Nords"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Rhodoks"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@Sarranids"),
        (overlay_add_item, "$g_jrider_character_faction_filter", "@All Factions"),

        # Set initial value for selection box
        (try_begin),
            (this_or_next|eq, "$g_jrider_pres_called_from_menu", 1),
            (eq, "$g_jrider_faction_filter", -1),

            (assign, "$g_jrider_faction_filter", -1),
            (overlay_set_val, "$g_jrider_character_faction_filter", 7),
        (else_try),
            (overlay_set_val, "$g_jrider_character_faction_filter", "$g_jrider_faction_filter"),
        (try_end),

        ###############################
        # Populate lists
        # Init presentation common global variables
        (assign, "$num_charinfo_candidates", 0),

        # Fill listbox (overlay_add_item and extra storage)
        (call_script, "script_fill_relation_canditate_list_for_presentation", "$g_character_presentation_type", ":base_candidates_y"),
        (assign, "$g_jrider_reset_selected_on_faction", 0),
        # stop if there's no candidate
        (gt, "$num_charinfo_candidates", 0),

        # get extra information from storage
        (store_add, ":current_storage_index", "$g_base_character_presentation_storage_index", "$g_latest_character_relation_entry"),
        (troop_get_slot, "$character_info_id", "trp_temp_array_c", ":current_storage_index"),

        # Fill text information for current entry and update text information overlay
        (call_script, "script_generate_extended_troop_relation_information_string", "$character_info_id"),
        (overlay_set_text, "$g_jrider_character_information_text", s1),

        # color selected entry
        (overlay_set_color, "$g_jrider_last_checked_indicator", 0xFF6666FF),
        (overlay_set_alpha, "$g_jrider_last_checked_indicator", 0x44),

        # Begin common dynamic overlay
        # mesh Overlay for character portrait (global not needed)
        (create_image_button_overlay_with_tableau_material, "$g_jrider_character_portrait", -1, "tableau_troop_note_mesh", "$character_info_id"),
        (position_set_x, pos2, 100),
        (position_set_y, pos2, 280),
        (overlay_set_position, "$g_jrider_character_portrait", pos2),
        (position_set_x, pos2, 1100), #1150
        (position_set_y, pos2, 1100), #1150
        (overlay_set_size, "$g_jrider_character_portrait", pos2),

        # mesh Overlay for faction coat of arms
        (try_begin),
            (store_troop_faction, ":troop_faction", "$character_info_id"),
            (neq, ":troop_faction", "fac_player_supporters_faction"),
            (is_between, ":troop_faction", kingdoms_begin, kingdoms_end),
            (store_sub, ":faction_mesh_index", ":troop_faction", kingdoms_begin),
            (val_add, ":faction_mesh_index", "mesh_pic_recruits"),

            (create_mesh_overlay, "$g_jrider_faction_coat_of_arms", ":faction_mesh_index"),
            (position_set_x, pos3, 150),
            (position_set_y, pos3, 600),
            (overlay_set_position, "$g_jrider_faction_coat_of_arms", pos3),
            (position_set_x, pos3, 250),
            (position_set_y, pos3, 250),
            (overlay_set_size, "$g_jrider_faction_coat_of_arms", pos3),
        (try_end),

        # Begin presentation type specific dynamic overlay
        # equipement meshes for character/companions
        (try_begin),
            (eq, "$g_character_presentation_type", 2),

            (assign, ":base_inv_slot_x", 452),
            (assign, ":base_inv_slot_y", 536),

            (try_for_range, ":item_eq", 0, 9),
            # loop equipment slots
                (troop_get_inventory_slot, reg1, "$character_info_id", ":item_eq"),
        
                (try_begin),
                    (eq, ":item_eq", 4),
                    (assign, ":base_inv_slot_x", 68),
                    (assign, ":base_inv_slot_y", 557),
                (try_end),
                (try_begin),
                    (lt, reg1, 1),
                    # empty... assign default mesh
                   (try_begin),
                       (lt, ":item_eq", 4),
                       (assign, ":mesh_id", "mesh_mp_inventory_slot_equip"),
                   (else_try),
                       (eq, ":item_eq", 4),
                       (assign, ":mesh_id", "mesh_mp_inventory_slot_helmet"),
                   (else_try),
                       (eq, ":item_eq", 5),
                       (assign, ":mesh_id", "mesh_mp_inventory_slot_armor"),
                   (else_try),
                       (eq, ":item_eq", 6),
                       (assign, ":mesh_id", "mesh_mp_inventory_slot_boot"),
                   (else_try),
                       (eq, ":item_eq", 7),
                       (assign, ":mesh_id", "mesh_mp_inventory_slot_glove"),
                   (else_try),
                       (eq, ":item_eq", 8),
                       (assign, ":mesh_id", "mesh_mp_inventory_slot_horse"),
                   (try_end),
        
                   (create_mesh_overlay, reg11, ":mesh_id"),
                   (overlay_set_size, reg11, ":inv_bar_size"),

                   (position_set_x, pos1, ":base_inv_slot_x"),
                   (position_set_y, pos1, ":base_inv_slot_y"),
                   (overlay_set_position, reg11, pos1),
        
                   (troop_set_slot, "trp_temp_array_a", ":item_eq", -1),
                   (store_add, ":item_eq_id", ":item_eq", 10),
                   (troop_set_slot, "trp_temp_array_a", ":item_eq_id", -1),
                # end missing item
                (else_try),
                    (create_mesh_overlay_with_item_id, reg10, reg1),
                    (position_set_x, pos1, 450),
                    (position_set_y, pos1, 450),
                    (overlay_set_size, reg10, pos1),

                    (store_add, ":item_inv_slot_x", ":base_inv_slot_x", 25),
                    (store_add, ":item_inv_slot_y", ":base_inv_slot_y", 25),

                    (position_set_x, pos1, ":item_inv_slot_x"),
                    (position_set_y, pos1, ":item_inv_slot_y"),
                    (overlay_set_position, reg10, pos1),

                    # save id for reuse
                    (troop_set_slot, "trp_temp_array_a", ":item_eq", reg10),
                    (store_add, ":item_eq_id", ":item_eq", 10),
                    (troop_set_slot, "trp_temp_array_a", ":item_eq_id", reg1),
                # real items
                (try_end),
                (val_sub, ":base_inv_slot_y", 51),
            (try_end),
            # end loop equipments slots
        (try_end),

        # do an update if called from menu and reset init variable
        (try_begin),
            (eq, "$g_jrider_pres_called_from_menu", 1),
            (assign, "$g_jrider_pres_called_from_menu", 0),
        (try_end),
    ]),
    # end presentation load

    ## Mouse-over
    (ti_on_presentation_mouse_enter_leave,
      [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":enter_leave"),

      (try_begin),
          (eq, "$g_character_presentation_type", 2),
          (try_begin),
              (eq, ":enter_leave", 0),
              (try_for_range, ":slot_no", 0, 9),
                  (troop_slot_eq, "trp_temp_array_a", ":slot_no", ":object"),
                  (store_add, ":slot_no_eq", ":slot_no", 10),
                  (troop_get_slot, ":item_no", "trp_temp_array_a", ":slot_no_eq"),

                  (set_fixed_point_multiplier, 1000),

                  (position_set_x,pos0,740),
                  (position_set_y,pos0,235),
                  (show_item_details, ":item_no", pos0, 100),
              (try_end),
          (else_try),
              (try_for_range, ":slot_no", 0, 9),
                (troop_slot_eq, "trp_temp_array_a", ":slot_no", ":object"),
                (close_item_details),
              (try_end),
          (try_end),
      (try_end),
    ]),
    # end mouseover

    ## Check for buttonpress
    (ti_on_presentation_event_state_change,
     [
        (store_trigger_param_1, ":object"), # object
        (store_trigger_param_2, ":value"),  # value

        (try_begin),
            # pressed  (Return to menu)
            (eq, ":object", "$g_jrider_character_report_Return_to_menu"),

            (try_begin),
                (neq, "$num_charinfo_candidates", 0),
                (overlay_set_text, "$g_jrider_character_information_text", "str_empty_string"),
                (overlay_set_alpha, "$g_jrider_last_checked_indicator", 0),
            (try_end),
            (presentation_set_duration, 0),

        (else_try),
            # Faction filter
            (eq, ":object", "$g_jrider_character_faction_filter"),
            (try_begin),
                (eq, ":value", 7),
                (assign, "$g_jrider_faction_filter", -1),
            (else_try),
                (assign, "$g_jrider_faction_filter", ":value"),
            (try_end),

            # reset selected to first
            (assign, "$g_jrider_reset_selected_on_faction", 1000),

            # restart presentation to take filters into account
            (start_presentation, "prsnt_jrider_character_relation_report"),

        (else_try),
            (neq, ":object", "$g_jrider_character_information_text"),
            (neq, ":object", "$g_jrider_character_portrait"),
            (neq, ":object", "$g_jrider_character_relation_listbox"),
            #(neq, ":object", "$g_jrider_faction_coat_of_arms"),
            # clicked on list entry
            # get storage index + base storage index
            (store_add, ":storage_button_id", ":object", "$g_base_character_presentation_storage_index"),
            (troop_get_slot, ":character_number", "trp_temp_array_b", ":storage_button_id"),

            (overlay_set_alpha, "$g_jrider_last_checked_indicator", 0),
            (overlay_set_color, "$g_jrider_last_checked_indicator", 0xDDDDDD),

            # update last entry and check variables
            (assign, "$g_latest_character_relation_entry", ":character_number"),
            (assign, "$g_jrider_last_checked_indicator", ":object"),

            # color selected entry
            (overlay_set_color, "$g_jrider_last_checked_indicator", 0xFF6666FF),
            (overlay_set_alpha, "$g_jrider_last_checked_indicator", 0x44),

            # get troop information from storage to update text
            (val_add, ":character_number", "$g_base_character_presentation_storage_index"),
            (troop_get_slot, "$character_info_id", "trp_temp_array_c", ":character_number"),

            # restart presentation to update picture and text
            (start_presentation, "prsnt_jrider_character_relation_report"),
    (try_end),
     ] # + generic_ti_on_presentation_event_state_change
     ),
     # end event state change

    ## Event to process when running the presentation
    (ti_on_presentation_run,
     # generic_ti_on_presentation_run +
     [
        (try_begin),
      (this_or_next|key_clicked, key_escape),
      (key_clicked, key_right_mouse_button),
      (presentation_set_duration, 0),
      (jump_to_menu, "mnu_reports"),
        (try_end),

        ]),
     # end presentation run
     ]),
    ###################################
    # Character relation presentation end
# Jrider -

Game menu hooks to insert in module_game_menus.py, reports menu :
Code:
      # Jrider +
      ("view_player_companion_report",[],"View player and companions report.",
       [
         # init variables before starting
         (assign, "$g_jrider_pres_called_from_menu", 1),
         (assign, "$g_character_presentation_type", 2),
         (start_presentation, "prsnt_jrider_character_relation_report"),
        ]
       ),
      # Jrider -
Code:
      
      ("lord_relations",[],"View list of known lords by relation.",
       [
         # Jrider +
     #(jump_to_menu, "mnu_lord_relations"),
         (assign, "$g_jrider_pres_called_from_menu", 1),
         (assign, "$g_character_presentation_type", 1),
         (start_presentation, "prsnt_jrider_character_relation_report"),
         # Jrider -
        ]
       ),
Code:
       
      ("courtship_relations",[],"View courtship relations.",
       [
         # Jrider +
      #(jump_to_menu, "mnu_courtship_relations"),
         (assign, "$g_jrider_pres_called_from_menu", 1),
         (assign, "$g_character_presentation_type", 0),
         (start_presentation, "prsnt_jrider_character_relation_report"),
         # Jrider -
        ]
       ),

For that second presentation I use temporary troop arrays to store data (v1.2 use temp_array_a in addition to the other 2), since I had these from Rubik's Custom Commander and didn't code them myself I forgot to add them here : that goes in module_troops.py

Code:
  ["temp_array_a","{!}temp_array_a","{!}temp_array_a",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0],
  ["temp_array_b","{!}temp_array_b","{!}temp_array_b",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0],
  ["temp_array_c","{!}temp_array_c","{!}temp_array_c",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0],


and that's it.

hopefully I haven't forgotten anything, until I posted this, I hadn't realized how big it was.
 
That looks quite cool.  I'll have to look this over in detail later.

[EDIT]A thought:  the thing we really need a better presentation for?  Trade good prices in each city.[/EDIT]
 
Dude, very nice! Impressive to see some really nice code like this being distributed.

I'll probably use this in the next version of Hundred Years War.
 
mr.master said:
Awesome work jrider :razz: Ill surely add this to my mod (= Keep up the work : P Can't wait to see more of your scripts.  :wink:

thanks :smile:

and as I said, these are my first presentations, which is probably why I mishandled the placement of the items in the scroll area for the second one (noticed that while doing some regression testing after adding some extra code in player/companion to display equipment).

the 1st presentation probably has the same problem but there's space enough to display the player faction in there without triggering the scroll bar anyway.

I'll update when I figure how to do it the right way :wink:
 
Great you just added a whole new universe of stuff for me to look into putting into my mod!!!  :mrgreen:

All the same thanks for the sample, I'm already picture some fancy screens..  :wink:
 
just to bring the discussion to the right topic from the minimap thread, noticed that you are trying to do "externalize" modded stuff as well :smile: Same idealogy here.  In fact, I think I'm the more extreme one here, since I want mod users to be as lazy as possible, hence the request to "wrap" some of your stuff.

I'm close to finishing my prototype "mod_options" mod kit, which is generalized version of rubik's mod options presentation in his custom commander.  Now any modding kits under the same framework can declare their own mod options like

This is a dummy option included to just switch on and off the in-game cheat mode
Code:
mod_options = [   
    ( "op_cheatmode", xgm_ov_checkbox ,  [],
        "Enable cheat mode:", 0,        
        "This sets the in-game cheat mode", 0,
        [  # initialization block (set value in reg1)
            (assign, reg1, "$cheat_mode"),
        ], 
        [  # update block (value is in reg1)
            (assign, "$cheat_mode", reg1),            
        ], 
    ),

] # mod_options

and

These are mod options meant for my re-wrapping of rubik's battle minimap
Code:
mod_options = [
    ( "op_line_cc_battle_minimap", xgm_ov_line ), # support "inlined" lines :)
    
    ( "op_cc_show_battle_minimap", xgm_ov_checkbox ,  [],
        "Show battle minimap:", 0,        
        "This sets whether the minimap will always be shown during battle.", 0,
        [  # initialization block (set value in reg1)
            (try_begin),
                (gt, "$g_show_minimap", 1),
                (assign, "$g_show_minimap", 1),
            (else_try),
                (ge, 0, "$g_show_minimap"),
                (assign, "$g_show_minimap", 0),
            (try_end),
            (assign, reg1, "$g_show_minimap"),
        ], 
        [  # update block (value is in reg1)
            (assign, "$g_show_minimap", reg1),            
            
            ## debug
            #(assign, reg2, "$g_show_minimap"),
            #(display_log_message, "@g_show_minimap={reg2}"),
        ], 
    ),

    ( "op_cc_battle_minimap_size", xgm_ov_numberbox ,  [cc_minimap_min_ratio, cc_minimap_max_ratio + 1],
        "Size of battle minimap (%):", 0,        
        "This percentage modifies the size of battle minimap", 0,
        [  # initialization block (set value in reg1)
            (try_begin),
                (gt, "$g_minimap_ratio", cc_minimap_max_ratio),
                (assign, "$g_minimap_ratio", cc_minimap_max_ratio ),
            (else_try),
                (gt, cc_minimap_min_ratio, "$g_minimap_ratio"),
                (assign, "$g_minimap_ratio", cc_minimap_min_ratio),
            (try_end),
            (assign, reg1, "$g_minimap_ratio"),
        ],
        [  # update block (value is in reg1)
            (assign, "$g_minimap_ratio", reg1),            

            ## debug
            #(assign, reg2, "$g_minimap_ratio"),
            #(display_log_message, "@g_minimap_ratio={reg2}"),
        ],
    ),
    

] # mod_options

and turn it into:
v2kwV.jpg

Theoretically, supports any number of properties each specified in mods, and only those active mods (under my modmerger organization) will have their mod options exposed.  And the nice thing is that the dependency is weak, so any mod kits that specifies mod_options, but the basic mod_option kit is not active, it will just be ignored (but no mod options screen)

(combo box is still untested though, so need a little more testing.... :smile: )

I was planning to finish this part first, then take a look at your stuff to see if it can be modularized under my current framework.  Maybe instead of replacing the existing "spartan" reports, can expose global flags to indicate to game whether to use the original reports or the new presentations (just in case some people get nostalgic....)
 
Idibil said:
Thanks u, great work.

I have one problem only, in factions relations it load two factions of 31:

my, my, that's a lot of factions  :mrgreen:

as I said earlier, it's related to the mishandling of scroll area, I fixed that one (Factions Relations presentation only for the moment) and it should display fine now .

unless coat of  arms meshes have been added for each extra faction in that mod, you might want to comment bit related to the coat of arms mesh overlay, that's the one part really designed to handle only the 6 original npcs factions (probably won't throw an error but it may display strange things starting at faction 7 (0 being player).

sphere said:
just to bring the discussion to the right topic from the minimap thread, noticed that you are trying to do "externalize" modded stuff as well :smile: Same ideology here.  In fact, I think I'm the more extreme one here, since I want mod users to be as lazy as possible, hence the request to "wrap" some of your stuff.

as a matter of fact, you did give me the idea (from the battlefield tactics kit thread) and seeing how things are done in triggers did give me the means.
I got the drive to implement it for my code after loosing a fair bit of it while merging with a new version of OSPW (thankfully I had posted most of it already, still that was almost a 1000 lines of code).

Theoretically, supports any number of properties each specified in mods, and only those active mods (under my modmerger organization) will have their mod options exposed.  And the nice thing is that the dependency is weak, so any mod kits that specifies mod_options, but the basic mod_option kit is not active, it will just be ignored (but no mod options screen)

did you think of using a scroll area to host the options (maybe with a combo button to make the options display in the scroll area mod specific) ?

I was planning to finish this part first, then take a look at your stuff to see if it can be modularized under my current framework.  Maybe instead of replacing the existing "spartan" reports, can expose global flags to indicate to game whether to use the original reports or the new presentations (just in case some people get nostalgic....)

that would be nice, since I write these for myself, I tend not to leave a choice between new/old stuff or subfeatures and let people adapt the code to their taste.
 
@jrider

my, my, that's a lot of factions  :mrgreen:

as I said earlier, it's related to the mishandling of scroll area, I fixed that one (Factions Relations presentation only for the moment) and it should display fine now .

unless coat of  arms meshes have been added for each extra faction in that mod, you might want to comment bit related to the coat of arms mesh overlay, that's the one part really designed to handle only the 6 original npcs factions (probably won't throw an error but it may display strange things starting at faction 7 (0 being player).

Thanks! It work perfectly now  :grin:
 
This looks really good, but I have a question:
What are these "xgm_" things? Are they new presentation things for Warband?
And because I have 21 (or 22) factions, I'll make my own presentation (inspired by yours) where it'll be like a table, say:
Code:
     -     |  Kingdom 1  |  Kingdom 2  |  Kingdom 3 | etc.
--------------------------------------------------------------------
Kingdom 1  |     -       |      P      |     W      |
--------------------------------------------------------------------
Kingdom 2  |     P       |      -      |     P      |
--------------------------------------------------------------------
Kingdom 3  |     W       |      P      |     -      |
--------------------------------------------------------------------
etc.
P - Peace, W - War,  - - it's the same faction.
Sorry for the poor representation... :grin:
 
there, the second presentation is fixed for the initial scrollarea mishandling, I've added a bit in player/companion to display equiped items (through the tooltip doesn't take into account the item modifiers).

leandrojas_ said:
Hope you do not mind if we use in my mod. El Arte de la Guerra.

be my guest, that's why it's here for.

Lumos said:
This looks really good, but I have a question:
What are these "xgm_" things? Are they new presentation things for Warband?

part of sphere's modulemerger system, he'll probably be the best to answer these (here are the link to his posts on the subject: http://forums.taleworlds.com/index.php/topic,127134.msg3066778.html#msg3066778 and http://forums.taleworlds.com/index.php/topic,128320.msg3093313.html#msg3093313)

And because I have 21 (or 22) factions, I'll make my own presentation (inspired by yours) where it'll be like a table, say:

The Factions Relations presentation does work with more than the 7 original factions (it's embedded in a scrollarea, only thing to be wary about is the coat of arm mesh placed at the beginning of the faction line, better comment that if you don't plan to add faction specific coat of arm meshes), though if you want to make your own it's open (I'm afraid that the code is a bit of a mess, this one being my first presentation and placing the column and line separator is a real pain).

second presentation only has the faction filter hard-coded (you might also want to disable the coat of arm mesh overlay next to the portrait, if using in a mod with extended factions too).
 
I haven't gone into the details, but when I was wrapping the presentations, I noticed a strange behavior which could be a bug:

I have 1 companion, 1 known load and no courtship during the testing.
When I first open the player and companion presentation (mode 2), it correctly shows the player troop and the 1 other companion I have.  I can click on either and info etc shows fine (except just a little "stretched" on a wide screen lcd :wink: )

then I switch to lords relation (mode 1) which also shows the lord correctly

then I tested courtships (mode 0) which also no troop correctly

But when I switched back to player and companion, I find that I can no longer select the 2nd troop (companion).

(lol, I admit I'm lazy, so I did not take a detail look at the scripting, since you can probably do it faster)

btw, I've succeeded in packing it under my modmerger (but witheld release due to above prob), with added global options to control whether to switch between the original reports or the new reports:

Cxmpe.jpg
(The bottom 4 checkboxes are for jrider's presentations).

Basically, if the checkboxes are all unchecked, the reports menu will behave as if the mod was never there (all changed reports goes back to original ugly text mode, and new "view player and companion report" will not appear).  This part is "optional" and will only appear if my other  "xgm mod options" kit is also active.  If not, it will be up to individual modder to implement their own control over the 4 global variable flags.


 
Back
Top Bottom