Hard request - restructure rollback/seen text to accommodate new paradigm?

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.
Post Reply
Message
Author
User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Hard request - restructure rollback/seen text to accommodate new paradigm?

#1 Post by SuperbowserX »

That is a very cryptic title, yes :D But it's hard to explain the problem concisely. This is admittedly a rather complex question that probably requires knowledge of Ren'py's *internal* workings, and it may require PyTom himself to answer it.

Now, to fit the purposes of my game, I automate almost all of the animations and have done so successfully. The problem is, this breaks rollback.

First, consider this code of a character class I made.

Code: Select all

init -1 python:
    class Char():
        def __init__(...): #the parameters listed here aren't particularly important to this question
            #...some variables used to denote the character's current image, current mood, its orientation on the screen
            self.Character = Character(name, color = "#860114", who_outlines = [(3,'#ffffff',0,0)]) #the actual character class is an internal variable inside the class
Here is a sample stay statement.

Code: Select all

call say(derek, "Hello, officers. How may I help you?") #note that Derek's character is defined earlier
In the say label, I have some code that will automatically adjust the screen appropriately. One of the variables of the Char class I made is orientation (is character on left/right side of screen). If the character is on the opposite side of the screen, the screen shifts to their side (change xoffset of background image). Another variable is mood; if a character's mood changes (ie "happy" to "angry"), then the say statement will automatically change the image of the character to make the appropriate one appear.

And that way, things are much much easier to do. I can manually change the orientation variable inside the char class with one line of code. Then, when the call say statement is called, it can automatically follow the orientation change procedure (changing xoffset of bg) all by itself. When the mood is changed, the say label will again just change the image by itself. When a different character is speaking, the say label can hide the image of the speaking character, and show the new one.

However, there is a certain drawback to this that is a HUGE pain when testing. So, in the say label, the actual dialogue is done like this:

Code: Select all

label say(who, what): #Character dialogue. Again, only pertinent code is shown
    #image modification code here
    $ who.Character("{color=#000000}" + what) #this has to be a python statement to support the tags that may be in the what parameter
The problem is, this breaks skipped text. This one line of code, the $ who.Character(...) statement, is considered by Ren'py to be the only line of dialogue in the game (as all dialogue is piped to via calls to the say statement). Because of this, the game isn't able to recognize skipped text. This is a *huge* pain when debugging.

Anyone have any ideas how to fix this? Is there a way to make Ren'py consider every instance of the "what" parameter to be it's own statement, or if there is a function that can be placed at the say label that basically uses the what parameter to mark the current statement as seen?

If you think it's needed I can post the full code of the Char class and say label but I doubt it's relevant. It's all image stuff.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#2 Post by PyTom »

I'm not really that interested in supporting a total rewrite of the dialogue system, since I don't understand it or the motivation behind it.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#3 Post by SuperbowserX »

It's fine, it's a very specific case and the vast majority of creators don't need it. I was just hoping that maybe there was some way to customize the seen text feature, but now that I think about it that'd be extremely difficult to code.

Plus, maybe in the future, I can just rewrite the actual say screen to accommodate these changes.

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#4 Post by philat »

I'd probably try using character callbacks myself.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#5 Post by trooper6 »

Have you read through the documentation on Dialogue? https://www.renpy.org/doc/html/dialogue.html
Because you can do a lot of what you want to do without rewriting everything. You can do some of this with character callbacks, say with image attributes and say with arguments.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#6 Post by SuperbowserX »

Not a bad idea. I suppose what I'd need to do is make an appension to the character class so that it can store the other variables in my custom Char() class. Then I could run a callback that does everything my say statement does.

That actually sounds feasible. Maybe once I'm done coding the current chapter I'll try that, thanks for the suggestion. Does anyone know if there's a way to do that (add custom variables to Renpy's character class)?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#7 Post by PyTom »

No, you're not allowed to do that. But why would you? You should probably just explain what you really want to be doing in terms of variables and so on, and then we can figure out how to help you get there. For example, you can have.:

Code: Select all

define character.e = Character("Eileen")
default e = MyObject()
To have one object used with dialogue, while a same-named object stores data.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Hard request - restructure rollback/seen text to accommodate new paradigm?

#8 Post by Remix »

For a recipe that takes that ideal further perhaps see and read:

viewtopic.php?f=51&t=47911
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: No registered users