Simple Glossary / Dictionary / Footnote Implementation

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Simple Glossary / Dictionary / Footnote Implementation

#1 Post by verysunshine »

I put together a simple footnote or glossary system. Feel free to modify this however you like and use it in whatever projects you wish.

Features:
  • Open an entry by clicking on text

    Scrollable text field

    Close button

    Translation friendly
Setting up the Note:

To set up the note, use the following code. I put the note-related code in its own file, but you can put this in screens.rpy

Code: Select all

screen note(notetext):
    modal True ##stops the user from clicking to continue while this is open
    style_group "note"
    frame:
        ysize 200
        padding (5,5)
        viewport:
            draggable True mousewheel True ##This will allow the text to exceed the boundaries of the box.
            vbox:
                spacing 10
                box_wrap True
                #label _("Note") ##Uncomment the label to have the heading "Note"
                text _(notetext)
        vbox:
            align (0.0, 1.0) ##puts this on the bottom
            textbutton _("Close") action Hide("note")
Using the Note:

The note has two parts. The first is the note itself. I put this in the same file as the screen, but you can put this in script.rpy

Code: Select all

label example:
    show screen note("Notes look like this.")
    $renpy.restart_interaction() #Allows ren'py to continue from the current point
And the second is a link to the footnote. This uses the link text tag. Put the label for the note between "jump:" and the "}".

Code: Select all

"I have added {a=jump:example}notes{/a}."

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

Hseo
Regular
Posts: 38
Joined: Thu Sep 24, 2009 10:42 am
Completed: High School Life:HSL
Deviantart: greeeed
Contact:

Re: Simple Glossary / Dictionary / Footnote Implementation

#2 Post by Hseo »

Love it, thanks for sharing.

Post Reply

Who is online

Users browsing this forum: No registered users