Code: Select all
$ s = "test"
$ narrator("This is a [s].")Code: Select all
init -10 python:
sNoSuchCheatS = "The cheat code \"[s]\" is invalid!"
...
label start:
call initializeGameCheats
...
label initializeGameCheats:
python:
def encrypt(s, first = True, two = False) ...
def decrypt(s, first = True, two = False) ...
def encryptPairs(chars) ...
def decryptPairs(s) ...
def usePairCheats(s):
global sNoSuchCheatS
if not (isinstance(s, str) or isinstance(s, unicode)):
raise TypeError("s must be a string!")
try:
tempList = decryptPairs(s)
except ValueError:
narrator(s)
narrator(sNoSuchCheatS)
...
returnCode: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/navigation.rpy", line 184, in script
$ cheat()
File "game/navigation.rpy", line 184, in <module>
$ cheat()
File "game/gameCheats.rpy", line 320, in cheat
usePairCheats(s)
File "game/gameCheats.rpy", line 178, in usePairCheats
narrator(sNoSuchCheatS)
KeyError: 's'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/navigation.rpy", line 184, in script
$ cheat()
File "/run/media/nait/nanika/mobile_programs/renpy-6.15.7-sdk/renpy/ast.py", line 756, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "/run/media/nait/nanika/mobile_programs/renpy-6.15.7-sdk/renpy/python.py", line 1382, in py_exec_bytecode
exec bytecode in globals, locals
File "game/navigation.rpy", line 184, in <module>
$ cheat()
File "game/gameCheats.rpy", line 320, in cheat
usePairCheats(s)
File "game/gameCheats.rpy", line 178, in usePairCheats
narrator(sNoSuchCheatS)
File "/run/media/nait/nanika/mobile_programs/renpy-6.15.7-sdk/renpy/character.py", line 808, in __call__
what = what_pattern.replace("[what]", sub(what, translate=translate))
File "/run/media/nait/nanika/mobile_programs/renpy-6.15.7-sdk/renpy/substitutions.py", line 223, in substitute
s = formatter.vformat(s, (), kwargs)
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 549, in vformat
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 571, in _vformat
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 632, in get_field
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 591, in get_value
KeyError: 's'
Linux-3.13.8-1-ARCH-x86_64-with-glibc2.2.5
Ren'Py 6.17.6.512Code: Select all
label start:
python:
s = "nope"
def test():
narrator("[s]")
test()
