Code: Select all
renpy.exists(name_here.txt)
if true:
secret_route_unlocked = true
if false:
pass
Code: Select all
renpy.exists(name_here.txt)
if true:
secret_route_unlocked = true
if false:
pass
Code: Select all
init python:
## set-up objects
secret_route_unlocked = False
image bg = Solid('#000') ## create black background image
label start:
scene bg ## show background
python:
## test if the file path exists, setting the 'secret_route_unlocked' object if file exists
if renpy.exists('name_here.txt'):
secret_route_unlocked = True
## display result
"Secret route unlocked: [secret_route_unlocked]"
# game ends here
return
Thanks! It's helped. But, if you can, say, how to write "else" to this command. When I write it, it just skipped, i guess. Or I must write if secret_route_unlocked = true etc?guiltyGG wrote: ↑Sun Mar 25, 2018 9:07 am Just my two cents:
Add a 'name_here.txt' file to your '/game/' folder (where 'script.rpy' resides).
HTHCode: Select all
init python: ## set-up objects secret_route_unlocked = False image bg = Solid('#000') ## create black background image label start: scene bg ## show background python: ## test if the file path exists, setting the 'secret_route_unlocked' object if file exists if renpy.exists('name_here.txt'): secret_route_unlocked = True ## display result "Secret route unlocked: [secret_route_unlocked]" # game ends here return
Code: Select all
image bg = Solid('#000')
label start:
scene bg
python:
## test if the file path exists, setting the 'secret_route_unlocked' object if file exists
if renpy.exists('name_here.txt'):
secret_route_unlocked = True
else:
secret_route_unlocked = False
## display result
if secret_route_unlocked == True:
"The Secret Route is now unlocked ..."
else:
"No Secret Route for you ..."
# game ends here
return
Code: Select all
python:
a = 32
if a == 32:
print "32"
elif a == 12:
print "12"
else:
print "'a' doesn't match any expected values!"
Tks a lot! this saved me from a lot of headachesguiltyGG wrote: ↑Sun Mar 25, 2018 9:07 am Just my two cents:
Add a 'name_here.txt' file to your '/game/' folder (where 'script.rpy' resides).
HTHCode: Select all
init python: ## set-up objects secret_route_unlocked = False image bg = Solid('#000') ## create black background image label start: scene bg ## show background python: ## test if the file path exists, setting the 'secret_route_unlocked' object if file exists if renpy.exists('name_here.txt'): secret_route_unlocked = True ## display result "Secret route unlocked: [secret_route_unlocked]" # game ends here return
Current documentation says "You almost certainly want to use renpy.loadable() in preference to this function."
Users browsing this forum: No registered users