Encyclopaedia / Bestiary Framework
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.
- XxrenxX
- Veteran
- Posts: 267
- Joined: Tue Oct 02, 2012 2:40 am
- Projects: Chasing
- Deviantart: bara-ettie
- Location: Canada
- Contact:
Re: Encyclopaedia / Bestiary Framework
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.
- Attachments
-
- encyclopaedia.rpy
- (6.94 KiB) Downloaded 76 times
-
- Regular
- Posts: 82
- Joined: Fri Apr 07, 2017 2:17 pm
- Projects: Imperial Grace (on going), Autumn Spirit, Ballads at Midnight
- Contact:
Re: Encyclopaedia / Bestiary Framework
You just have to put the name of the encyclopedia you create :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.
Code: Select all
textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia )
So I have :
Code: Select all
textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", lore )
If you have further question, just look on the previous page, I made a post with some tips :p
- XxrenxX
- Veteran
- Posts: 267
- Joined: Tue Oct 02, 2012 2:40 am
- Projects: Chasing
- Deviantart: bara-ettie
- Location: Canada
- Contact:
Re: Encyclopaedia / Bestiary Framework
I've tried this numerous ways since seeing your comment and it has not fixed anything. The problem persists.Ayael wrote: ↑Fri Nov 01, 2019 2:41 pmYou just have to put the name of the encyclopedia you create :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.For example I create an encyclopedia named "lore", with en entry named "animals", so in my game menu I have this button :Code: Select all
textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia )
So I have :without quotemark it's important :pCode: Select all
textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", lore )
If you have further question, just look on the previous page, I made a post with some tips :p
-
- Regular
- Posts: 82
- Joined: Fri Apr 07, 2017 2:17 pm
- Projects: Imperial Grace (on going), Autumn Spirit, Ballads at Midnight
- Contact:
Re: Encyclopaedia / Bestiary Framework
Hmm, that weird, it solved this error for me, and for someone else who had the same issue.XxrenxX wrote: ↑Fri Nov 01, 2019 2:44 pmI've tried this numerous ways since seeing your comment and it has not fixed anything. The problem persists.Ayael wrote: ↑Fri Nov 01, 2019 2:41 pmYou just have to put the name of the encyclopedia you create :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.For example I create an encyclopedia named "lore", with en entry named "animals", so in my game menu I have this button :Code: Select all
textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", your_new_encyclopaedia )
So I have :without quotemark it's important :pCode: Select all
textbutton _("Encyclopédie") action ShowMenu("encyclopaedia_list", lore )
If you have further question, just look on the previous page, I made a post with some tips :p
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
-
- Regular
- Posts: 111
- Joined: Fri Oct 11, 2013 12:46 am
- Contact:
Re: Encyclopaedia / Bestiary Framework
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:Ayael wrote: ↑Mon Oct 21, 2019 6:52 amWow, 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 !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.
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 ?
Code: Select all
$ my_sub_entry.locked = False
$ my_parent_entry.viewed = False
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')
-
- Regular
- Posts: 111
- Joined: Fri Oct 11, 2013 12:46 am
- Contact:
Re: Encyclopaedia / Bestiary Framework
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: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.
Code: Select all
screen encyclopaedia_list(enc, entry): #List of encyclopaedia
Code: Select all
screen encyclopaedia_list(enc): #List of encyclopaedia
-
- Regular
- Posts: 82
- Joined: Fri Apr 07, 2017 2:17 pm
- Projects: Imperial Grace (on going), Autumn Spirit, Ballads at Midnight
- Contact:
Re: Encyclopaedia / Bestiary Framework
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 !Human Bolt Diary wrote: ↑Sat Nov 02, 2019 9:31 am1. 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:Ayael wrote: ↑Mon Oct 21, 2019 6:52 amWow, 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 !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.
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 ?
2.Code: Select all
$ my_sub_entry.locked = False $ my_parent_entry.viewed = False
It's in the module index, bit I could probably add a specific section: https://renpy-encyclopaedia.readthedocs ... entry.htmlCode: Select all
EncEntry(name='Foo', text='Bar', image='img.png')
Re: Encyclopaedia / Bestiary Framework
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.
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.
-
- Newbie
- Posts: 14
- Joined: Fri Mar 30, 2018 6:12 pm
- Contact:
Re: Encyclopaedia / Bestiary Framework
I created an encyclopedia:
in script.rpy
Code: Select all
python:
exoPedia = Encyclopaedia()
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")
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
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
-
- Regular
- Posts: 111
- Joined: Fri Oct 11, 2013 12:46 am
- Contact:
Re: Encyclopaedia / Bestiary Framework
Code: Select all
text "{} Complete".format(enc.labels.percentage_unlocked)
AttributeError: 'unicode' object has no attribute 'labels'
Code: Select all
imagebutton:
idle "gui/button/button-Encyclopedia.png"
hover "gui/button/button-Encyclopedia_hover.png"
action ShowMenu("encyclopaedia_list","exoPedia")
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.rpyAnd then I created an entry again in script.rpy:Code: Select all
python: exoPedia = Encyclopaedia()
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:The game launches properly, but when I click on "Encyclopedia" I get the following error:Code: Select all
imagebutton: idle "gui/button/button-Encyclopedia.png" hover "gui/button/button-Encyclopedia_hover.png" action ShowMenu("encyclopaedia_list","exoPedia")
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
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
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
-
- Newbie
- Posts: 14
- Joined: Fri Mar 30, 2018 6:12 pm
- Contact:
Re: Encyclopaedia / Bestiary Framework
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)
Code: Select all
frame:
style_prefix "encyclopaedia"
xfill True
hbox:
xfill True
# Percentage unlocked display
text "{} Complete".format(enc.labels.percentage_unlocked)
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:
This is telling you that the value you provided to `enc` is text, when it should be an Encyclopaedia.Code: Select all
text "{} Complete".format(enc.labels.percentage_unlocked) AttributeError: 'unicode' object has no attribute 'labels'
You're sending the string "exoPedia" over, not the Encyclopaedia instance you created.Code: Select all
imagebutton: idle "gui/button/button-Encyclopedia.png" hover "gui/button/button-Encyclopedia_hover.png" action ShowMenu("encyclopaedia_list","exoPedia")
-
- Newbie
- Posts: 14
- Joined: Fri Mar 30, 2018 6:12 pm
- Contact:
Re: Encyclopaedia / Bestiary Framework
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,
)
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
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'
-
- Regular
- Posts: 111
- Joined: Fri Oct 11, 2013 12:46 am
- Contact:
Re: Encyclopaedia / Bestiary Framework
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.
-
- Newbie
- Posts: 14
- Joined: Fri Mar 30, 2018 6:12 pm
- Contact:
Re: Encyclopaedia / Bestiary Framework
*face palm* Thanks.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.
-
- Regular
- Posts: 82
- Joined: Fri Apr 07, 2017 2:17 pm
- Projects: Imperial Grace (on going), Autumn Spirit, Ballads at Midnight
- Contact:
Re: Encyclopaedia / Bestiary Framework
For example :
Code: Select all
jupiter = EncEntry(
parent=perso,
name="Jupiter, god of thunder",
text=[_(""" Text here""")],
viewed_persistent=True,
)
Code: Select all
entry.name
(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"
Who is online
Users browsing this forum: Andredron