Show Images in History What Text [SOLVED]

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.
Post Reply
Message
Author
User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Show Images in History What Text [SOLVED]

#1 Post by wyverngem »

In the History menu how would I allow the image tag to be kept?

----
Answer

Code: Select all

define gui.history_allow_tags = set('b','u','i','color','image')
Last edited by wyverngem on Sun Mar 03, 2019 3:45 pm, edited 1 time in total.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Show Images in History What Text

#2 Post by isobellesophia »

https://www.renpy.org/doc/html/history. ... .image_tag

And maybe.. try add a image file on your own.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Show Images in History What Text

#3 Post by wyverngem »

I think that goes with showing a sprite. However, I'm looking for writing something like this;

Code: Select all

e "I {image="gui/emoji_heart.png"} you."

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Show Images in History What Text

#4 Post by wyverngem »

Still haven't figured this one out yet. I wonder if it's a part of defining a specific tag to keep.

strayerror
Regular
Posts: 159
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Show Images in History What Text

#5 Post by strayerror »

First, if you first created your game prior to Ren'Py 7.1.1, make sure you read these notes (https://www.renpy.org/doc/html/changelo ... enpy-7-1-1) and update your history screen definition in screens.rpy as appropriate.
(edit: Turns out this first one (above) isn't directly related, but it may help avoid future problems around the history screen.)

Second, by default no tags are allowed to be shown in the history screen. You can whitelist tags by setting gui.history_allow_tags, which should be a set. For example if you wanted to allow only bold, underline and image tags you would add this to your gui.rpy file:

Code: Select all

define gui.history_allow_tags = {'b', 'u', 'image'}

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Show Images in History What Text

#6 Post by Imperf3kt »

It might be worth noting that in older versions of Ren'Py, image tags did used to show up in the history screen, so any old guides or tutorials you may find, might reflect this.
I still have one project I began creating in Ren'Py 6.99 that used a few {image} tags and they all show up in the history screen, despite me never adding them to a whitelist (even though I am now using 7.1.3)
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Show Images in History What Text

#7 Post by wyverngem »

Aha, so that's how you change the set. When I searched for "gui.history_allow_tags" or "history_allow_tags" in the documentation there wasn't anything in there as a guide. I updated the history screen and changed it to what you suggested. I'm currently in version Ren'py 7.1.3.10922, but my original screens scripts were created before the update.

The define below the screen just uses set(), but I didn't know how to format it. I tried "define gui.history_allow_tags = set('b','u','i','color','image')", but got the error "TypeError: RevertableSet expected at most 1 arguments, got 4".

This works though. :D

Code: Select all

#define gui.history_allow_tags = set()
define gui.history_allow_tags = {'b', 'u', 'image', 'i'}
Updated Screen without styles

Code: Select all

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.image_tag:
                    add "gui/history/h_"+h.image_tag+".png"
                if h.who:
                    label h.who:
                        style "history_name"
                        substitute False
                        ## Take the color of the who text from the Character, if set.
                        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 substitute False
        if not _history_list:
            label _("The dialogue history is empty.")


## This determines what tags are allowed to be displayed on the history screen.

#define gui.history_allow_tags = set()
define gui.history_allow_tags = {'b', 'u', 'image', 'i'}

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], Rhapsy