So the problem is I wanted to create a dynamically composited image that would automatically calculate the position of the two 'side mirrors', I have it working if I just input the values for a 960 pixel width image, but some images aren't 16:9 1280 x 720 or 4:3 960x720.
I could just either edit the offending images or make a different choice (my current project is like Haramase Sim and uses images from existing Japanese games), but I'd really like to not have to do that .
Trying to use a default variable in the image code gives me the error:
Here are the relevant snippets of code:
The Image Definition:
The Victory Scene:
How I'm getting the image size:
I could just either edit the offending images or make a different choice (my current project is like Haramase Sim and uses images from existing Japanese games), but I'd really like to not have to do that .
Trying to use a default variable in the image code gives me the error:
Code:
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/special-images.rpy", line 77, in script
image dynamicimage_victoryscene_composite = Composite(
File "game/special-images.rpy", line 80, in <module>
(1280 - dynamicimage_width,0), "dynamicimage_victoryscene",
NameError: name 'dynamicimage_width' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "D:\Program Files\renpy-6.99.14.1-sdk\renpy\bootstrap.py", line 313, in bootstrap
renpy.main.main()
File "D:\Program Files\renpy-6.99.14.1-sdk\renpy\main.py", line 423, in main
renpy.game.context().run(node)
File "game/special-images.rpy", line 77, in script
image dynamicimage_victoryscene_composite = Composite(
File "D:\Program Files\renpy-6.99.14.1-sdk\renpy\ast.py", line 980, in execute
img = renpy.python.py_eval_bytecode(self.code.bytecode)
File "D:\Program Files\renpy-6.99.14.1-sdk\renpy\python.py", line 1937, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/special-images.rpy", line 80, in <module>
(1280 - dynamicimage_width,0), "dynamicimage_victoryscene",
NameError: name 'dynamicimage_width' is not defined
Windows-8-6.2.9200
Ren'Py 7.1.3.1092
Adam and Gaia : THXE (Turbo Hyper Extreme Edition) Foundation
Thu Dec 13 23:43:19 2018
The Image Definition:
Python:
image dynamicimage_victoryscene = "battlechars/[rpgstat_EnemyRandomType]/[rpgstat_EnemyRandomType]_[dynamicimage_victory]/[rpgstat_EnemyRandomType]_[dynamicimage_victory] [dynamicimage_currentstep].webp"
image dynamicimage_victoryscene_composite = Composite(
(1280,720),
(0,0), "dynamicimage_victoryscene",
(1280 - dynamicimage_width,0), "dynamicimage_victoryscene",
(0,0), "shaded.webp",
((1280 - dynamicimage_width) / 2,0), "dynamicimage_victoryscene"
)
Python:
label hscenelabel_SlimeGirlVictoryScene:
stop music
### REDACTED ####
$ dynamicimage_victory = "{:02}".format(renpy.random.randint(1,27))
$ dynamicimage_width = rpgfunction_getimagesize()
scene scene_bg with dissolve
### REDACTED ####
if dynamicimage_width < 1280:
show dynamicimage_victoryscene_composite at transform_IncreaseSizeBy50Percent,transform_CenterInScreen, transformfunction_VictoryScene() with dissolve
else:
show dynamicimage_victoryscene at transform_IncreaseSizeBy50Percent, transform_CenterInScreen, transformfunction_VictoryScene() with dissolve
### REDACTED ####
$ dynamicimage_currentstep = "02"
$ renpy.with_statement(dissolve)
### REDACTED ####
$ dynamicimage_currentstep = "03"
$ renpy.with_statement(dissolve)
### REDACTED ####
$ dynamicimage_currentstep = "02"
$ renpy.with_statement(dissolve)
### REDACTED ####
$ dynamicimage_currentstep = "04"
$ renpy.with_statement(dissolve)
show whiteflash zorder 50
### REDACTED ####
$ dynamicimage_currentstep = "05"
$ renpy.with_statement(dissolve)
### REDACTED ####
scene scene_bg with dissolve
### REDACTED ####
jump functionlabel_AfterHSceneHub
Python:
def rpgfunction_getimagesize():
dynamicimage = "battlechars/%s/%s_%s/%s_%s %s.webp" % (rpgstat_EnemyRandomType.capitalize(),rpgstat_EnemyRandomType.capitalize(),dynamicimage_victory,rpgstat_EnemyRandomType.capitalize(),dynamicimage_victory,dynamicimage_currentstep)
iSize = renpy.image_size(dynamicimage)
return iSize[0]
You don't have permission to view the spoiler content.
Log in or register now.