The source code (I'm still learning, so this won't be pretty):
Code: Select all
label DisplayCrawl(image_name, tInitialPause=1.0, tCrawlTime=7.0, yStart=1.0, yEnd=0.0):
# hide UI elements
window hide
hide screen hud
$ quick_menu = False
# display image and transition vertically based on passed arguments over x time
scene image_name with dissolve:
subpixel True
yalign yStart
pause tInitialPause
linear tCrawlTime yalign yEnd
pause
# show UI elements
show screen hud
$ quick_menu = True
return
Code: Select all
call DisplayCrawl("some_image", 1.0, 3.0, 1.0, 0.1) # have tried the image name without quotation marks
Code: Select all
image some_image = ("crawls/test.png")
I was kind of hoping that even though the argument 'image_name' in the label/function is an object, Ren'Py would search for the name of the object passed, realise it's an image / cast the object into an image, and feed that image to the 'scene' statement. Nope. If don't enclose the image name in quotation marks ("some_image"), Ren'Py throws an exception:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 551, in script call
call DisplayCrawl(some_image, 1.0, 3.0, 1.0, 0.1)
File "game/script.rpy", line 333, in script
label DisplayCrawl(image_name, tInitialPause=1.0, tCrawlTime=7.0, yStart=1.0, yEnd=0.0):
File "game/script.rpy", line 551, in <module>
call DisplayCrawl(some_image, 1.0, 3.0, 1.0, 0.1)
NameError: name 'some_image' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 551, in script call
call DisplayCrawl(some_image, 1.0, 3.0, 1.0, 0.1)
File "game/script.rpy", line 333, in script
label DisplayCrawl(image_name, tInitialPause=1.0, tCrawlTime=7.0, yStart=1.0, yEnd=0.0):
File "C:\Users\###\Desktop\renpy-6.99.12.4-sdk\renpy\ast.py", line 1327, in execute
args, kwargs = self.arguments.evaluate()
File "C:\Users\###\Desktop\renpy-6.99.12.4-sdk\renpy\ast.py", line 184, in evaluate
args.append(renpy.python.py_eval(v, locals=scope))
File "C:\Users\###\Desktop\renpy-6.99.12.4-sdk\renpy\python.py", line 1749, in py_eval
return py_eval_bytecode(code, globals, locals)
File "C:\Users\###\Desktop\renpy-6.99.12.4-sdk\renpy\python.py", line 1743, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/script.rpy", line 551, in <module>
call DisplayCrawl(some_image, 1.0, 3.0, 1.0, 0.1)
NameError: name 'some_image' is not defined
Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.4.2187
Other than that, loving Ren'Py and all its possibilities
Thanks,