Git Product home page Git Product logo

renpy-encyclopaedia's Introduction

Encyclopaedia Framework for Ren'Py

Build status

image

A plugin for the Ren'py Visual Novel engine

Use it to create an encyclopaedia, bestiary, glossary, codex or similar system.

Features

  • Sort entries by Number, Alphabetically, Reverse Alphabetically, by Subject, or by Unread status.
  • Filter entries by Subject.
  • Sub-page system for nesting entries. Allows an entry to be unlocked progressively.
  • Locking/unlocking allows you to decide when entries should be accessible.
  • Locked entries can be displayed with customizable placeholders or outright hidden.
  • Entry Unlocks can be tied to individual save games or universal (using Ren'py persistent data).
  • Default visual template is provided, but can be completely customized or replaced using Ren'py Screen Language.

Documentation

Documentation is available at https://renpy-encyclopaedia.readthedocs.io/

Contributing

For filing bugs or feature requests, please use the GitHub issue tracker

renpy-encyclopaedia's People

Contributors

jsfehler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

renpy-encyclopaedia's Issues

Question about changing filter by next or previous

Hello there! I find no clues about my question so I have to bother here for a proper answer. It would be great if you can kindly point out what's wrong I did.

My goal : making 2 buttons to toggle filter forward or backward. Here is my UI example:
image

My idea:
Set a list of all my subject. i. e:
default all_subject = ['subject1','subject2']

Set a screenvariable to count the number:

Screen Test():
    default order = 0
    fixed:
        imagebutton 'left_arrow':
            if order>0:
                action (SetScreenVariable('order',order-1,enc.FilterBySubject(all_subject[order])))
       text all_subject[order]
        imagebutton 'right_arrow':
            if order<len(all_subject):
                action (SetScreenVariable('order',order+1),enc.FilterBySubject(all_subject[order]))

someting like that!
However, I find it doesn't work properly, or to say, it somehow not filter in the current order. Sometimes I click the next, but it stay the same, or even go back to previous subject. By the way, the order's value works well, but only the filter and the subject got wrong.

*Also, when I write some code like

Screen Test():
    for i in range (0,len(all_subject)):
        textbutton all_subject[i] action enc.FilterBySubject(all_subject[i])

if works well.

Maybe something goes wrong about the data refreshing? Or I wonder if there are anything wrong I did?

Add pagination for entries listing

On the default screen, a textbutton is created for each entry. The more entries an encyclopaedia has, the more of a hit this will cause to performance.

The listing of entries should have some sort of pagination mechanism, forcing the maximum number of buttons on screen to be no more than a few dozen at a time.

Showing sub-Entry before the main Entry is unlocked?

Hello there! I had an interesting problem and wonder if it's possible to show a sub entry before its parent unlocked?
To put it simple, I’m using the encyclopedia as a character file. Some of the characters will have several entries differing from where you find them. Such as:

Character_A = CharacterEntry(
    name = 'A',
    text = ('dataA'),
    )

Character_A_2 = EncEntry(
    parent = Character_A,
    name = 'A',
    text = ('dataB'),
    )

Sometimes, it is Character_A_2 that unlock first.

But if we don't unlock Character_A, the player cannot attach Character_A_2.

To solve this problem, I tried to put the Character A as a parent-entry, and put the data A into another sub-entry. For example:

Character_A = CharacterEntry(
    name = 'A',
    text = (''),
    )

Character_A_2 = EncEntry(
    parent = Character_A,
    name = 'A',
    text = ('dataA'),
    )

Character_A_3 = EncEntry(
    parent = Character_A,
    name = 'A',
    text = ('dataB'),
    )

So I can unlock Both Character_A and Character_A_3, to avoid the player reading dataA first.

However, if I write so, then everytime the player open the file, they would always firstly saw Character A's data, as an empty page (because I cannot write the text in the parent entry.)

Is that anyway to avoid that? For example, is there any ways in the screen, that we can judge if the parent entry has text or not, and if not, we start to show the sub entry first?

Maybe there are any better way to solve this problems?

==========================
Thank you so much for reading my question. I'm newbee about python code so it took me a while to use encyclopedia system, but it's fascinating and really great!!! I love it so much and I really want to attach my goal by it...!!

Visualization problem with Ren'Py 8.0.3

Hi,
I was trying to use the Encyclopedia with Ren'Py 8.0.3, and it seems that the expressions half_screen_width = config.screen_width and half_screen_height = config.screen_height / 2 are giving different results than before (specifically, float values instead of integers). This gives visualization problems that can be avoided changing the code with half_screen_width = int(config.screen_width / 2) and half_screen_height = int(config.screen_height / 2).
The reason is, probably, the fact that Python 3.0 always returns a float value as a result for division operations.

Follows the discussion in:
renpy/renpy#4276

Unread entry label appears even if the entry has been already read

Hi,

if I use this simplified code to create an encyclopaedia, and then click on the encyclopaedia entry, the unread entry tag "New!" disappears. Hovewer, if after that I exit the game and launch it again, the "New!" tag will appear again, despite I already read the entry.

init python:
    your_new_encyclopaedia = Encyclopaedia()

    about_zeus = EncEntry(
        parent=your_new_encyclopaedia,
        name="Zeus",
        text=[
            "Zeus is the sky and thunder god in ancient Greek religion, who ruled as king of the gods of Mount Olympus."
            " His name is cognate with the first element of his Roman equivalent Jupiter."
            " His mythologies and powers are similar, though not identical, to those of Indo-European deities such as Indra, Jupiter, Perun, Thor, and Odin."
        ]
    )

label start:

    "Hello World!"

    return

To access the encyclopaedia, I just added this code in the screens.rpy file (main menu navigation screen):

textbutton _("Encyclopaedia") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia)

This happens on Windows 10 Pro, with Ren'Py 7.0.0.196

Question mark (locked) entries at the top when sorting -- Confirmed fix proposition within

When sorting by "A to Z," "Z to A," "Subject," or "Unread" the locked entries denoted by "???" are sorted with the "letter" "?" at the top of the list.

To replicate this issue, unlock at least one entry while leaving a few others locked and sort by any of the above options. The "?" will be sorted above any alphanumeric entries leaving a bunch of locked entries to scroll past first.

Fix:

I fixed this issue on my end by changing this line (line 21) in "entry_sorting_ren.py" from:

new_list = sorted(seq, reverse=True, key=attrgetter('locked'))

to

new_list = sorted(seq, reverse=False, key=attrgetter('locked'))

Renpy Crash when you click the sort by "Unread" button

Whenever you try to use the sort by unread function, renpy crashes with the following log:

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00gamemenu.rpy", line 174, in script
    $ ui.interact()
  File "renpy/common/00gamemenu.rpy", line 174, in <module>
    $ ui.interact()
TypeError: '<' not supported between instances of 'bool' and 'NoneType'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/00gamemenu.rpy", line 174, in script
    $ ui.interact()
  File "C:\code\renpy_current_version\renpy\ast.py", line 823, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\code\renpy_current_version\renpy\python.py", line 1178, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/00gamemenu.rpy", line 174, in <module>
    $ ui.interact()
  File "C:\code\renpy_current_version\renpy\ui.py", line 301, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\code\renpy_current_version\renpy\display\core.py", line 2165, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
  File "C:\code\renpy_current_version\renpy\display\core.py", line 3201, in interact_core
    rv = root_widget.event(ev, x, y, 0)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\transition.py", line 53, in event
    return self.new_widget.event(ev, x, y, st) # E1101
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\screen.py", line 793, in event
    rv = self.child.event(ev, x, y, st)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1426, in event
    rv = super(Window, self).event(ev, x, y, st)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 288, in event
    rv = d.event(ev, x - xo, y - yo, st)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1426, in event
    rv = super(Window, self).event(ev, x, y, st)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 288, in event
    rv = d.event(ev, x - xo, y - yo, st)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\layout.py", line 1202, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "C:\code\renpy_current_version\renpy\display\behavior.py", line 1174, in event
    return handle_click(self.clicked)
  File "C:\code\renpy_current_version\renpy\display\behavior.py", line 1095, in handle_click
    rv = run(action)
  File "C:\code\renpy_current_version\renpy\display\behavior.py", line 395, in run
    return action(*args, **kwargs)
  File "game/encyclopaedia/actions_ren.py", line 245, in __call__
    self.enc.sort_entries(
  File "game/encyclopaedia/encyclopaedia_ren.py", line 199, in sort_entries
    entries.sort(key=attrgetter('viewed'))
  File "C:\code\renpy_current_version\renpy\revertable.py", line 97, in do_mutation
    return method(self, *args, **kwargs)
TypeError: '<' not supported between instances of 'bool' and 'NoneType'

Windows-10-10.0.22000 AMD64
Ren'Py 8.2.1.24030407
Test Encyclopedia 1.0
Thu Mar  7 12:26:44 2024

I have created a bare-bones test project to reproduce the issue using the same encyclopaedia setup I'm using for my main project.
Test Encyclopedia.zip

The only additional code that is changed is in script.rpy and the new file enc_1.rpy to define an Encyclopaedia and entries.

I am using the most up to date version of renpy (8.2.1.24030407) and addon (3.1.0) as of this ticket. Let me know if you need more additional information.

Help with setup?

Hello, im attempting to use your framework to contribute with a friend's visual novel
I have been reading your documentation but i dont seem to understand how to make a basic glossary work, i dont that much about programming, but is this that complicated? Can you help me?
In renpy under which file should i start writing the statements for an encyclopaedia object and entries? Where can i ask about this?

Add readme for mock_renpy

mock_renpy is a collection of stubbed functions and classes that exist to allow Sphinx and pytest to run against the Encyclopaedia without issues.

Due to how small it is, this was considered more effective than pulling in all of Ren'Py.

However, the package lacks a readme, potentially causing confusion to anyone looking at the repo.

Translation labels not working

Hi,
when I try to follow the instructions in the encyclopaedia docs (http://renpy-encyclopaedia.readthedocs.io/en/latest/translations.html) to create a translation, I get the following error:

I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 2, in script
init python:
File "game/script.rpy", line 9, in
fr_labels = Labels()
TypeError: init() takes exactly 2 arguments (1 given)

This happens even with a very simplified code, based on the example provided in the docs:

init python:
    # English
    en_encyclopaedia = Encyclopaedia()

    # French
    fr_encyclopaedia = Encyclopaedia()

    fr_labels = Labels()
    fr_labels.sort_alphabetical_label = "De A à Z"

    fr_encyclopaedia.labels = fr_labels

label start:

    "Not Working"

    return

This happens on Windows 10 Pro, with Ren'Py 7.0.0.196

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.