How to update screens correctly?

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
Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

How to update screens correctly?

#1 Post by Ryue »

I've a question in regards to screens that take parameters and how they are updated when the parameter is changed.

I've got the following screencode:

Code: Select all

screen RedEyesRPGEngine_CombatInitiativeList(initiativeList, currentlyActiveChar):
    hbox:
        spacing 5
        for initiativePosition in initiativeList:
            frame: 
                fixed:
                    xmaximum 64
                    ymaximum 90
                    if (initiativePosition == currentlyActiveChar):
                        add ImageReference("Combat" + " " + "Status" + " " + initiativePosition.ImageName + " " + "Ready")
                        add ImageReference("CombatUI InitiativeSlotBorder") 
                    else:
                        add ImageReference("Combat" + " " + "Status" + " " + initiativePosition.ImageName + " " + "Ready")
InitialiveList is a list of characters at specific initiative positions. CurrentlyActiveChar is the currently acting character.
(Call:

Code: Select all

renpy.show_screen("RedEyesRPGEngine_CombatInitiativeList", self.InitiativeList, self.CombatCurrentlyActiveChar)
)


Now it displays the whole thing quite nicely BUT when I change self.CombatCurrentlyActiveChar the "ImageReference("CombatUI InitiativeSlotBorder") " is still at the old location. So my question is there what am I doing wrong there?

Edit:
The line where I change it is the following (I also tried adding renpy.restart_interaction to no avail):

Code: Select all

            for currentChar in self.InitiativeList:
                self.CombatCurrentlyActiveChar = currentChar
                renpy.restart_interaction()

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

Re: How to update screens correctly?

#2 Post by philat »

I'm not 100% sure because I haven't delved into screen language and really studied the inner workings, but based on my experiences with other things, I would assume it's the usual name tags not boxes problem. http://lemmasoft.renai.us/forums/viewto ... 96#p362587 (see also the link in that post)

In other words, show the screen again.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to update screens correctly?

#3 Post by xela »

philat wrote:In other words, show the screen again.
Yeap, it's a bit weird that you assume that they should be updated when if it was a function, transform or a method you use in Python/Ren'Py, they would not be... You can also use global or default, default you can update with screen actions and global will be updated when interactions restarts (and screen is updated).
Like what we're doing? Support us at:
Image

User avatar
orz
Regular
Posts: 126
Joined: Tue Apr 21, 2015 10:19 pm
Contact:

Re: How to update screens correctly?

#4 Post by orz »

It's hard to pinpoint with only this section of code. It might actually have to do with how you've defined ImageReference, but all I can do is guess with this amount of code (because it references other code and who knows what that's doing).

Post Reply

Who is online

Users browsing this forum: No registered users