One thing I'd like to change if possible is swap "$ xyz" calls with direct calls without Python, and from how I understand the documentation, Creator-defined statements seem like the way to go.
Simplest example:
$ showScene("myScene")
This calls a simple python function.
Code: Select all
def showScene(scenePicture, clearActors=True):
renpy.scene()
renpy.show(scenePicture)
(...)
I tried to go by the description/example given in the documentation and ended up with this here:
Code: Select all
python early:
def parse_showScene(lex):
what = lex.simple_expression()
return what
def execute_showScene(o):
what = o
renpy.scene()
renpy.show(what)
def lint_showScene(o):
what = o
try:
eval(what)
except:
renpy.error("Scene not defined: %s" % what)
renpy.register_statement("showScene", parse=parse_showScene, execute=execute_showScene, lint=lint_showScene)
Cause OBVIOUSLY that doesn't work and I get an "expected statement" error instead.
The code compiles if I write >showScene "myScene"< instead, i.e. put myScene in quotes, but then all hell breaks loose if I actually get to that point.
Thanks you very much in advance.


