First, I have a quick menu that is an imagemap which I've coded and works fine. The map is a stack of four buttons from top to bottom: skip, save, load, and preferences.
Both this menu and the player name work correctly when loading a past save or starting a new game.
Today I implemented a "chapter menu" that allows players to jump back to past scenes they have already read in the script. However, my quick_menu is broken when I select a past chapter. Weirdly, only the top two buttons (skip and save) are broken - the game doesn't recognize that they are buttons at all. I messed around a bit and got skip to work sometimes - but it jumped automatically to the furthest place a character is in the route rather than quickly running through all the dialogue.
I am also getting the KeyError u 'player_name" message when I come to a piece of script that is spoken by the player character.
Here is the traceback for the error:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 9473, in script
pov "Um… What is this place?"
KeyError: u'player_name'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 9473, in script
pov "Um… What is this place?"
File "/Users/sabrinaboone/Desktop/renpy-6.99.12.4-sdk/renpy/ast.py", line 624, in execute
renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
File "/Users/sabrinaboone/Desktop/renpy-6.99.12.4-sdk/renpy/exports.py", line 1173, in say
who(what, *args, **kwargs)
File "/Users/sabrinaboone/Desktop/renpy-6.99.12.4-sdk/renpy/character.py", line 889, in __call__
who = who_pattern.replace("[who]", sub(who))
File "/Users/sabrinaboone/Desktop/renpy-6.99.12.4-sdk/renpy/character.py", line 884, in sub
return renpy.substitutions.substitute(s, scope=scope, force=force, translate=translate)[0]
File "/Users/sabrinaboone/Desktop/renpy-6.99.12.4-sdk/renpy/substitutions.py", line 242, in substitute
s = formatter.vformat(s, (), kwargs)
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 563, in vformat
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 585, in _vformat
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 646, in get_field
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 605, in get_value
KeyError: u'player_name'
Code: Select all
"Please input your name."
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if not player_name:
$ player_name="Dante"
Please help! I'm really not sure what is happening. And, of course, I can copy more lines of code if necessary. Thank you!