Show faces in history?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
User avatar
Yukari
Regular
Posts: 123
Joined: Sun Feb 06, 2011 6:28 am
Completed: Aozora Meikyuu, Yozora Rhapsody, Imolicious, Yume Puzzle, Apprehend;Girlfriend
Projects: Games&Girls, Fuyuzora Rumble
Organization: Yume Creations
Tumblr: yumecreationsvn
Location: Germany
Contact:

Show faces in history?

#1 Post by Yukari »

Is it possible to show faces in the history screen instead of the name?
like this:
Image
Image

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Show faces in history?

#2 Post by Tayruu »

I'm assuming you're using the text history script, right? Yes it's possible, but it may be a little ... complicated. I'm not too sure where to begin, but I've done edits to the script myself. I apologise if my explanation ends up being obtuse.

Actually there could be a simple way to go about this. In the script down the bottom there is a line that goes label line[0]. You'd have to change it to use line[0] to point to the face you want. The trouble with this is that while you might have a name called "Alex", what the game actually takes from line[0] is "{color='#0f0'}Alex:{/color}"... or something. (You can check what it actually sees with the style inspector pointed at some dialogue.)

You would do something to the effect of add HistoryFaces(logo[0]) pos(x, y), in the place of label line[0], and then in a python block - like the one just above the screen block, define HistoryFaces as an array where "Alex" = "alex_face.png". Where the keys would be the names, and the values are the graphics, or definitions of. ... or uh, er. I actually don't really know how python does arrays, I'm talking theoretical more than explicit code.

...

The more complicated method requires modifying store_say and store_current_line. In the script it has "(who, what)", which is what stores the information that will be read by lines_to_show in the screen, followed by line[x]. line[0] reads who, line[1] reads what, and line[2] stores the voice file.

In certain parts of the script where store_say and store_current_line are called, you'll need to modify the arguments (who and what) by adding in something that'll store the face graphic. The trouble with this idea though, is that I don't think portrait display is part of dialogue like names, text, or voices. So I am not sure where else in the script you'd actually point to the graphic, or where would get that information from. The reason I thought this might work in the first place was because this was how I performed my own edits - but they were to do with choice menus, not character graphics.

DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: Show faces in history?

#3 Post by DesertFox »

Bumping this topic out of interest.

Any more suggestions on creating side images in text history?

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Show faces in history?

#4 Post by xavimat »

I'm not sure about how the History script works, but if you can add the name of the character you should be able to add an image inside the text itself using the {image} text tag: http://renpy.org/doc/html/text.html#text-tag-image
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Show faces in history?

#5 Post by xela »

Tayruu ideas sound perfectly reasonable, what went wrong?
Like what we're doing? Support us at:
Image

DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: Show faces in history?

#6 Post by DesertFox »

xela wrote:Tayruu ideas sound perfectly reasonable, what went wrong?
Simply adding an image above label line[0] works perfectly well. Applying this to side_image brings up some issues.

Code: Select all

define narrator = Character(" ", color="#000000", show_two_window=True, show_side_image=Image("character/side/narrator_side.png", xalign=0.02, yalign=1.07), ctc="ctc1", ctc_position="fixed")

Code: Select all

screen text_history:
    default side_image = None
    use transpar3
    tag menu 
    if not current_line and len(readback_buffer) == 0:
        $ lines_to_show = []
    elif current_line and len(readback_buffer) == 0:
        $ lines_to_show = [current_line]
    elif current_line and not ( ( len(readback_buffer) == 3 and current_line == readback_buffer[-2]) or current_line == readback_buffer[-1]):  
        $ lines_to_show = readback_buffer + [current_line]
    else:
        $ lines_to_show = readback_buffer
    $ adj = NewAdj(changed = store_yvalue, step = 300)
    window:
        style_group "readback"
        side "c r":
            frame:
                has viewport:
                    mousewheel True
                    draggable True
                    yinitial yvalue
                    yadjustment adj
                vbox:
                    null height 10
                    for line in lines_to_show:
                        if line[0] and line[0] != " ":
                            if side_image:
                                add side_image xpos 3.0
                            label line[0] # name
                        # if there's no voice just log a dialogue
                        if not line[2]:
                            text line[1]
                        # else, dialogue will be saved as a button of which plays voice when clicked
                        else: 
                            textbutton line[1] action Play("voice", line[2] )
                        null height 25
                        text "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
                        null height 25
            bar adjustment adj style 'vscrollbar'
        textbutton _("Return") action Return() align (1.5, 0.95)    
Perhaps it's the definition of side_image itself but it seems to work perfectly fine for the Say screen, so I'm not certain why it can't be applied to the text history.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Show faces in history?

#7 Post by xela »

I have no setup to test this with. Also, this depends on how you define the images themselves, maybe you can show images based on names of characters and their expressions.
Like what we're doing? Support us at:
Image

DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: Show faces in history?

#8 Post by DesertFox »

xela wrote:I have no setup to test this with. Also, this depends on how you define the images themselves, maybe you can show images based on names of characters and their expressions.
Try these out.

Code: Select all

################################################################
#TEXT HISTORY

init 1 python:
    style.vscrollbar_frame.background="#cc0"
    style.vscrollbar.xmaximum = 30
    style.vscrollbar.ymaximum = 520
    style.vscrollbar.thumb_offset = 12
    style.vscrollbar.xpos=430
    style.vscrollbar.yalign = .5
    
init -4 python:
    store.text_history_enabled = False    
    
init -3 python:
    style.readback_window.background = None
    style.readback_window.xmaximum = 1366
    style.readback_window.ymaximum = 768
    style.readback_window.xalign = .5
    style.readback_window.yalign = .2
    style.readback_frame.left_padding = 30
    style.readback_frame.right_padding = -250
    style.readback_frame.top_padding = 40
    style.readback_frame.bottom_padding = 40
    style.readback_frame.xpos = 150
    style.readback_frame.xsize = 1100
    style.readback_frame.ysize = 600
    style.readback_text.color = "#fff"
    style.create("readback_button", "readback_text")
    style.readback_button.top_padding = 20
    style.readback_button.xpadding = 50
    style.readback_button.bottom_padding = 20
    #style.create("readback_button_text", "readback_text")
    style.readback_button_text.selected_color = "#f12"
    style.readback_button_text.hover_color = "#f12"
    style.readback_label_text.bold = True
    style.readback_text.size = 18
    style.readback_label_text.size = 22
    
    # starts adding new config variables
    config.locked = False 
    
    # Configuration Variable for Text History 
    config.readback_buffer_length = 100 # number of lines stored
    config.readback_full = True # True = completely replaces rollback, False = readback accessible from game menu only (dev mode)
    config.readback_disallowed_tags = ["size"] # a list of tags that will be removed in the text history
    config.readback_choice_prefix = ">> "   # this is prefixed to the choices the user makes in readback
    
    # ends adding new config variables
    config.locked = True
    
init -2 python:

    # Two custom characters that store what they said
    class ReadbackADVCharacter(ADVCharacter):
        def do_done(self, who, what):
            store_say(who, what)
            store.current_voice = ''
            return

    class ReadbackNVLCharacter(NVLCharacter):
        def do_done(self, who, what):
            store_say(who, what)
            store.current_voice = ''
            return
            
    # this enables us to show the current line in readback without having to bother the buffer with raw shows
    def say_wrapper(who, what, **kwargs):
        store_current_line(who, what)
        return renpy.show_display_say(who, what, **kwargs)
    
    config.nvl_show_display_say = say_wrapper
    
    adv = ReadbackADVCharacter(show_function=say_wrapper)
    nvl = ReadbackNVLCharacter()
    NVLCharacter = ReadbackNVLCharacter
    
    # rewriting voice function to replay voice files when you clicked dialogues in text history screen
    def voice(file, **kwargs):
        if not config.has_voice:
            return
        
        _voice.play = file
        
        store.current_voice = file

    # overwriting standard menu handler
    # Overwriting menu functions makes Text History log choice which users choose.
    def menu(items, **add_input): 
        
        newitems = []
        for label, val in items:
            if val == None:
                narrator(label, interact=False)
            else:
                newitems.append((label, val))
                
        rv = renpy.display_menu(newitems, **add_input)
        
        # logging menu choice label.
        for label, val in items:
            if rv == val:
                store.current_voice = ''
                store_say(None, config.readback_choice_prefix + label)
        return rv
        
    def nvl_screen_dialogue(): 
        """
         Returns widget_properties and dialogue for the current NVL
         mode screen.
         """

        widget_properties = { }
        dialogue = [ ]
        
        for i, entry in enumerate(nvl_list):
            if not entry:
                continue

            who, what, kwargs = entry

            if i == len(nvl_list) - 1:
                who_id = "who"
                what_id = "what"
                window_id = "window"

            else:
                who_id = "who%d" % i
                what_id = "what%d" % i
                window_id = "window%d" % i
                
            widget_properties[who_id] = kwargs["who_args"]
            widget_properties[what_id] = kwargs["what_args"]
            widget_properties[window_id] = kwargs["window_args"]

            dialogue.append((who, what, who_id, what_id, window_id))
        
        return widget_properties, dialogue
        
    # Overwriting nvl menu function
    def nvl_menu(items):

        renpy.mode('nvl_menu')
        
        if nvl_list is None:
            store.nvl_list = [ ]

        screen = None
        
        if renpy.has_screen("nvl_choice"):
            screen = "nvl_choice"
        elif renpy.has_screen("nvl"):
            screen = "nvl"
            
        if screen is not None:

            widget_properties, dialogue = nvl_screen_dialogue()        

            rv = renpy.display_menu(
                items,
                widget_properties=widget_properties,
                screen=screen,
                scope={ "dialogue" : dialogue },
                window_style=style.nvl_menu_window,
                choice_style=style.nvl_menu_choice,
                choice_chosen_style=style.nvl_menu_choice_chosen,
                choice_button_style=style.nvl_menu_choice_button,
                choice_chosen_button_style=style.nvl_menu_choice_chosen_button,
                type="nvl",                      
                )
                
            for label, val in items:
                if rv == val:
                    store.current_voice = ''
                    store_say(None, config.readback_choice_prefix + label)
            return rv
            
        # Traditional version.
        ui.layer("transient")
        ui.clear()
        ui.close()

        ui.window(style=__s(style.nvl_window))
        ui.vbox(style=__s(style.nvl_vbox))
        for i in nvl_list:
            if not i:
                continue

            who, what, kw = i            
            rv = renpy.show_display_say(who, what, **kw)
        renpy.display_menu(items, interact=False,
                           window_style=__s(style.nvl_menu_window),
                           choice_style=__s(style.nvl_menu_choice),
                           choice_chosen_style=__s(style.nvl_menu_choice_chosen),
                           choice_button_style=__s(style.nvl_menu_choice_button),
                           choice_chosen_button_style=__s(style.nvl_menu_choice_chosen_button),
                           )
        ui.close()
        roll_forward = renpy.roll_forward_info()
        rv = ui.interact(roll_forward=roll_forward)
        renpy.checkpoint(rv)
        for label, val in items:
            if rv == val:
                store.current_voice = ''
                store_say(None, config.readback_choice_prefix + label)
        return rv
        
    ## readback
    readback_buffer = []
    current_line = None
    current_voice = None
    
    def store_say(who, what):
        global readback_buffer, current_voice
        if preparse_say_for_store(what):
            new_line = (preparse_say_for_store(who), preparse_say_for_store(what), current_voice)
            readback_buffer = readback_buffer + [new_line]
            readback_prune()
    def store_current_line(who, what):
        global current_line, current_voice
        current_line = (preparse_say_for_store(who), preparse_say_for_store(what), current_voice)
    # remove text tags from dialogue lines 
    disallowed_tags_regexp = ""
    for tag in config.readback_disallowed_tags:
        if disallowed_tags_regexp != "":
            disallowed_tags_regexp += "|"
        disallowed_tags_regexp += "{"+tag+"=.*?}|{"+tag+"}|{/"+tag+"}"
    import re
    remove_tags_expr = re.compile(disallowed_tags_regexp) # remove tags undesirable in readback
    def preparse_say_for_store(input):
        global remove_tags_expr
        if input:
            return re.sub(remove_tags_expr, "", input)
    def readback_prune():
        global readback_buffer
        while len(readback_buffer) > config.readback_buffer_length:
            del readback_buffer[0]
    # keymap overriding to show text_history.
    def readback_catcher():
        ui.add(renpy.Keymap(rollback=If(store.text_history_enabled,[ SetVariable("yvalue", 1.0), ShowMenu("text_history")])))
        ui.add(renpy.Keymap(rollforward=ui.returns(None)))
    if config.readback_full:
        config.rollback_enabled = False
        config.overlay_functions.append(readback_catcher) 
    
init python:
    yvalue = 1.0
    class NewAdj(renpy.display.behavior.Adjustment):
        def change(self,value):
            if value > self._range and self._value == self._range:
                return Return()
            else:
                return renpy.display.behavior.Adjustment.change(self, value)         
    def store_yvalue(y):
        global yvalue
        yvalue = int(y)
        
        
screen text_history:
    default side_image = None
    use transpar3
    tag menu 
    if not current_line and len(readback_buffer) == 0:
        $ lines_to_show = []
    elif current_line and len(readback_buffer) == 0:
        $ lines_to_show = [current_line]
    elif current_line and not ( ( len(readback_buffer) == 3 and current_line == readback_buffer[-2]) or current_line == readback_buffer[-1]):  
        $ lines_to_show = readback_buffer + [current_line]
    else:
        $ lines_to_show = readback_buffer
    $ adj = NewAdj(changed = store_yvalue, step = 300)
    window:
        style_group "readback"
        side "c r":
            frame:
                has viewport:
                    mousewheel True
                    draggable True
                    yinitial yvalue
                    yadjustment adj
                vbox:
                    null height 10
                    for line in lines_to_show:
                        hbox:
                            if line[0] and line[0] != " ":
                                if side_image:
                                    add side_image xpos 3.0
                                label line[0] # name
                                null width 10
                            if line[1]:   
                            # if there's no voice just log a dialogue
                                if not line[2]:
                                    text line[1]
                            # else, dialogue will be saved as a button of which plays voice when clicked
                                else: 
                                    textbutton line[1] action Play("voice", line[2] )
                        null height 25
                        text "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
                        null height 25
            bar adjustment adj style 'vscrollbar'
        textbutton _("Return") action Return() align (1.5, 0.95)       

Code: Select all

define narrator = Character(" ", color="#000000", show_two_window=True, show_side_image=Image("narrator_side.png", xalign=0.02, yalign=1.07), ctc="ctc1", ctc_position="fixed")

Code: Select all

screen say:
    default side_image = None
    default two_window = True
    default quick_menu = True
    default quickmap = True
    if not two_window:
        window:
            id "window"
            has vbox:
                style "say_vbox"
            if who:
                text who id "who"
            text what id "what"
    else:
        use quick_menu
        use quickmap
        if side_image:
            add side_image
        else:
            add SideImage() xalign 0.0 yalign 1.0
        vbox:
            style "say_two_window_vbox"
            if who:    
                window:
                    style "say_who_window"                
                    text who:
                        id "who"                           
            window:
                id "window"
                has vbox:
                    style "say_vbox"
                text what id "what"

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Show faces in history?

#9 Post by xela »

LoL I didn't even remember what this thread was about. This is too much code to go through, see if you can create a project that has resources and illustrates the problem, although someone else with more patience than I might figure this out.
Like what we're doing? Support us at:
Image

DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: Show faces in history?

#10 Post by DesertFox »

Okay, I tried out using SideImage() using the updated code from the documentation but this has produced new problems. Now a side image will appear next to the text history dialogue, however due to the nature of SideImage(), it will update all of them to feature the current side image. Is there a way to implement SideImage() so that it has memory/stores side images in the way that text history stores dialogue and names?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Show faces in history?

#11 Post by xela »

Code: Select all

def SideImage(prefix_tag="side"):
        """
        :doc: side_image_function

        Returns the side image associated with the currently speaking character,
        or a Null displayable if no such side image exists.
        """

        name = renpy.get_side_image(prefix_tag, image_tag=config.side_image_tag, not_showing=config.side_image_only_not_showing)
        if name is None:
            return Null()
        else:
            return ImageReference(name)
Looks like a simple function. Just create your own or overwrite. The code that you wrote above looks a lot more complicated that this.
Like what we're doing? Support us at:
Image

DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: Show faces in history?

#12 Post by DesertFox »

I'm not certain anymore. I'm pretty sure the solution to making this work with text_history exists in the above but for now, I'm opting to go without faces in the text history screen. Perhaps someone will find a nice bit of simple coding for it one day.

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Show faces in history?

#13 Post by DragoonHP »

This is a very simple way of doing what you want (and what Tayruu suggested)

In the init -3 python block, add this

Code: Select all

    NameList = {"Eileen": "eileen.png"
                "Lucy"  : "lucy.png"}

    def HistoryImage(name = None):
        if name in NameList:
            return NameList[name]
        else:
            return Null()
And under screen text_history,

Code: Select all

                        if line[0] and line[0] != " ":
                            add HistoryImage( line[0] ) #Add this line
                            text line[0]

User avatar
inkacorn
Newbie
Posts: 6
Joined: Thu Nov 30, 2023 3:44 pm
Projects: Married to a Fool, Mehkrow Meadows
Tumblr: inkacornn
itch: inkacorn
Contact:

Re: Show faces in history?

#14 Post by inkacorn »

EDIT 12/1/23 - Updated code and clarity
was looking for an answer to this question and saw this problem was (seemingly) unsolved. i did eventually find an answer so ill be posting it here. apologies in advance for the absolute mess of code
there's two methods that can be used depending on what kind of look you want your game to have.

Method 1: Icons
the first method (and much easier way) would display your images like this;
Image

this method is pretty straightforward, simply go to your history screen and look for "if h.who" (which should be around line 940).

Code: Select all

                if h.who: #If the character speaking is not narrator, add image
                    add "images/[h.who]_side.png" #Be sure to include the file directory and correct image type
using renpy's who history entity, we can use it to call an image with that character's name in the file. so if your file name is "eileen_history.png" then you'd change it to "[h.who]_history.png"
to move the dialogue text depending on if an image is being displayed, you'd implement this under the what text display (line 952)

Code: Select all

                text what:
                    if h.who: # Makes room for the side image
                        xsize 900
                        xpos 245
                    else: # Moves text to where side image would be so theres no weird empty space
                        xpos 70
                        xsize 1000
                    substitute False
*PLEASE NOTE that this method will not record character attributes, meaning the facial expression will remain the same Image
while this can be great for icons, its not so great if you're trying to make it look like an ut/dr textbox

Method 2: Dynamic Images
the second method takes care of that issue and will display as such;
Image
but brace yourself, the code is messy, its hell to implement, and might be enough to make even renpy tom scream.

firstly, we need to make sure that the attributes (the expression a character is displaying) match both the history side image and the main character sprite
Image

once that's done, you need to add uh... this thing... above this history screen

Code: Select all

 init python:
    def history_tag_attributes_callback(h):
        h.mood = renpy.get_attributes(h.image_tag)

    config.history_callbacks.append(history_tag_attributes_callback)

init python:
    def get_string_for_list(list_obj):
        renpy.notify('call')
        if not isinstance(list_obj, (list, tuple, set)):
            raise TypeError, "Input parameter must be list, set or tuple"
        return "".join( [ 
            "{0}{1}".format( 
                v, 
                { len(list_obj)-1 : '', len(list_obj)-2 : ' and ' }.get( i, ', ' ) 
            ) for i,v in enumerate(list_obj) ] 
        )
    class SimpleObj(object):
        def __init__(self, *args, **kwargs):
            self.__dict__.update(kwargs)

        def __repr__(self):
            return ", ".join( [
                getattr(self, k) 
                for k in self.__dict__
                if k not in object.__dict__ ] )
it looks scary but really all it is a function that determines what attribute (or expression) is being displayed and makes sure that renpy can understand it as text.
now, under the history screen, we will add this

Code: Select all

add "[h.who]/[h.who]_[h.mood[0]].png"
alternatively, you can also use image tags if its defined

Code: Select all

 #anywhere.rpy
 define jevil = Character("Jevil", image = "jevil") 
 
 #in screens.rpy
 add "[h.image_tag]/[h.image_tag]_[h.mood[0]].png"
so now, your history screen should look something like this

Code: Select all

init python:
    def history_tag_attributes_callback(h):
        h.mood = renpy.get_attributes(h.image_tag)

    config.history_callbacks.append(history_tag_attributes_callback)

init python:
    def get_string_for_list(list_obj):
        renpy.notify('call')
        if not isinstance(list_obj, (list, tuple, set)):
            raise TypeError, "Input parameter must be list, set or tuple"
        return "".join( [ 
            "{0}{1}".format( 
                v, 
                { len(list_obj)-1 : '', len(list_obj)-2 : ' and ' }.get( i, ', ' ) 
            ) for i,v in enumerate(list_obj) ] 
        )
    class SimpleObj(object):
        def __init__(self, *args, **kwargs):
            self.__dict__.update(kwargs)

        def __repr__(self):
            return ", ".join( [
                getattr(self, k) 
                for k in self.__dict__
                if k not in object.__dict__ ] )

screen history():

    tag menu

    ## Avoid predicting this screen, as it can be very large.
    predict False

    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0):

        style_prefix "history"

        for h in _history_list:

            window:

                ## This lays things out properly if history_height is None.
                has fixed:
                    yfit True
                
                if h.who:

                    add "[h.image_tag]/[h.image_tag] side [h.mood[0]].png"

                    # Label who is the name of the character who talked
                    # It is optional if you want it to show up alongside the images

                    # label h.who:
                        #if "color" in h.who_args:
                            #text_color h.who_args["color"]

                $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                text what:
                    if h.who: # Makes room for the side image
                        xsize 900
                        xpos 245
                    else: # Moves text to where side image would be so theres no weird empty space
                        xpos 70
                        xsize 1000
                    substitute False

        if not _history_list:
            label _("The dialogue history is empty.")
and finally, after all of that, you simply need to state character attributes in script.rpy

Code: Select all

label start:
    scene bg

    show jevil smile
    jevil "IT'S FINALLY OVER!!!"

    jevil sad "...I can't believe this thread sat dormant for 8 years..."

    jevil laugh "BUT WHO USES THE HISTORY SCREEN ANYWAY?!"
which should give you this result:**
Image

**PLEASE NOTE that using this method means you cannot have None as an attribute, meaning this:

Code: Select all

show jevil
## or
jevil "Gosh, I sure do hope that Ren'py doesn't give me an error!"
will result in an error
however, as long as you define an attribute once like this:

Code: Select all

show jevil default 
## or
jevil default "I can't believe Ren'py said there was an error!"
jevil "I'm expecting it to happen again now."
won't result in any errors

so yeah, I do hope this helps anyone else in the future looking for answers to obscure questions lol
Last edited by inkacorn on Fri Dec 01, 2023 7:07 pm, edited 2 times in total.
Also known as the crazy jester lady
ImageImageImage

User avatar
plastiekk
Regular
Posts: 109
Joined: Wed Sep 29, 2021 4:08 am
Contact:

Re: Show faces in history?

#15 Post by plastiekk »

inkacorn wrote: Thu Nov 30, 2023 11:08 pm ...
Wow! Could you upload a little example so that users like me can try it out? I'm not firm with python classes but I can imagine that there is a solution not to always write default. Perhaps this can even be solved in the callback function. But I need to fiddle with it :D
Why on earth did I put the bread in the fridge?

Post Reply

Who is online

Users browsing this forum: Imperf3kt