Skip to content

Instantly share code, notes, and snippets.

@videlais
Created July 26, 2018 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save videlais/c7d96406505e52791e83ef80cd3834c6 to your computer and use it in GitHub Desktop.
Save videlais/c7d96406505e52791e83ef80cd3834c6 to your computer and use it in GitHub Desktop.
Custom Statements
python early:
def parse_smartline(lex):
who = lex.simple_expression()
what = lex.rest()
return (who, what)
def execute_smartline(o):
who, what = o
renpy.say(eval(who), what)
def lint_smartline(o):
who, what = o
try:
eval(who)
except:
renpy.error("Character not defined: %s" % who)
tte = renpy.check_text_tags(what)
if tte:
renpy.error(tte)
renpy.register_statement("line", parse=parse_smartline, execute=execute_smartline, lint=lint_smartline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment