Ren'Py Call Back A Screen

Part

Member
Donor
Nov 14, 2016
225
2,906
So I'm coding my first novel in Ren'Py.

And I can't call back on a screen that has been shown once.

Here is an example of my code :

show 1a
c "xx"

show 1b
c "xxx xx x"

show 1c
c "xx xxxxx"
c "xxxxx ?"

show 1b
c "xxx"

show 1c
c "xxxx xxx xx x"

show 1d
c "xxx xxxx xxx"
I can't call back 1c and 1b. Is there a tip or I'm doing it wrong ? Thanks.

(I never code something, and excuse my english, I'm french)
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
Besides if you don't use full scene renders and want to do it in sprites or whatnot, you always have to "HIDE" the stuff you've shown before, because all the new stuff just gets placed on top of the old, and it won't move unless you hide and show it again (also a big reason ren'py games crash on slow computers when a dev uses full scene renders and just "shows" all the images without hiding them again... it's called memory leak ;) )
So if it's full scenes do it as envixer said, cause that's the right way to do it.
Else do it like this:
Code:
show 1a
c "xx"
hide 1a

show 1b
c "xxx xx x"
hide 1b

show 1c
c "xx xxxxx"
c "xxxxx ?"
hide 1c

show 1b
c "xxx"
hide 1b

show 1c
c "xxxx xxx xx x"
hide 1c

show 1d
c "xxx xxxx xxx"
 

Part

Member
Donor
Nov 14, 2016
225
2,906
I will use "scene" because I'm using full render screens.

But I haven't to do something like "hide" to prevent "memory leaks" ?
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
I will use "scene" because I'm using full render screens.

But I haven't to do something like "hide" to prevent "memory leaks" ?
If you're using scene you don't need to use hide as scene clears out the old before displaying the new.
Exactly what random said, the "scene" command clears out all the previously shown stuff.
 
  • Like
Reactions: Part

Part

Member
Donor
Nov 14, 2016
225
2,906
I don't create another thread for this but :

Is there a possibility to call a screen without text ? (show or scene don't work without text)
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
Just the scene image without any text?

Code:
scene Bla
with blup

pause(seconds / or without the brackets to make the player click to continue)

scene Next scene image
with transitionName

"Text"
 

Part

Member
Donor
Nov 14, 2016
225
2,906
Great. Thanks Palanto.

So here is my code :

Code:
    scene 3k
    c "Text"

    scene 3l
    pause

    scene 3m
    pause

    scene 3n
    c "Text"
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
Yup that's right, it should work like that ;)
So scene 31 stays as long as the player doesn't click the left mouse button or hits the space key. Same with 3m. If you want to make it automatically continue after a specific time, just uses pause(5.0) for 5seconds pause then resume or before 5 secs are up by a users click / space key.
If you want to "FORCE" a pause to be as long as you want it to be without the player having control on when to continue, you'd use:
$ renpy.pause(5.0, True)
This would pause the game for 5seconds and can't be continued before the 5 sec. are up.
 
  • Like
Reactions: Part

Part

Member
Donor
Nov 14, 2016
225
2,906
Great for your answers guys.

A new one : I have somes pictures in 1440*2560 (portrait ones), but my renpy game is in 2560*1440. In other games, I've seen some game pictures that are "moving" from the bottom to the top. I think it could be an interesting solution. But what is the renpy code for that ?

Thanks.
 
  • Like
Reactions: Palanto

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,058
This would pause for half a second and then over 5 seconds scroll upwards, the whole screen won't be filled with the image if you want that you need to add a zoom to the show command (1.78).
The value after pause and linear are seconds and can be adjusted till you find the right speed for your purpose.

The way this is done is with ATL which you can learn more about here :
**Side note my naming convention habit is just from finding things for auto-completion in my text editor**
Code:
transform transform_FromBottomToTop:
    pause 0.5
    linear 5.0 yalign 0.0


label whereyouwantit:
    #### OTHER CODE
    show portrait at transform_FromBottomToTop with dissolve:
        yalign 1.0
        #zoom 1.78
    ### THE REST OF THE CODE
 

Part

Member
Donor
Nov 14, 2016
225
2,906
If you want to "FORCE" a pause to be as long as you want it to be without the player having control on when to continue, you'd use:
$ renpy.pause(5.0, True)
I was interested by this feature, but you must use that code with "hard=True" (because it doesn't work with "True" only) :

The good one to force pause :
Code:
$ renpy.pause(8.0, hard=True)
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
hmm usually it should work without the hard= part, but I have it in my code too, so yeah never checked if it worked without it :D The function definition only takes two arguments though, the first being the time as a float and the second being true or false for "hard="... so it SHOULD work without writing hard= before the True..... well we're talking about ren'py here, it doesn't even acknowledge defaulted variables as being defined before sometimes.....................................................
 
  • Like
Reactions: Part

Part

Member
Donor
Nov 14, 2016
225
2,906
well we're talking about ren'py here, it doesn't even acknowledge defaulted variables as being defined before sometimes..
I didn't know this.

Well, I've checked, the variable is defined before, but it doesn't force pause without the "hard" in my code.

:
renpy.pause(delay=None, music=None, with_none=None, hard=False, checkpoint=None)
Returns true if the user clicked to end the pause, or false if the pause timed out or was skipped.
:)
 
  • Like
Reactions: Palanto

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,483
6,992
The function definition only takes two arguments though, the first being the time as a float and the second being true or false for "hard="... so it SHOULD work without writing hard= before the True..... well we're talking about ren'py here, it doesn't even acknowledge defaulted variables as being defined before sometimes.....................................................
No, this is a Python thing, not a Ren'py thing. Since the line starts with a dollar sign, everything after it is pure Python. (In this context, the 'renpy.' is a Python namespace.)

Python has "positional arguments" and "named arguments." If an argument is specified in "name = value" form, it is a named argument, and must always be provided as a named argument. (If it's provided, that is - if omitted you get the default.) Positional arguments are the ones that aren't specified this way, and must be provided in the order specified. Part of this is for expansion purposes - you can add additional named arguments to functions without breaking existing code, since they can be omitted.

So when you write
Code:
$ renpy.pause(5.0, True)
Python is looking for a "pause" function in the "renpy" namespace that takes two positional arguments. There isn't one, so a small cloud of orange smoke rises...
 
  • Like
Reactions: Part and Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
I didn't know this.

Well, I've checked, the variable is defined before, but it doesn't force pause without the "hard" in my code.



:)
hmmmm alright, so that explains that then... more than two arguments X_x where did I read only two arguments though?

No, this is a Python thing, not a Ren'py thing. Since the line starts with a dollar sign, everything after it is pure Python. (In this context, the 'renpy.' is a Python namespace.)

Python has "positional arguments" and "named arguments." If an argument is specified in "name = value" form, it is a named argument, and must always be provided as a named argument. (If it's provided, that is - if omitted you get the default.) Positional arguments are the ones that aren't specified this way, and must be provided in the order specified. Part of this is for expansion purposes - you can add additional named arguments to functions without breaking existing code, since they can be omitted.

So when you write
Code:
$ renpy.pause(5.0, True)
Python is looking for a "pause" function in the "renpy" namespace that takes two positional arguments. There isn't one, so a small cloud of orange smoke rises...
Partly true :) You can still throw in a value for the named argument without giving it the same name in the call like this: function(namedArgument=Value) , but only if the argument is the next in line.... Seems like I've been mistaken with the "two arguments", and since there are a lot more than those two I thought that were in there... well that's another story, this way I have to either give the name too "or" go through all arguments, passing them each a value until I reach the "Hard=" argument, which I could then set to True without writing the name (which is counter productive :D Since we only wanted to set the time and the Hard value :D )

Code:
def function(Test=False, Random=True, pos=(120, 50)):
    bla blup

function(True, False, (150,180))
Would work the same as if you'd call it like that:
Code:
function(Test=True, Random=False, pos=(150,180))
But if I wanted to skip the random part, then I'd have to write it like this:
Code:
function(True, pos=(150,180))
But you're absolutely right about the python part, but still, the function is a ren'py internal, predefined function. That was actually the reason I said "well we're talking about ren'py here...." the part about the defaulted variables not always being acknowledged wasn't anything I meant for "this" topic though.... it's just getting on my nerves since about 5% of my players don't get one single variable defined even though it's defaulted, set in the after_load label manually too and gets calculated all over again each time they open a specific screen.... which throws them the error that the variable isn't defined.... ugh :)