In response to a lot of the difficulties people were having, I've been working on a version 2 of the Encyclopaedia Framework. I've kept most of the core concepts similar, but this is a hard break for quite a bit of the behaviour. Overall, it should be much more user-friendly and easier to customize.
The beta for v2 is available at:
https://github.com/jsfehler/renpy-encyc ... a/releases
and documentation at:
http://renpy-encyclopaedia.readthedocs. ... index.html
Getting v2 out of beta is going to take a lot more manual testing (I've tested it a lot, but I'm sure there's things I've missed.), more work on the documentation, and more unit tests.
The information below is outdated, but kept for archival purposes:
The following is a prototype for an Encyclopaedia and/or Bestiary. I've done my best to split up the data management and screens, but using and customizing this will still require a tiny bit of python knowledge. My knowledge of screen language isn't that advanced, but nothing in the layout outright explodes.
While I've tried to be rigorous in finding outright bugs, a lot of the logic I've used to get everything working may not ultimately be the best way to go about it, or just simply sort of clunky. I hope that posting it here will invite people to try it out, break it apart, and report on their results.
That said, everything's working fine on my end and I hope it works on yours.
-Sorting entries by Entry Number, A to Z, Z to A, or by Subject
-Entries can have multiple pages
-An Image can be displayed next to an entry, or not
-Lock entries, then Unlock them over the course of the game
-Unread Entries are tagged.
-Locked entries can be displayed as "???" or outright hidden
-Access from the main menu or during gameplay
-Major code refactoring under the hood.
-Flags for status can be generated dynamically.
-Bug Fix: Can now start an Encyclopaedia in Z to A sorting
-Screens simplified and rearranged a bit
-An Entry/Sub-Entry's Text can now be single string or list of strings. (Useful to make paragraphs.)
-Tweaks in how entry_text variable is processed to support paragraphs
-Encyclopaedia "showLocked" variable renamed "showLockedButtons"
-Encyclopaedia "showLockedEntry" variable added. Determines if locked entry pages can be viewed or not.
(showLockedButtons and showLockedEntry are independent and compatible, but personally, the user experience will be weird if showLockedEntry but not showLockedButtons)
-Viewable Locked entry page shows generic name and text. Can be modified (Default is "???" in both cases)
-Viewable Locked entry page shows tinted image. Tint amount can be changed or the locked image can be an entirely different image.
-Demo project and attached files below updated
-Multiple encyclopaedias can now be created in the same project
-Refactored code, fixed notes, should be more user friendly now
-Fixed bug involving sub-page number not resetting
-Fixed bug involving entries not sorting into the correct subject when hiding locked entries
-"new!" status is restored when an entry gets a new sub-entry
-Added show/hide locked entries button
-Percentage of the Encyclopaedia unlocked can be displayed now
-Demo project and attached files below updated
I've included a demo game to show everything in action. The user experience suffers a bit to show off everything, but this also helps ensure no feature bugs out another when used. The Encyclopaedia can be accessed from the Main Menu or via button in-game.
To use the Encyclopaedia in your project, drop encyclopaedia.rpy into your project's game folder. Refer to the included enc_data.rpy and script.rpy to see how entries and the screens are created.
-The Encyclopaedia uses Persistent Data to save the Unread and Locked flags. Regardless of save game, once it's open and read, that's it.
-Read entries only save their status after exiting the Encyclopaedia. If the program is closed before exiting, the Unread status returns.
-Exiting the Encyclopaedia sets the sorting to by number. This is necessary to make sure the Unread flags save correctly.
Basic Usage example:
Code: Select all
init python: e = Encyclopaedia() e.addSubjects("Subject 1", "Subject 2", "Etc") entry1 = EncEntry (number=1, name="Title", text="Entry Text", subject="Subject 1", status=False, locked=False, image= "directory/image.jpg") e.addEntry(entry1)
Encyclopaedia(sortingMode = "Number", showLockedButtons=False, showLockedEntry=False)
Holds entry objects and organizes how they're displayed.
sortingMode - Determines which type of sorting is used when an Encyclopaedia is first opened. Can be "Number", "A to Z", "Z to A", "Subject".
showLockedButtons - If True, the buttons for locked entries will be visible in the entry list.
showLockedEntry - if True, locked entries will be viewable. Locked entries, even when viewed, hide data from the player.
EncEntry(number=0, name="Entry Name", text="Entry Text", subject=None, status=None, locked=False, image=None, locked_image=None)
Holds the data for an individual entry.
number - The entry's number in an Encyclopaedia's list. Used for sorting.
name - The title of an entry. Must be a string.
text - The text of an entry. Can be a string or a list of strings.
subject - An entry's subject. Used for sorting by subject.
status - If None or False, Entry is considered to have not been viewed. If viewed/unviewed status is shown to player, must be persistent variable that is a Boolean or status will reset every time the project is started.
locked - If not False, must be a persistent variable that is a Boolean or else entry will lock every time the project is started.
image - Image associated with entry.
locked_image - Image to be displayed if entry is locked and locked entries are viewable. If None, will be a tinted version of image.