Ren'Py pause and time and such [SOLVED]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#16 Post by kivik »

Since you're constantly updating the xpos - maybe you can use trans.xpos insider the transform function?

My version was pretty basic and didn't pass the character into the transform and it seems to be fine with xoffset - perhaps you need to do it with xpos directly:

Code: Select all

    def cycle(trans, st, at, char):
        char.xpos -= char.stride1
        trans.xpos = char.xpos
Hopefully that'd work!

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#17 Post by TellerFarsight »

For some reason that doesn't work. It does one cycle and then resets back to original position, and it just repeats the same step multiple times before stopping. The actual char.xpos does update, as indicated by the display I put in, but the character stays in the same place.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#18 Post by TellerFarsight »

Okay, so so far it works fairly well... as long as I still *have* the original function with renpy.pause in it. There's some problem with using the "show expression" 2 times in a row for the same character, but if I have Diana.move() somewhere, and then show expression move(Diana,...), and then Diana.move() again, it works fine. That's probably all I need anyway. I have a talking indicator that can't follow the character as they walk, so the talking character will never move using the show expression, and I can't get the smooth "linear" ypos movement with the transform function either. It works in a limited capacity, but I can plan around it so that it never needs to go past those limitations.
I've resolved to using xoffset instead of xpos, because it looks like it doesn't really update in the middle of the walk animation. Maybe it has something to do with when renpy actually blits, but I don't claim to fully know how blitting works. When I had it with xpos, I could click to skip to the next line in the middle of the walk animation, and the char.xpos would actually stop somewhere in the middle (If the char is walking from 1198 to 711, I could click to interrupt in the middle and the char.xpos display int he center would show 844 or something, but then change to 711 after a moment). Somewhere in there it is working, but I think once an image is shown in a position, there's some gunk that keeps it from actually moving anywhere else. I would need to, I guess, hide it and then show it again? I don't think xpos can actually change, but xoffset and that's why this version works.

Here's how it looks now. Pretty good, eh?
https://media.giphy.com/media/69xjQSkzp ... /giphy.gif
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#19 Post by kivik »

Looking great!

I hadn't consider the problem of skipping dialogue - it would definitely cause problems with the transform function I posted as it was updating the character position from inside the transform functions - which gets skipped if you skip the dialogue. So perhaps it's best to wrap it within a utility label / function that you call, which calculates the next character position separately from the transform itself. The goal would be to make the transform and transform function not care about the character coordinates and just execute the animation - as Renpy still works out the transform outcome even if it doesn't rendered the animation in between.

It sounds like you've got a work around but if you have time to revisit maybe it can iron out the root of the problem and have something more robust - but as a fellow programmer I know sometimes you just don't want to mess with the code when you know how to make it work XD


The problem with showing the same character twice should happen regardless of whether you're doing show expression twice or not - it was the original issue you had: where you tried to use pause to solve. When you show the same image tag twice without interaction in between, the first one doesn't get seen (I don't even know if it's rendered) as the second one will start executing immediately after - and the same image tag makes the first one will disappear.

I think if you have start stop start animation loops you want to consider, then maybe what you need is to actually create a transform functions that takes a list of predefined animations and their parameters, and process it within the transform function. I think that's what the st and at parameters are for ultimately. Unfortunately that's beyond me as I haven't seen examples of how to work it at that level, but I expect that's how it can be achieved.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#20 Post by TellerFarsight »

Oh, I wasn't really thinking of the skipping dialogue as a problem. I was using it to sort of get at the function and see how it worked. I'll have to look at it again now that I've switched back to xoffset to see if it's still a problem.

For the character twice thing, I don't mean two "show expressions" right one after the other. I did one show expression, then a pause or two, a line of dialogue from another character and several other characters moving, and then another show expression. This second one starts from the original position, as if the first show expression didn't happen, but the char.xpos still updates. The solution is to make sure a char.move or some other method is called somewhere between the two expressions. This method is what I was using before, and for whatever reason it updates the position and a few other attributes, so then when another show expression is called, it goes as intended.

In the gif I posted, the two characters walk to the center of the screen, and then all characters but the redhaired one are "resolidified" with a char.talk method, which just shows an image of them standing, then a brief pause (like pause 1.0), and then all three characters have another show expression.

And yes, I'll leave this post marked as unsolved so if anyone ends up seeing it and has a solution, they can update us both.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: henne