Page 7 of 8

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Jan 20, 2020 1:16 am
by Human Bolt Diary
You can't really access variable names in python. You could hack together a solution using the inspect module, but it's not a good idea. The most efficient solution is to reference your entries by their number. Your second best is to add a tag to every entry, like:

Code: Select all

jupiter = EncEntry(
        parent=perso,
        name="Jupiter, god of thunder",
        text=[_(""" Text here""")],
        viewed_persistent=True,
    )
    
jupiter.tag = "jupiter"
    
    
Ayael wrote: Tue Jan 14, 2020 11:01 am Hi, it's me again ! I was wandering, how can we retrieve the entry ID name.

For example :

Code: Select all

jupiter = EncEntry(
        parent=perso,
        name="Jupiter, god of thunder",
        text=[_(""" Text here""")],
        viewed_persistent=True,
    )
I know, if I want to retrives "Juper, god of thunder", I can use

Code: Select all

entry.name
, but I can't find the code I should use to retrieve "jupiter".

(If you wander why, it's because I am using this kind of code to have images instead of text in the list :

Code: Select all

idle "images/codex/entry/entry_" + entry.name + "_idle.png"
But having the entry displaying name is really annoying, I would rather have the id name. I could use the ID number, but it's harder to remember).

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Jan 20, 2020 1:27 am
by Human Bolt Diary
v2.4 of the Encyclopaedia Framework has been released. Download is available at: https://github.com/jsfehler/renpy-encyc ... s/tag/v2.4

EncEntryTemplate was added in this release. Documentation at: https://renpy-encyclopaedia.readthedocs ... lates.html

A small wrapper around functools.partial, it can make writing and managing large amounts of entries a bit easier.

Code: Select all

about_gods = Encyclopaedia()

GreekGodsEntry = EncEntryTemplate(parent=about_gods, subject="Greek Gods")

about_zeus = GreekGodsEntry(name="Zeus")

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Jan 20, 2020 4:05 pm
by Ayael
oh thanks ! And it's a nice add-on ! You are the best !

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Jan 27, 2020 12:44 pm
by munni
Hi there!

Would it be possible to switch from an encyclopaedia to another mid-game? When the character's POV switch, I'd like for the encyclopaedia to have a different layout + entries.

Code: Select all

$ protagonist = "character_A"
a "I know a lot about {a=set_entry:enc_people->about_Dogs}{color=#DA70D6}dogs{/color}{/a}."

$ protagonist = "character_B"
b "I specialize in making {a=set_entry:enc_recipes->about_Fruitcake}{color=#DA70D6}fruitcakes{/color}{/a}!"
I would like to combine that with the hyperlink feature you made a while back, but I think something is preventing the switch from happening. My guess is it has something to do with this bit:

Code: Select all

        def __init__(self,
                     sorting_mode=0,
                     show_locked_buttons=False,
                     show_locked_entry=False,
                     entry_screen="encyclopaedia_entry", # this one ?
                     tint_locked_image=True):
Thanks for sharing the encyclopaedia library with us by the way. It's a great VN feature for info-heavy games!

Re: Encyclopaedia / Bestiary Framework

Posted: Tue Jan 28, 2020 12:20 am
by Human Bolt Diary
If the entries change too, it sounds like you need two separate Encyclopaedas, each pointing to a different screen.

"encyclopaedia_entry" is just a default screen I've included. Any screen that takes an Encyclopaedia as an argument is valid.

If only the layout changes, you could probably override the entry_screen attribute with the name of another screen, then switch it back whenever you want.

munni wrote: Mon Jan 27, 2020 12:44 pm Hi there!

Would it be possible to switch from an encyclopaedia to another mid-game? When the character's POV switch, I'd like for the encyclopaedia to have a different layout + entries.

Code: Select all

$ protagonist = "character_A"
a "I know a lot about {a=set_entry:enc_people->about_Dogs}{color=#DA70D6}dogs{/color}{/a}."

$ protagonist = "character_B"
b "I specialize in making {a=set_entry:enc_recipes->about_Fruitcake}{color=#DA70D6}fruitcakes{/color}{/a}!"
I would like to combine that with the hyperlink feature you made a while back, but I think something is preventing the switch from happening. My guess is it has something to do with this bit:

Code: Select all

        def __init__(self,
                     sorting_mode=0,
                     show_locked_buttons=False,
                     show_locked_entry=False,
                     entry_screen="encyclopaedia_entry", # this one ?
                     tint_locked_image=True):
Thanks for sharing the encyclopaedia library with us by the way. It's a great VN feature for info-heavy games!

Re: Encyclopaedia / Bestiary Framework

Posted: Tue Jan 28, 2020 8:19 am
by munni
In order to make a 'new' encyclopaedia, I duplicated the screens in encyclopaedia.rpy into something like this:

Code: Select all

screen encyclopaedia_list_A(enc):
	...
screen encyclopaedia_entry_A(enc):
	...	

screen encyclopaedia_list_B(enc):
	...
screen encyclopaedia_entry_B(enc):
	...
The screens look like this:
codex2.jpg

They work alright once you're inside them, but I can't find how to switch between A and B in-game. Should I duplicate something inside enc.rpy as well?
Do I need to do something specific in order to fully create another encyclopaedia?
Human Bolt Diary wrote: Tue Jan 28, 2020 12:20 am If the entries change too, it sounds like you need two separate Encyclopaedas, each pointing to a different screen.

"encyclopaedia_entry" is just a default screen I've included. Any screen that takes an Encyclopaedia as an argument is valid.

If only the layout changes, you could probably override the entry_screen attribute with the name of another screen, then switch it back whenever you want.

Re: Encyclopaedia / Bestiary Framework

Posted: Fri Jan 31, 2020 11:47 pm
by Human Bolt Diary
Do you mean switching the screen used by one Encyclopaedia, or switching which Encyclopaedia you're using?

Switching the entry screen used by one Encyclopaedia can be done by changing the Encyclopaedia's entry_screen attribute.

Changing which encyclopaedia you're sending to the list screen depends entirely on you and how you call the Encyclopaedia.

munni wrote: Tue Jan 28, 2020 8:19 am In order to make a 'new' encyclopaedia, I duplicated the screens in encyclopaedia.rpy into something like this:

Code: Select all

screen encyclopaedia_list_A(enc):
	...
screen encyclopaedia_entry_A(enc):
	...	

screen encyclopaedia_list_B(enc):
	...
screen encyclopaedia_entry_B(enc):
	...
The screens look like this:

codex2.jpg


They work alright once you're inside them, but I can't find how to switch between A and B in-game. Should I duplicate something inside enc.rpy as well?
Do I need to do something specific in order to fully create another encyclopaedia?
Human Bolt Diary wrote: Tue Jan 28, 2020 12:20 am If the entries change too, it sounds like you need two separate Encyclopaedas, each pointing to a different screen.

"encyclopaedia_entry" is just a default screen I've included. Any screen that takes an Encyclopaedia as an argument is valid.

If only the layout changes, you could probably override the entry_screen attribute with the name of another screen, then switch it back whenever you want.

Re: Encyclopaedia / Bestiary Framework

Posted: Thu Feb 06, 2020 5:49 am
by munni
Human Bolt Diary wrote: Fri Jan 31, 2020 11:47 pm Do you mean switching the screen used by one Encyclopaedia, or switching which Encyclopaedia you're using?

Switching the entry screen used by one Encyclopaedia can be done by changing the Encyclopaedia's entry_screen attribute.

Changing which encyclopaedia you're sending to the list screen depends entirely on you and how you call the Encyclopaedia.
I would like to be able to switch, depending on what point the player is in the game, between Encyclopaedia A (green) and B (purple), so I guess not a screen, but an entire Encyclopaedia. For example in chapter 1, you get A, and then in chapter 2 you get B. This change should also reflect in the hyperlinks.

Enclyclopaedias A and B are each divided into 4 categories/tabs:
- 'enc_people', 'enc_places', 'enc_lore', 'enc_mysteries' for A
- 'enc_profile', 'enc_locations', 'enc_info' and 'enc_cases' for B

There are 2 ways to show call the Encyclopaedia:

Code: Select all

# METHOD 1 - QUICK MENU BUTTON
action ShowMenu("encyclopaedia_list", enc_people)
# shows 'enc_people' category by default

# METHOD 2 - HYPERLINK
{a=set_entry:enc_places->about_London}London{/a}
To setup the hyperlinks, I used what you posted a couple years ago:

Code: Select all

define config.hyperlink_handlers = {
    "set_entry": set_enc_entry_from_text_anchor,
}

init -1500 python:
    def set_enc_entry_from_text_anchor(value):
        p = value.split('->')
        enc = getattr(store, p[0])
        entry = getattr(store, p[1])

        renpy.show_screen("encyclopaedia_entry", _transient="False")
        enc.SetEntry(entry)()
Python is not my forte, so I'm not sure how to set it up to switch between an Encyclopaedia and another.

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Feb 17, 2020 12:00 pm
by Ayael
I do my game in french and english, so I translate everything but somehow, name seems to not translate themselves properly. It's the first time I have this issue...

Code: Select all

]name=_("Les elfes"),
It's suppose to work that way (it does for the text content).

The translation string, appears as it should, on the translation file :

Code: Select all

translate english strings:

    # game/encylopedie.rpy:178
    old "Les elfes"
    new "The elves"
But, the translation is simply not working for all the title (and the title only). Since it's specific to the name only, I think the problem come from the way it is done.

Edit :
I resolve the issue by doing

Code: Select all

  label enc.active.name xalign 0.5
instead of :

Code: Select all

label enc.active.label xalign 0.5 
The ID disapeared, and the translation worked. I couldn't find a way to have the full translation ID + name.

Re: Encyclopaedia / Bestiary Framework

Posted: Thu Sep 17, 2020 8:15 am
by AERenoir
So is there a way to paginate the list of entries instead of having a long list going down?
The glossary/encyclopaedia I'm trying to make is in the shape of a journal or dictionary and I kind of figured out how to imagemap the filter tags and the base, but I'm not sure how to input the entry buttons based on the format that already exist.

I'm thinking that I would like the entry buttons are themselves would be images/imagebuttons. I'm not sure how to even begin to do that. Something like this:

Image


I'd thought of just using a gallery that links to scene snippets instead, but I need the filter function.

Re: Encyclopaedia / Bestiary Framework

Posted: Wed Sep 23, 2020 5:12 pm
by Ayael
AERenoir wrote: Thu Sep 17, 2020 8:15 am So is there a way to paginate the list of entries instead of having a long list going down?
The glossary/encyclopaedia I'm trying to make is in the shape of a journal or dictionary and I kind of figured out how to imagemap the filter tags and the base, but I'm not sure how to input the entry buttons based on the format that already exist.

I'm thinking that I would like the entry buttons are themselves would be images/imagebuttons. I'm not sure how to even begin to do that. Something like this:

Image


I'd thought of just using a gallery that links to scene snippets instead, but I need the filter function.
Don't use imagemap but screen langage, you can do the same things but with more flexibility, (hint : if you are used to image map you can just put a background with a full image and then position transparent imagebutton of the right size at the place you want).
Anyway to answer your question, yes you can definitely custom it to the way you like it ! (Even if doing an auto pagination require a little more knowledge.)

I can't give you the full answer since it would be a bit too tedious for me, but I hope it will still help you to know where to look in order to achieve your goal !

Re: Encyclopaedia / Bestiary Framework

Posted: Tue Jan 12, 2021 11:44 pm
by DiamondDust132
Avalonica wrote: Mon Nov 04, 2019 8:04 pm Another thing that is very relevant is (at least from what I get when using the hyperlink) is that I do get the "about_dune" entry, but when I press ESC it opens the OPTIONS menu, so the only way to quit down the Encyclopaedia is: Close Entry > Return. It's too many steps. :oops:

When accessing the Encyclopaedia with ShowMenu("encyclopaedia_list", your_new_encyclopaedia ) an ESC is all that is needed to close it all down. Is there any way when "directly" calling a entry in the Encyclopaedia that we somehow when have "read" that entry we just can press ESC and return to the game.
Yeah, having this problem as well. No clue if this is still being worked on, but any help would be appreciated. I'm presuming (but I suck at python so maybe I'm totally off) the issue comes from 'showing' the screen instead of 'calling' it, so the game treats hitting ESC as if you're still on the dialogue screen and not in the encyclopaedia screen, so it just opens the save/options menu. Since middle clicking hides everything like when you're on the dialogue window, that seems to confirm it. Opening the glossary from the quick menu works as anticipated.

I'm using this code to get the hyperlinks working, so I'm thinking there's something there I gotta tinker with, but having no luck so far.

Code: Select all

define config.hyperlink_handlers = {
    "set_entry": set_enc_entry_from_text_anchor,
}

init -1500 python:
    def set_enc_entry_from_text_anchor(value):
        p = value.split('->')
        enc = getattr(store, p[0])
        entry = getattr(store, p[1])

        renpy.show_screen("encyclopaedia_entry", _transient="False")
        enc.SetEntry(entry)()
EDIT 1/20/21

Well, that's what I get for not reading the thread properly. Half of the answer to my question was there. Still haven't solved the 'right click opens the save menu' issue, but I've figured out the hyperlink issue. You just wanna edit the 'Close Entry' textbutton in encyclopaedia_screen.rpy like so:

Code: Select all

textbutton "Close Entry" id "close_entry_button" xalign .98 clicked [enc.Sort(sorting_mode=enc.default_sorting_mode),
                                                     Hide("encyclopaedia_list"),
                                                     Hide("encyclopaedia_entry", transition=dissolve),
                                                     enc.ResetSubPage(),]
              
 
So when the player clicks a hyperlink, now hitting 'Close Entry' will take you straight back to the dialogue window. That way, they don't have to hit 'Close Entry' and then 'Return.' One less step. I deleted the Return() part from the above code so that it doesn't skip the text ahead after closing the glossary, and I added a dissolve transition to make it look a little nicer. Again, I'm not great at python, so this might cause unintended effects, but I haven't noticed any so far.

Re: Encyclopaedia / Bestiary Framework

Posted: Wed Feb 10, 2021 12:20 am
by frankfrankstud
Hello everyone,

Has anyone figured out the way to fix the hyperlink issue where escape opens the save menu instead of closing the encyclopedia? It's also causing an issue where my quick menu doesn't hide. I guess it's an issue with showing the screen instead of calling it?

Re: Encyclopaedia / Bestiary Framework

Posted: Sat Mar 27, 2021 1:52 pm
by VolTitanDev
Hi I was having some trouble understanding where to place the Zeus entry example

about_zeus = EncEntry(
parent=your_new_glossary,
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."
],
viewed_persistent=True,
)
Would the new entries placed in the encycopedia_screeen file or the screen_renpy file?

Re: Encyclopaedia / Bestiary Framework

Posted: Sat Mar 27, 2021 2:46 pm
by Ayael
VolTitanDev wrote: Sat Mar 27, 2021 1:52 pm Hi I was having some trouble understanding where to place the Zeus entry example

about_zeus = EncEntry(
parent=your_new_glossary,
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."
],
viewed_persistent=True,
)
Would the new entries placed in the encycopedia_screeen file or the screen_renpy file?
Anywhere you want as long you don't put it inside something else, but you can put it into script.rpy too for example I personnaly created a new file just for all the entries.