[RESOLVED]renpy.exists : fails with class property
Posted: Tue Jun 01, 2021 1:11 pm
Hola guys,
another quest.
And of course, if you like to play, you can compare the 2 strings , humanly equals, but digitaly differents.
Welcome in my world guys !!!!
another quest.
Code: Select all
define PICTURES_CHARACTERS = "pictures/characters/"
define idSpeaker = "player.jpg"
default lstTest = []
#--------------------------------------------------------------------------------------------------
# START
#--------------------------------------------------------------------------------------------------
label start:
define _Speaker = Character("", image = "[PICTURES_CHARACTERS][idSpeaker]")
call loadTest
$ _Speaker ( "test 01 : " + str(lstTest[1].picture) )
show expression str(lstTest[1].picture) # NO PROBLEM : show find picture
if renpy.exists( lstTest[1].picture ): # PROBLEM : renpy.exists doesn't find picture
$ _Speaker ( "test 02 : Image Find VARIABLE MODE" )
else:
$ _Speaker ( "test 02 : NOT Find In VARIABLE MODE" )
if renpy.exists("pictures/characters/test02.jpg"): # # BUT renpy.exists find picture if i give the same string hard coding
$ _Speaker ( "test 03 : Image Find In FULL STRING MODE" )
return
label loadTest:
$ lstTest = [
( testVariableScope( idEvent="test01")),
( testVariableScope( idEvent="test02")),
( testVariableScope( idEvent="test03"))
]
return
Code: Select all
init python:
class testVariableScope:
def __init__(self, idEvent="", extPicture="jpg"):
self.idEvent = idEvent
@property
def picture(self):
return "[PICTURES_CHARACTERS]" + self.idEvent.lower() + ".jpg"
Welcome in my world guys !!!!