Page 6 of 8

Re: Encyclopaedia / Bestiary Framework

Posted: Fri Nov 01, 2019 2:37 pm
by XxrenxX
Thanks for the update. I am still however having the problem of "Enc has no value"

To illiterate I don't need most of the text as I just want a simple list with buttons to read extra text for shit in the game. Like the notes section of a cellphone. If I could find anything else I'd use it but it's been months and no one has been able to give a proper answer to this issue.

I don't want to sort the list in any way, just one list in the way I set it up or if anything newest unlock at the top. And I trying to use global not local.

Re: Encyclopaedia / Bestiary Framework

Posted: Fri Nov 01, 2019 2:41 pm
by Ayael
XxrenxX wrote: Fri Nov 01, 2019 2:37 pm Thanks for the update. I am still however having the problem of "Enc has no value"

To illiterate I don't need most of the text as I just want a simple list with buttons to read extra text for shit in the game. Like the notes section of a cellphone. If I could find anything else I'd use it but it's been months and no one has been able to give a proper answer to this issue.
You just have to put the name of the encyclopedia you create :

Code: Select all

textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia )
For example I create an encyclopedia named "lore", with en entry named "animals", so in my game menu I have this button :

So I have :

Code: Select all

textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", lore )
without quotemark it's important :p

If you have further question, just look on the previous page, I made a post with some tips :p

Re: Encyclopaedia / Bestiary Framework

Posted: Fri Nov 01, 2019 2:44 pm
by XxrenxX
Ayael wrote: Fri Nov 01, 2019 2:41 pm
XxrenxX wrote: Fri Nov 01, 2019 2:37 pm Thanks for the update. I am still however having the problem of "Enc has no value"

To illiterate I don't need most of the text as I just want a simple list with buttons to read extra text for shit in the game. Like the notes section of a cellphone. If I could find anything else I'd use it but it's been months and no one has been able to give a proper answer to this issue.
You just have to put the name of the encyclopedia you create :

Code: Select all

textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia )
For example I create an encyclopedia named "lore", with en entry named "animals", so in my game menu I have this button :

So I have :

Code: Select all

textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", lore )
without quotemark it's important :p

If you have further question, just look on the previous page, I made a post with some tips :p
I've tried this numerous ways since seeing your comment and it has not fixed anything. The problem persists.

Re: Encyclopaedia / Bestiary Framework

Posted: Fri Nov 01, 2019 2:47 pm
by Ayael
XxrenxX wrote: Fri Nov 01, 2019 2:44 pm
Ayael wrote: Fri Nov 01, 2019 2:41 pm
XxrenxX wrote: Fri Nov 01, 2019 2:37 pm Thanks for the update. I am still however having the problem of "Enc has no value"

To illiterate I don't need most of the text as I just want a simple list with buttons to read extra text for shit in the game. Like the notes section of a cellphone. If I could find anything else I'd use it but it's been months and no one has been able to give a proper answer to this issue.
You just have to put the name of the encyclopedia you create :

Code: Select all

textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia )
For example I create an encyclopedia named "lore", with en entry named "animals", so in my game menu I have this button :

So I have :

Code: Select all

textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", lore )
without quotemark it's important :p

If you have further question, just look on the previous page, I made a post with some tips :p
I've tried this numerous ways since seeing your comment and it has not fixed anything. The problem persists.
Hmm, that weird, it solved this error for me, and for someone else who had the same issue.

Maybe, if you want something simpler, take a look at this tutorial, done by Tom. It's simpler so it might fit your need better.
Btw, it's an old post from his patreon so available for everyone now, but consider support him on it if you liked it :p

Re: Encyclopaedia / Bestiary Framework

Posted: Sat Nov 02, 2019 9:31 am
by Human Bolt Diary
Ayael wrote: Mon Oct 21, 2019 6:52 am
Human Bolt Diary wrote: Sun Sep 29, 2019 9:45 pm I've released version 2.3. The Encyclopaedia now takes the optional argument `tint_locked_image`. If set to False, EncEntries without a specified locked_image will not use a tinted version of the image, instead just using the image.

This is mainly for times when a Displayable is used for the image and no locked_image is provided. Image Manipulators can't handle Displayables, so the tinting attempt would cause a crash. When/If Transforms support color manipulation, I'll switch over to that completely.
Wow, I didn't expect this to be updated anymore ! First of all, Human Bolt Diary, let me thank you a lot for your huge work on this framework, it's amazing ! Truly it goes beyond my dreams !

Second, I was wandering why I don't have the "new!" displaying when I have a new sub_entry unlocking ! I did some modification on the screens so I probably broke something, but I can't find which part of the screen code is handling this >.<

Also, on your documentation, you don't explain how we can declare image we want to use inside the entry, even so there is on the code two screen, one without, and one for the entry with images so I guess it's possible ?
1. Unlocking sub-entries won't refresh the parent's viewed status. I don't think it'll be too difficult to add this as an option. Until then, you can manually reset the parent's viewed status like so:

Code: Select all

$ my_sub_entry.locked = False
$ my_parent_entry.viewed = False
2.
It's in the module index, bit I could probably add a specific section: https://renpy-encyclopaedia.readthedocs ... entry.html

Code: Select all

EncEntry(name='Foo', text='Bar', image='img.png')

Re: Encyclopaedia / Bestiary Framework

Posted: Sat Nov 02, 2019 9:42 am
by Human Bolt Diary
XxrenxX wrote: Fri Nov 01, 2019 2:37 pm Thanks for the update. I am still however having the problem of "Enc has no value"

To illiterate I don't need most of the text as I just want a simple list with buttons to read extra text for shit in the game. Like the notes section of a cellphone. If I could find anything else I'd use it but it's been months and no one has been able to give a proper answer to this issue.

I don't want to sort the list in any way, just one list in the way I set it up or if anything newest unlock at the top. And I trying to use global not local.
I took a look at the file you provided. Your error is "entry has no value" not "enc has no value". The issue is on this line:

Code: Select all

screen encyclopaedia_list(enc, entry): #List of encyclopaedia
it should be:

Code: Select all

screen encyclopaedia_list(enc): #List of encyclopaedia

Re: Encyclopaedia / Bestiary Framework

Posted: Sat Nov 02, 2019 10:46 am
by Ayael
Human Bolt Diary wrote: Sat Nov 02, 2019 9:31 am
Ayael wrote: Mon Oct 21, 2019 6:52 am
Human Bolt Diary wrote: Sun Sep 29, 2019 9:45 pm I've released version 2.3. The Encyclopaedia now takes the optional argument `tint_locked_image`. If set to False, EncEntries without a specified locked_image will not use a tinted version of the image, instead just using the image.

This is mainly for times when a Displayable is used for the image and no locked_image is provided. Image Manipulators can't handle Displayables, so the tinting attempt would cause a crash. When/If Transforms support color manipulation, I'll switch over to that completely.
Wow, I didn't expect this to be updated anymore ! First of all, Human Bolt Diary, let me thank you a lot for your huge work on this framework, it's amazing ! Truly it goes beyond my dreams !

Second, I was wandering why I don't have the "new!" displaying when I have a new sub_entry unlocking ! I did some modification on the screens so I probably broke something, but I can't find which part of the screen code is handling this >.<

Also, on your documentation, you don't explain how we can declare image we want to use inside the entry, even so there is on the code two screen, one without, and one for the entry with images so I guess it's possible ?
1. Unlocking sub-entries won't refresh the parent's viewed status. I don't think it'll be too difficult to add this as an option. Until then, you can manually reset the parent's viewed status like so:

Code: Select all

$ my_sub_entry.locked = False
$ my_parent_entry.viewed = False
2.
It's in the module index, bit I could probably add a specific section: https://renpy-encyclopaedia.readthedocs ... entry.html

Code: Select all

EncEntry(name='Foo', text='Bar', image='img.png')
I see, I was so focused on the idea I broked something, I missed the idea. So I just have to add the line to before the line I unlock the entry in my script and it will be done ! Thank you a lot for this amazing feature, and the help !

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Nov 04, 2019 8:04 pm
by Avalonica
Hello and thanks for this wonderful Encyclopaedia

I might have missed it, but is there any way from an: action ShowMenu("encyclopaedia_list", your_new_encyclopaedia ) possible to get a direct link instead to one of your entries in the Encyclopaedia, lets say: about_dune

It works perfect in the {a=set_entry:your_new_encyclopaedia->about_dune} hyperlink system, but nothing works from the above example.

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.

Re: Encyclopaedia / Bestiary Framework

Posted: Sun Nov 24, 2019 8:06 pm
by TorroesPrime
Still pretty new to programming in general, and Ren.py in particular. So hopefully this is a stupidly simple question. I'm having the same problem that XxrenxX described.

I created an encyclopedia:
in script.rpy

Code: Select all

    python:
        exoPedia = Encyclopaedia()
And then I created an entry again in script.rpy:

Code: Select all

about_jtmarsh = EncEntry(
        name = "J.T. Marsh",
        text =[
            "Marsh never wanted to be a soldier or leader, he simply craved the feeling of freedom that flying granted him. To satisfy that thrill seeking desire,",
            "he joined the Exo-fleet and quickly became an E-frame pilot and later an officer. J.T. Marsh is a natural-born rebel and hero. From the moment he ",
            "learned that the Neosapiens had conquered Earth and the other Mankind \"Homeworlds\" of Mars and Venus, he knew he had to do something to help his ",
            "fellow humans. In Exosquad he is not only leading the fight to free mankind, he is also giving hope to all those suffering under the brutal rule ",
            "Neosapiens rule. "],
        viewed_persistent = True)

then I added a button to access the encyclopedia in screens.rpy:

Code: Select all

        imagebutton:
            idle "gui/button/button-Encyclopedia.png"
            hover "gui/button/button-Encyclopedia_hover.png"
            action ShowMenu("encyclopaedia_list","exoPedia")
The game launches properly, but when I click on "Encyclopedia" I get the following error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 94, in execute
    window:
  File "game/encyclopaedia_screens.rpy", line 97, in execute
    vbox:
  File "game/encyclopaedia_screens.rpy", line 106, in execute
    frame:
  File "game/encyclopaedia_screens.rpy", line 110, in execute
    hbox:
  File "game/encyclopaedia_screens.rpy", line 113, in execute
    text "{} Complete".format(enc.labels.percentage_unlocked)
AttributeError: 'unicode' object has no attribute 'labels'

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

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\ast.py", line 914, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\python.py", line 2028, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\ui.py", line 297, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 2702, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 3094, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\screen.py", line 430, in visit_all
    callback(self)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 3094, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\screen.py", line 440, in per_interact
    self.update()
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\screen.py", line 625, in update
    self.screen.function(**self.scope)
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 94, in execute
    window:
  File "game/encyclopaedia_screens.rpy", line 97, in execute
    vbox:
  File "game/encyclopaedia_screens.rpy", line 106, in execute
    frame:
  File "game/encyclopaedia_screens.rpy", line 110, in execute
    hbox:
  File "game/encyclopaedia_screens.rpy", line 113, in execute
    text "{} Complete".format(enc.labels.percentage_unlocked)
  File "<screen language>", line 113, in <module>
AttributeError: 'unicode' object has no attribute 'labels'

Windows-8-6.2.9200
Ren'Py 7.3.5.606
ExoSquad: Marsala's Betrayal 0.01
Sun Nov 24 19:02:17 2019

I saw it mentioned that the problem was in the screen encyclopaedia_list. I mean here is the code for the screen. It's right from the download and unmodified.

Code: Select all

screen encyclopaedia_list(enc):
    tag menu
    modal True

    window:
        style_prefix "encyclopaedia"

        vbox:
            spacing 10

            frame:
                style_prefix "encyclopaedia"
                xfill True

                text "Welcome to the Demo Encyclopaedia"

            frame:
                style_prefix "encyclopaedia"
                xfill True

                hbox:
                    xfill True
                    # Percentage unlocked display
                    text "{} Complete".format(enc.labels.percentage_unlocked)

            frame:
                style_prefix "encyclopaedia"
                xfill True

                vbox:
                    text "Filters"
                    hbox:
                        xfill True
                        # Buttons to filter the entries that are displayed
                        textbutton "All" action enc.ClearFilter() style "encyclopaedia_button"
                        for subject in enc.subjects:
                            textbutton subject action enc.FilterBySubject(subject) style "encyclopaedia_button"

            hbox:
                frame:
                    style_prefix "encyclopaedia"
                    yfill True
                    xmaximum 600
                    bottom_margin 10

                    viewport:
                        scrollbars "vertical"
                        mousewheel True
                        draggable True
                        vbox:
                            # Flavour text to display the current sorting mode.
                            text enc.labels.sorting_mode xalign 0.5

                            use vertical_list(enc) id "vertical list"

                frame:
                    style_prefix "encyclopaedia"
                    xfill True
                    bottom_margin 10
                    yalign 0.95

                    vbox:
                        # Buttons to sort entries.
                        textbutton "Sort by {}".format(enc.labels.sort_number_label) action enc.Sort(sorting_mode=enc.SORT_NUMBER) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_alphabetical_label) action enc.Sort(sorting_mode=enc.SORT_ALPHABETICAL) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_reverse_alphabetical_label) action enc.Sort(sorting_mode=enc.SORT_REVERSE_ALPHABETICAL) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_subject_label) action enc.Sort(sorting_mode=enc.SORT_SUBJECT) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_unread_label) action enc.Sort(sorting_mode=enc.SORT_UNREAD) xfill True

                        # Buttons to show different styles of hiding locked data.
                        textbutton "Show/Hide Locked Buttons" action enc.ToggleShowLockedButtons() xfill True
                        textbutton "Show/Hide Locked Entry" action enc.ToggleShowLockedEntry() xfill True

                        textbutton "Return"  action [Hide("encyclopaedia_list"), Return()] xfill True

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Nov 25, 2019 12:29 am
by Human Bolt Diary
Your error is:

Code: Select all

    text "{} Complete".format(enc.labels.percentage_unlocked)
AttributeError: 'unicode' object has no attribute 'labels'
This is telling you that the value you provided to `enc` is text, when it should be an Encyclopaedia.

Code: Select all

imagebutton:
            idle "gui/button/button-Encyclopedia.png"
            hover "gui/button/button-Encyclopedia_hover.png"
            action ShowMenu("encyclopaedia_list","exoPedia")
You're sending the string "exoPedia" over, not the Encyclopaedia instance you created.
TorroesPrime wrote: Sun Nov 24, 2019 8:06 pm Still pretty new to programming in general, and Ren.py in particular. So hopefully this is a stupidly simple question. I'm having the same problem that XxrenxX described.

I created an encyclopedia:
in script.rpy

Code: Select all

    python:
        exoPedia = Encyclopaedia()
And then I created an entry again in script.rpy:

Code: Select all

about_jtmarsh = EncEntry(
        name = "J.T. Marsh",
        text =[
            "Marsh never wanted to be a soldier or leader, he simply craved the feeling of freedom that flying granted him. To satisfy that thrill seeking desire,",
            "he joined the Exo-fleet and quickly became an E-frame pilot and later an officer. J.T. Marsh is a natural-born rebel and hero. From the moment he ",
            "learned that the Neosapiens had conquered Earth and the other Mankind \"Homeworlds\" of Mars and Venus, he knew he had to do something to help his ",
            "fellow humans. In Exosquad he is not only leading the fight to free mankind, he is also giving hope to all those suffering under the brutal rule ",
            "Neosapiens rule. "],
        viewed_persistent = True)

then I added a button to access the encyclopedia in screens.rpy:

Code: Select all

        imagebutton:
            idle "gui/button/button-Encyclopedia.png"
            hover "gui/button/button-Encyclopedia_hover.png"
            action ShowMenu("encyclopaedia_list","exoPedia")
The game launches properly, but when I click on "Encyclopedia" I get the following error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 94, in execute
    window:
  File "game/encyclopaedia_screens.rpy", line 97, in execute
    vbox:
  File "game/encyclopaedia_screens.rpy", line 106, in execute
    frame:
  File "game/encyclopaedia_screens.rpy", line 110, in execute
    hbox:
  File "game/encyclopaedia_screens.rpy", line 113, in execute
    text "{} Complete".format(enc.labels.percentage_unlocked)
AttributeError: 'unicode' object has no attribute 'labels'

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

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\ast.py", line 914, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\python.py", line 2028, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\ui.py", line 297, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 2702, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 3094, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\screen.py", line 430, in visit_all
    callback(self)
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\core.py", line 3094, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\screen.py", line 440, in per_interact
    self.update()
  File "E:\User Library\Michael\OneDrive\programs\Ren.Py\renpy\display\screen.py", line 625, in update
    self.screen.function(**self.scope)
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 90, in execute
    screen encyclopaedia_list(enc):
  File "game/encyclopaedia_screens.rpy", line 94, in execute
    window:
  File "game/encyclopaedia_screens.rpy", line 97, in execute
    vbox:
  File "game/encyclopaedia_screens.rpy", line 106, in execute
    frame:
  File "game/encyclopaedia_screens.rpy", line 110, in execute
    hbox:
  File "game/encyclopaedia_screens.rpy", line 113, in execute
    text "{} Complete".format(enc.labels.percentage_unlocked)
  File "<screen language>", line 113, in <module>
AttributeError: 'unicode' object has no attribute 'labels'

Windows-8-6.2.9200
Ren'Py 7.3.5.606
ExoSquad: Marsala's Betrayal 0.01
Sun Nov 24 19:02:17 2019

I saw it mentioned that the problem was in the screen encyclopaedia_list. I mean here is the code for the screen. It's right from the download and unmodified.

Code: Select all

screen encyclopaedia_list(enc):
    tag menu
    modal True

    window:
        style_prefix "encyclopaedia"

        vbox:
            spacing 10

            frame:
                style_prefix "encyclopaedia"
                xfill True

                text "Welcome to the Demo Encyclopaedia"

            frame:
                style_prefix "encyclopaedia"
                xfill True

                hbox:
                    xfill True
                    # Percentage unlocked display
                    text "{} Complete".format(enc.labels.percentage_unlocked)

            frame:
                style_prefix "encyclopaedia"
                xfill True

                vbox:
                    text "Filters"
                    hbox:
                        xfill True
                        # Buttons to filter the entries that are displayed
                        textbutton "All" action enc.ClearFilter() style "encyclopaedia_button"
                        for subject in enc.subjects:
                            textbutton subject action enc.FilterBySubject(subject) style "encyclopaedia_button"

            hbox:
                frame:
                    style_prefix "encyclopaedia"
                    yfill True
                    xmaximum 600
                    bottom_margin 10

                    viewport:
                        scrollbars "vertical"
                        mousewheel True
                        draggable True
                        vbox:
                            # Flavour text to display the current sorting mode.
                            text enc.labels.sorting_mode xalign 0.5

                            use vertical_list(enc) id "vertical list"

                frame:
                    style_prefix "encyclopaedia"
                    xfill True
                    bottom_margin 10
                    yalign 0.95

                    vbox:
                        # Buttons to sort entries.
                        textbutton "Sort by {}".format(enc.labels.sort_number_label) action enc.Sort(sorting_mode=enc.SORT_NUMBER) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_alphabetical_label) action enc.Sort(sorting_mode=enc.SORT_ALPHABETICAL) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_reverse_alphabetical_label) action enc.Sort(sorting_mode=enc.SORT_REVERSE_ALPHABETICAL) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_subject_label) action enc.Sort(sorting_mode=enc.SORT_SUBJECT) xfill True
                        textbutton "Sort by {}".format(enc.labels.sort_unread_label) action enc.Sort(sorting_mode=enc.SORT_UNREAD) xfill True

                        # Buttons to show different styles of hiding locked data.
                        textbutton "Show/Hide Locked Buttons" action enc.ToggleShowLockedButtons() xfill True
                        textbutton "Show/Hide Locked Entry" action enc.ToggleShowLockedEntry() xfill True

                        textbutton "Return"  action [Hide("encyclopaedia_list"), Return()] xfill True

Re: Encyclopaedia / Bestiary Framework

Posted: Mon Nov 25, 2019 11:59 am
by TorroesPrime
Okay, I think I know what you're saying. So I did the following:

This is from screens.rpy

Code: Select all

imagebutton:
            idle "gui/button/button-Encyclopedia.png"
            hover "gui/button/button-Encyclopedia_hover.png"
            action ShowMenu("encyclopaedia_list",exoPedia)
while this is from encyclopaedia_screens.ryp

Code: Select all

            frame:
                style_prefix "encyclopaedia"
                xfill True

                hbox:
                    xfill True
                    # Percentage unlocked display
                    text "{} Complete".format(enc.labels.percentage_unlocked)
and now I'm getting an error saying exoPedia is not defined.

I have exoPedia defined in script.rpy. would it be better to define it in a different file?

Code: Select all

    python:
        exoPedia = Encyclopaedia()
        about_jtmarsh = EncEntry(
        name = "J.T. Marsh",
        text =[
            "Marsh never wanted to be a soldier or leader, he simply craved the feeling of freedom that flying granted him. To satisfy that thrill seeking desire,",
            "he joined the Exo-fleet and quickly became an E-frame pilot and later an officer. J.T. Marsh is a natural-born rebel and hero. From the moment he ",
            "learned that the Neosapiens had conquered Earth and the other Mankind \"Homeworlds\" of Mars and Venus, he knew he had to do something to help his ",
            "fellow humans. In Exosquad he is not only leading the fight to free mankind, he is also giving hope to all those suffering under the brutal rule ",
            "Neosapiens rule. "],
        viewed_persistent = True)
        
Human Bolt Diary wrote: Mon Nov 25, 2019 12:29 am Your error is:

Code: Select all

    text "{} Complete".format(enc.labels.percentage_unlocked)
AttributeError: 'unicode' object has no attribute 'labels'
This is telling you that the value you provided to `enc` is text, when it should be an Encyclopaedia.

Code: Select all

imagebutton:
            idle "gui/button/button-Encyclopedia.png"
            hover "gui/button/button-Encyclopedia_hover.png"
            action ShowMenu("encyclopaedia_list","exoPedia")
You're sending the string "exoPedia" over, not the Encyclopaedia instance you created.

Re: Encyclopaedia / Bestiary Framework

Posted: Wed Nov 27, 2019 11:04 pm
by TorroesPrime
So been hammering away and reading and asking questions trying to learn both Ren.py and the encyclopaedia system. And I've made some progress.

I now have the following in script.py where I am creating the encyclopaedia and an entry.

Code: Select all

    init -10 python:
        exoPedia = Encyclopaedia()
        about_jtmarsh = EncEntry(
        name = "J.T. Marsh",
        text =[
            "Marsh never wanted to be a soldier or leader, he simply craved the feeling of freedom that flying granted him. To satisfy that thrill seeking desire,",
            "he joined the Exo-fleet and quickly became an E-frame pilot and later an officer. J.T. Marsh is a natural-born rebel and hero. From the moment he ",
            "learned that the Neosapiens had conquered Earth and the other Mankind \"Homeworlds\" of Mars and Venus, he knew he had to do something to help his ",
            "fellow humans. In Exosquad he is not only leading the fight to free mankind, he is also giving hope to all those suffering under the brutal rule ",
            "Neosapiens rule. "],
        viewed_persistent = True,
        )
Calling it from screens.rpy with:

Code: Select all

        imagebutton:
            idle "gui/button/button-Encyclopedia.png"
            hover "gui/button/button-Encyclopedia_hover.png"
            action ShowMenu("encyclopaedia_list",exoPedia)

and made sure the python call initializes before the script in enc.rpy

Code: Select all

init -50 python:
    from math import floor
    import operator
    from operator import attrgetter
and now I'm getting this error:

Code: Select all

While running game code:
  File "game/script.rpy", line 9, in script
    init -10 python:
  File "game/script.rpy", line 19, in <module>
    viewed_persistent = True,
  File "game/enc.rpy", line 343, in __init__
    self.tint_locked_image = parent.tint_locked_image
AttributeError: 'NoneType' object has no attribute 'tint_locked_image'

Re: Encyclopaedia / Bestiary Framework

Posted: Wed Nov 27, 2019 11:59 pm
by Human Bolt Diary
Your EncEntry doesn't have a parent Encyclopaedia set.

EncEntry allows a null value for parent, but will then crash. I'll make parent a required argument in the future, since I can't think of a reason you'd want an EncEntry not associated to an Encyclopaedia.

Re: Encyclopaedia / Bestiary Framework

Posted: Sun Dec 01, 2019 9:42 pm
by TorroesPrime
Human Bolt Diary wrote: Wed Nov 27, 2019 11:59 pm Your EncEntry doesn't have a parent Encyclopaedia set.

EncEntry allows a null value for parent, but will then crash. I'll make parent a required argument in the future, since I can't think of a reason you'd want an EncEntry not associated to an Encyclopaedia.
*face palm* Thanks.

Re: Encyclopaedia / Bestiary Framework

Posted: Tue Jan 14, 2020 11:01 am
by Ayael
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).