Here is the code for reference since I don't really know what the error wanted me to do.
Code: Select all
screen gameUI:
imagebutton:
xalign 1.0
yalign 0.0
xoffset -10
yoffset 10
auto "UI/characterscreen_%s.png"
action ShowMenu("CharacterScreenUI")
screen CharacterScreenUI():
tag characterscreenUI
add "images/bg gradient.png"
hbox:
frame:
text "Characters"
style_prefix "characterscreen"
xpadding 20
ypadding 20
background "images/bg leftframe.png"
ysize 600
xsize 290
vbox:
xalign 0.5
yalign 0.5
textbutton _(shin.name):
action SetVariable("selectedCharacter", shin)
xpadding 80
xsize 640
textbutton _(jin.name):
action SetVariable("selectedCharacter", jin)
xpadding 80
xsize 640
textbutton _("Return"):
yalign 0.5
yoffset 275
xoffset 10
action Return ()
frame:
text "Character Sheet"
xpadding 20
ypadding 20
background "images/bg rightframe.png"
ysize 600
xsize 776
vbox:
xoffset 20
yoffset 40
text "Name: [selectedCharacter.name]"
text "Age: [selectedCharacter.age]"
text "Birthday: [selectedCharacter.birthday]"
text "Affection: [LoveInterest.affection]"
bar value LoveInterest.affection xsize 300 xoffset 80
style characterscreen_button_text:
xalign 0.5
label ShinCharacter:
"ShinCharacter"
label JinCharacter:
"JinCharacter"
init python:
class Player:
def __init__(self, name = "Shin", age = "18", birthday = "March 3rd"):
self.name = name
self.age = age
self.birthday = birthday
init python:
class LoveInterest:
def __init__(self, name = "Jin", age = "18", birthday = "April 5th", affection = 20):
self.name = name
self.age = age
self.birthday = birthday
self.affection = StaticValue(affection, 100)
default shin = Player(name = "Shin", age = "18", birthday = "March 3rd")
default jin = LoveInterest(name = "Jin", age = "18", birthday = "April 5th", affection = 20)
default selectedCharacter = shin
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "game/custom_screens.rpy", line 10, in execute
screen CharacterScreenUI():
File "game/custom_screens.rpy", line 10, in execute
screen CharacterScreenUI():
File "game/custom_screens.rpy", line 13, in execute
hbox:
File "game/custom_screens.rpy", line 40, in execute
frame:
File "game/custom_screens.rpy", line 47, in execute
vbox:
File "game/custom_screens.rpy", line 53, in execute
text "Affection: [LoveInterest.affection]"
AttributeError: type object 'LoveInterest' has no attribute 'affection'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "renpy/ast.py", line 922, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "renpy/python.py", line 2218, in py_exec_bytecode
exec(bytecode, globals, locals)
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "renpy/ui.py", line 298, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "renpy/display/core.py", line 3006, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
File "renpy/display/core.py", line 3417, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "renpy/display/core.py", line 566, in visit_all
d.visit_all(callback, seen)
File "renpy/display/core.py", line 566, in visit_all
d.visit_all(callback, seen)
File "renpy/display/core.py", line 566, in visit_all
d.visit_all(callback, seen)
File "renpy/display/core.py", line 566, in visit_all
d.visit_all(callback, seen)
File "renpy/display/screen.py", line 432, in visit_all
callback(self)
File "renpy/display/core.py", line 3417, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "renpy/display/screen.py", line 443, in per_interact
self.update()
File "renpy/display/screen.py", line 631, in update
self.screen.function(**self.scope)
File "game/custom_screens.rpy", line 10, in execute
screen CharacterScreenUI():
File "game/custom_screens.rpy", line 10, in execute
screen CharacterScreenUI():
File "game/custom_screens.rpy", line 13, in execute
hbox:
File "game/custom_screens.rpy", line 40, in execute
frame:
File "game/custom_screens.rpy", line 47, in execute
vbox:
File "game/custom_screens.rpy", line 53, in execute
text "Affection: [LoveInterest.affection]"
File "renpy/text/text.py", line 1620, in _scope
return self.set_text(self.text_parameter, scope, self.substitute, update)
File "renpy/text/text.py", line 1644, in set_text
i, did_sub = renpy.substitutions.substitute(i, scope, substitute)
File "renpy/substitutions.py", line 270, in substitute
s = formatter.vformat(s, (), kwargs)
File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/string.py", line 563, in vformat
File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/string.py", line 585, in _vformat
File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/string.py", line 652, in get_field
AttributeError: type object 'LoveInterest' has no attribute 'affection'
Windows-7-6.1.7601-SP1
Ren'Py 7.4.1.1270
Summer Love 1.0
Mon Jul 26 00:40:37 2021