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