Ok, this time it's solved for good. There are still some stuff I don't understand and I don't like when I don't understand things so don't hesitate to reply if you want to, but at least I found a solution.
So to summarize for my fellows lurkers who have a similar problem, here are some complete copy-pasta-ble examples of what works/doesn't work. And my (over complicated) solution:
The first thing I tried that
didn't work (but should?):
Code: Select all
# You can place the script of your game in this file.
init -1 python hide:
config.empty_window = nvl_show_core
## Used when the window is shown.
config.window_show_transition = Dissolve(0.2)
## Used when the window is hidden.
config.window_hide_transition = Dissolve(0.4)
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
image eileen = Placeholder()
image white = Placeholder("bg")
# Declare characters used by this game.
#define e = Character('Eileen', color="#c8ffc8")
define narrator = Character(None, kind=nvl)
# The game starts here.
label start:
scene white
show eileen happy
"You've created a new Ren'Py game."
window hide ##doesn't work
show eileen sad with Dissolve(0.3)
window show ##actually work
"Once you add a story, pictures, and music, you can release it to the world!"
return
It could have been that simple if it worked… Anyway. Because of some voodoo magic, using nvl hide give some better results:
Code: Select all
# You can place the script of your game in this file.
init -1 python hide:
config.empty_window = nvl_show_core #useless
## Used when the window is shown.
config.window_show_transition = Dissolve(4) #useless
## Used when the window is hidden.
config.window_hide_transition = Dissolve(3) #useless
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
image eileen = Placeholder()
image white = Placeholder("bg")
# Declare characters used by this game.
#define e = Character('Eileen', color="#c8ffc8")
define narrator = Character(None, kind=nvl)
# The game starts here.
label start:
scene white
show eileen happy
"You've created a new Ren'Py game."
nvl hide Dissolve(0.4) #Dissolve(0.4) is NOT optional
show eileen sad with Dissolve(0.3)
nvl show Dissolve(0.2)
"Once you add a story, pictures, and music, you can release it to the world!"
return
This code
works, but the syntax
sucks and the documentation is
wrong, as I said before.
A more sane solution is to make a python function. I think this solution is good enough for most people, I added a pause and the result is really smooth and nice. I like it:
Code: Select all
# You can place the script of your game in this file.
init -1 python hide:
config.empty_window = nvl_show_core #still useless
## Used when showing NVL-mode text directly after ADV-mode text.
config.adv_nvl_transition = Dissolve(0.2)
## Used when showing ADV-mode text directly after NVL-mode text.
config.nvl_adv_transition = Dissolve(0.4)
init 1 python:
def nvlHide():
nvl_hide(config.nvl_adv_transition)
#Hide(nvl, transition=Dissolve(3)) #Dissolve(3))
renpy.pause(0.1)
return
def nvlShow():
renpy.pause(0.1)
nvl_show(config.adv_nvl_transition)
#Show(nvl, transition=downLong) #Dissolve(3))
return
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
image eileen = Placeholder()
image white = Placeholder("bg")
# Declare characters used by this game.
#define e = Character('Eileen', color="#c8ffc8")
define narrator = Character(None, kind=nvl)
# The game starts here.
label start:
scene white
show eileen happy
"You've created a new Ren'Py game."
$nvlHide()
show eileen sad with Dissolve(0.3)
$nvlShow()
"Once you add a story, pictures, and music, you can release it to the world!"
return
And now my insane solution. I wanted to change config.show at first but it's a
terrible idea, adding pause to config.show make everything buggy. This solution is still probably buggy but at least all the code is define in one place and can be easily fixed without doing search/replaces in hundred of script files. It really is too complicated for what it does but the separation of code logic and script and the syntax simplification please the developer in me and I think it really worth it. You actually need to make a second file which name start with 0, for example 00statements.rpy (I defined a new statement):
Code: Select all
python early:
def execute_nvlShow( (imspec, atl, expr_with) ):
(image_name, expression, tag, at_list, layer, zorder, behind) = imspec
if expr_with == None:
expre_with = Dissolve(0.3)
nvlHide()
renpy.ast.show_imspec(imspec, atl=atl)
renpy.with_statement(expr_with)
nvlShow()
return
def parse_nvlShow(lex):
(image_name, expression, tag, at_list, layer, zorder, behind) = renpy.parser.parse_image_specifier(lex)
if lex.keyword("with"):
expr_with = eval(lex.require(lex.simple_expression))
else:
expr_with = None
atl = None
if lex.match(':'):
atl = renpy.atl.parse_atl(l.subblock_lexer())
else:
lex.expect_noblock('show statement')
lex.expect_eol()
lex.advance()
return ((image_name, expression, tag, at_list, layer, zorder, behind), atl, expr_with)
def predict_nvlShow( (imspec, atl, expr_with) ):
renpy.atl.predict_imspec(imspec, atl=atl)
renpy.register_statement("nvlShow", parse=parse_nvlShow, execute=execute_nvlShow, predict=predict_nvlShow)
I won't explain the code though… It works because magic.
and the script file:
Code: Select all
# You can place the script of your game in this file.
init -1 python hide:
config.empty_window = nvl_show_core #still useless
## Used when showing NVL-mode text directly after ADV-mode text.
config.adv_nvl_transition = Dissolve(0.2)
## Used when showing ADV-mode text directly after NVL-mode text.
config.nvl_adv_transition = Dissolve(0.4)
init 1 python:
def nvlHide():
nvl_hide(config.nvl_adv_transition)
#Hide(nvl, transition=Dissolve(3)) #Dissolve(3))
renpy.pause(0.1)
return
def nvlShow():
renpy.pause(0.1)
nvl_show(config.adv_nvl_transition)
#Show(nvl, transition=downLong) #Dissolve(3))
return
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
image eileen = Placeholder()
image white = Placeholder("bg")
# Declare characters used by this game.
#define e = Character('Eileen', color="#c8ffc8")
define narrator = Character(None, kind=nvl)
# The game starts here.
label start:
scene white
show eileen happy
"You've created a new Ren'Py game."
nvlShow eileen sad #yeah, that's it. That's all you have to write.
"Once you add a story, pictures, and music, you can release it to the world!"
$nvlHide()
show eileen happy with Dissolve(0.3)
show eileen sad with Dissolve(0.3)
show eileen happy with Dissolve(0.3)
$nvlShow()
"You can still use the old method when you need to make multiple show."
return
My solution is really complex but it gave me the occasion to read a lot of renpy code on github and I learned a lot, so it wasn't a waste of time. I'm just surprised I had to do that much to get a result so simple. (or maybe I'm just a bit crazy).
I didn't get too many answers but I know quite a lot of people read me so, thanks everyone for your time. And if you know why the first solution doesn't work, don't hesitate to reply even if the thread is tagged Solved.
And thanks to people that post real solution of their problems and not just "lol never mind it works now."
https://i.imgur.com/vuk57a6.png