Information Screen

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
CheeryMoya
Miko-Class Veteran
Posts: 892
Joined: Sun Jan 01, 2012 4:09 am

Information Screen

#1 Post by CheeryMoya »

This is for That's the Way the Cookie Crumbles, but we're willing to share sweet snippets of code if that'll help everyone make better games. If you use or adapt this code, please credit Funnyguts and TwinTurtle Games. The code is under a Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license.

This code was designed to be easily changed throughout the span of the game to reflect new information on a character as you learn it or unlock things.
screenshot0001.png
screenshot0002.png
Sprites used in this example were created by justblue, find them in this thread.
The only thing wrong with the code is that changes do not reset at the end of each playthrough, but they will reset when you turn off and then on again. If anyone could figure out how to fix that without jumping through a lot of hoops, it'd be much appreciated :3 Anyways, how to get this to work.

To use, it requires new .rpy files and altering of one of the existing ones. Before anything else, find "# Quick Menu" in your screens.rpy and see where all textbuttons are being defined. Wherever you want to put it, insert this line of code:

Code: Select all

textbutton _("Info") action ShowMenu("profile_screen")
You can put this code at the top of script.rpy or make a new one:

Code: Select all

init python:         
    xmax = config.screen_width
    ymax = config.screen_height    
init -2 python:
    #declares a new style called "infoscreen"
    style.infoscreen = Style(style.default)
    style.infoscreen_text.size = 24
    style.infoscreen_window.background = "infoscreenBG.png"  #<-- This puts a custom background in the area that displays the text and picture    
    style.infoscreen_frame.background = Frame("box.png", 10, 10) #<--same as above, but in the area that displays the buttons
    style.infoscreen_button.idle_background = Frame("box2.png", 10, 10)
    style.infoscreen_button.hover_background = Frame("box3.png", 10, 10)
    style.infoscreen_button_text.idle_color = "FF731C"
    style.infoscreen_button_text.hover_color = "FF731C"
    style.infoscreen_button_text.selected_color = "#F00"
    style.infoscreen_button.top_padding = 5
    style.infoscreen_button.bottom_padding = 5
    style.infoscreen_bar.left_bar = "bar_full-checks.png"
    style.infoscreen_bar.right_bar = "bar_empty-checks.png"
    style.infoscreen_bar.xmaximum = 209
    style.infoscreen_bar.ymaximum = 34
    style.infoscreen_bar.right_gutter = 0
    style.infoscreen_bar.left_gutter = 0
    style.infoscreen_bar.thumb = None
Now, in make a new blank .rpy file. Take the following code and paste it in:

Code: Select all

init python:
    # declares a class called 'char'
    default_var = '???'
    class char:
        #--------------------------VV--------if you want to change how much affection they start with
        def __init__(self, affection=50, name=default_var, bloodType=default_var, major=default_var, age=default_var, birthday=default_var, sign=default_var, likes=default_var, dislikes=default_var, description=default_var, currentThoughts=default_var, dateable=True, pic='none'): #<-- this line sets all the defaults; the only one you'll probably use
            self.affection=affection
            self.name = name
            self.bloodType = bloodType
            self.major = major
            self.age = age
            self.birthday = birthday
            self.sign = sign
            self.likes = likes
            self.dislikes = dislikes
            self.description = description
            self.currentThoughts = currentThoughts
            self.dateable=dateable
            self.pic=pic
            #You can add more areas if you want, just put self. and whatever it is you need
            
        def add_affection(self, amount):
            self.affection += amount
            if self.affection > affectionMax:
                self.affection = affectionMax
                
        def normalize(self):
            if self.affection > affectionMax:
                self.affection = affectionMax
            if self.affection < 0: 
                self.affection = 0
                
init:
    #declare all the characters here, use the following format. Add as many as you want or need.
    $ girl = char(
        name="Girl",  
        bloodType="A",
        major="N/A",
        age="16",
        birthday="Everyday",
        sign="Nope",
        likes="Pizza",
        dislikes="Tacos",
        description="Your neighbor.",  
        currentThoughts="I really want pizza.",
        dateable=False,
        pic="girl a 1.png"
        )   
    $ boy = char(
        name="Boy",  
        bloodType="AB",
        major="N/A",
        age="17",
        birthday="February 31",
        sign="Meh",
        likes="Tacos",
        dislikes="Pizza",
        description="Your best bud.",  
        currentThoughts="I really want tacos.",
        dateable=False,
        pic="b1.png"
        )   
    
    #these are the characters shown on the screen, you can add more as you meet new people
    $ allchars = [girl, boy]
        
    $ affectionMax = 100 #<-- maximum affection value is changed here
    $ show_profiles = False
    $ viewing = "Girl" #<-- the default character to show when the info screen is first called
        
screen profile_screen:
     tag menu
     zorder 10
     # creates a string for proper display of each fact (+some bars) 
     for i in allchars:
            $ char = i
            if viewing == char.name: 
               $ name = "Name: " + char.name
               $ bloodType = "Blood Type: " + char.bloodType
               $ major = "Major: " + char.major
               $ age = "Age: " + char.age
               $ birthday = "Date of Birth: " + char.birthday
               $ sign = "Sign: " + char.sign
               $ likes = "Likes: " + char.likes
               $ dislikes = "Dislikes: " + char.dislikes
               $ description = char.description
               $ thoughts = "Current Thoughts: \n \"" + char.currentThoughts + "\""
               $ pic = char.pic
               #if char == main: ##For the main character
                   #$ affectionBar = False
                   #$ friendshipBar = False
               if char.dateable: ##If you define the main character, change this statement to elif
                   $ affectionBar = True
                   $ friendshipBar = False    
               else:
                   $ affectionBar = False
                   $ friendshipBar = True
               $ affection = char.affection    
     
     #actually displays everything          
     frame xminimum 240 xmaximum 240 yminimum ymax: 
       style_group "infoscreen"  
       vbox yalign 0.5 xalign 0.5: 
          for i in allchars:
             #$ textbutton_name, dummy1, dummy2 = i.name.partition(' ') #cuts off the name after the first space
             textbutton i.name action SetVariable("viewing", i.name) xminimum 220 xmaximum 220 yminimum 50   
             #code for future imagebuttons
             #imagebutton idle "i.idlepic" hover "i.hoverpic" action SetVariable("viewing", i.name)
             $ i.normalize()
          textbutton "Return" action Return() ypos 0.8

     window xanchor 0 xpos 240 yalign 0 xminimum 784 xmaximum 784 yminimum ymax ymaximum ymax:
      style_group "infoscreen"   
      vbox spacing 10: 
          vbox:
               text name
               text bloodType
               if major != 'Major: ???':
                  text major
               text age
               text birthday
               text sign
          vbox xmaximum 500:     
               text likes
               text dislikes
          vbox spacing 10 xmaximum 490:  
              text description 
              text thoughts            
              hbox ypos 0.7:
                if affectionBar:         
                       text "Love:"  
                       bar value affection range affectionMax style "infoscreen_bar" right_bar "bar_empty-pink.png" left_bar "bar_full-pink.png"
                if friendshipBar:
                       text "Relationship:"  
                       bar value affection range affectionMax style "infoscreen_bar" 
      if pic != 'none':
               add pic xalign 0.6 yalign 0.0 #Tinker with these numbers as needed to change where the image goes
That's the beef of the code that makes everything run.

Here's how you'd use it in the script:

Code: Select all

label start:
    scene bg
    show girl 1 at left
    show boy 1 at right
    "One upon a time you and your friends had a party."
    g "I want pizza."
    b  "I want tacos."
    g "Oh wow no pizza FTW sheesh."
    "What will you order for dinner?"
    menu:
        "Pizza":
            show girl 3 at left
            show boy 2 at right
            $ boy.pic = "b2.png"
            $ girl.pic = "girl a 3.png"
            $ boy.major = "Pain"
            $ girl.currentThoughts=("AW YIS PIZZA.")
            $ girl.affection += 200
            $ boy.currentThoughts=("I hate life.")
            $ boy.affection -= 200
            g "YEHHHHHHH"
            b "Oh wow player we cannot be friends anymore I hate you."
        "Tacos":
            show girl 2 at left
            show boy 6 at right
            $ boy.pic = "b6.png"
            $ girl.pic = "girl a 2.png"
            $ girl.major = "Pain"
            $ boy.currentThoughts=("AW YIS TACOS.")
            $ boy.affection += 200
            $ girl.currentThoughts=("I hate life.")
            $ girl.affection -= 200
            b "YEHHHHHHH"
            g "Oh wow player we cannot be friends anymore I hate you."
    return
Any of the fields can be changed like that, so feel free to play around with it.

Attached to the end of the post is an example source code for this. Download it, explore the code, and have fun! The background was taken and filtered by Celianna, found in this thread.
Attachments
Info Screen example.zip
(1.4 MiB) Downloaded 680 times

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Information Screen

#2 Post by apricotorange »

Your initialization bug is probably related to http://www.renpy.org/wiki/renpy/doc/coo ... nit_blocks .

User avatar
curry nochi rice
Miko-Class Veteran
Posts: 746
Joined: Sat Mar 27, 2010 3:12 am
Projects: Delicatessen, Whom to Notice, Start of Something, Love Sorcery
Organization: Circle Cosine
IRC Nick: Curry
Skype: after.curry.rice
itch: project-rothera
Contact:

Re: Information Screen

#3 Post by curry nochi rice »

got many problems in the past 24 hours

scratch that, here's my finish product.
credits all go to the original programmer who did his best. \m/

Code: Select all

init python:         
    xmax = config.screen_width
    ymax = config.screen_height   
    
init python:
    # declares a class called 'char'
    default_var = '???'
    class char:
        #--------------------------VV--------if you want to change how much affection they start with
        def __init__(self, affection=0, friendship=default_var, name=default_var, bloodType=default_var, mood=default_var, age=default_var, birthday=default_var, sign=default_var, likes=default_var, dislikes=default_var, description=default_var, currentThoughts=default_var, dateable=True, mainChar=default_var, pic='none', health=default_var, mana=default_var, charisma=default_var, intelligence = default_var, stregnth = default_var, agility = default_var, stress = default_var ): #<-- this line sets all the defaults; the only one you'll probably use
        
            self.affection= affection
            self.friendship = friendship
            self.name = name
            self.bloodType = bloodType
            self.mood = mood
            self.age = age
            self.birthday = birthday
            self.sign = sign
            self.likes = likes
            self.dislikes = dislikes
            self.description = description
            self.currentThoughts = currentThoughts
            self.dateable=dateable
            self.mainChar = False
            self.pic=pic
            
            self.mana = mana
            self.health = health
            
            self.charisma = charisma
            self.intelligence = intelligence
            self.stregnth = stregnth
            self.agility = agility
            self.stress = stress
            #You can add more areas if you want, just put self. and whatever it is you need
            
        def add_affection(self, amount):
            self.affection += amount
            if self.affection > affectionMax:
                self.affection = affectionMax
        
        def add_friendship(self, amount):
            self.friendship += amount
            if self.friendship > friendshipMax:
                self.friendship = friendshipMax
            
        def add_health(self, amount):
            self.health += amount
            if self.health > healthMax:
                self.health = healthMax
            
        def add_mana(self, amount):
            self.mana += amount
            if self.mana > manaMax:
                self.mana = manaMax
                
        def add_charisma(self, amount):
            self.charisma += amount
            if self.charisma > charismaMax:
                self.charisma = charismaMax
        
        def add_intelligence(self, amount):
            self.intelligence += amount
            if self.intelligence > intelligenceMax:
                self.intelligence = intelligenceMax
                
        def add_stregnth(self, amount):
            self.stregnth += amount
            if self.stregnth> stregnthMax:
                self.stregnth = stregnthMax
            
        def add_agility(self, amount):
            self.agility += amount
            if self.agility > agilityMax:
                self.agility = agilityMax
        
        #mother of normalizations
        def normalizeAffection(self):
            if self.affection > affectionMax:
                self.affection = affectionMax
            if self.affection < 0: 
                self.affection = 0
        
        def normalizeFriendship(self):
            if self.friendship > friendshipMax:
                self.friendship = friendshipMax
            if self.friendship < 0:
                self.friendship = 0
                
        def normalizeHealth(self):
            if self.health > healthMax:
                self.health = healthMax
            if self.health < 0:
                self.health = 0
        
        def normalizeMana(self):
            if self.mana > manaMax:
                self.mana = manaMax
            if self.mana < 0:
                self.health = 0
                
        def normalizeCharisma(self):
            if self.charisma > charismaMax:
                self.charisma = charismaMax
            if self.charisma < 0:
                self.charisma = 0
                
        def normalizeIntelligence(self):
            if self.intelligence > intelligenceMax:
                self.intelligece = intelligenceMax
            if self.intelligence< 0:
                self.intelligence = 0
        
        def normalizeStregnth(self):
            if self.stregnth > stregnthMax:
                self.stregnth = stregnthMax
            if self.stregnth < 0:
                self.stregnth = 0
                
        def normalizeAgility(self):
            if self.agility > agilityMax:
                self.agility = agilityMax
            if self.mana < 0:
                self.agility = 0
                
        def normalizeStress(self):
            if self.stress > stressMax:
                self.stress = stressMax
            if self.stress < 0:
                self.stress = 0
init:
    #declare all the characters here, use the following format. Add as many as you want or need.
    $ Elisa = char(
        name="Elisa ",  
        bloodType="A",
        mood="Social Studies",
        age="18",
        birthday="October 19",
        sign="Libra",
        likes="Ice Cream",
        dislikes="Chocolate Mint",
        description="Academically Empowered, Medically Helpless...",  
        currentThoughts="Study... Study... Study... Study.",
        dateable=False,
        mainChar = False
        #pic="girl a 1.png"
        )   
    $ Francesca = char(
        name="Francesca",  
        bloodType="AB",
        mood="Peacekeeping",
        age="19",
        birthday="March 12",
        sign="Pisces",
        likes="Pulla, Kiisseli",
        dislikes="Salmiakki",
        description="A force of  lawful good... Disciplines any student who violates the Academy's rules.",  
        currentThoughts="Soumi!",
        dateable=False,
        mainChar = False
        #pic="b1.png"
        )   
    
    $ Stefania = char(
        name="Stefania",  
        bloodType="B",
        mood="Programming",
        age="17",
        birthday="September 10",
        sign="Libra",
        likes="Mocnik, Fritaja, Prekmurska gibanica ",
        dislikes="Kislo mleko",
        description="Fairly physical for her type... She's an ACE!",  
        currentThoughts="Oh I can't wait for next spring...",
        dateable=False,
        mainChar = False
        #pic="b1.png"
        )   
        
    $ Angelo = char(
        name="Angelo",  
        bloodType="B",
        mood="Motivated",
        age="19",
        birthday="August 8",
        sign="Leo",
        likes="Women.",
        dislikes="Traps",
        description="Flirt. Adores all the women he sees. Except Stefania.",  
        currentThoughts="I wonder when's the next season of ****** going to show.",
        dateable=False,
        mainChar = False
        #pic="b1.png"
        )   
    
    #these are the characters shown on the screen, you can add more as you meet new people
    $ allchars = [Elisa, Francesca, Stefania, Angelo]
        
    $ affectionMax = 100000 #<-- maximum affection value is changed here
    $ friendshipMax = 100000
    
    $ healthMax = 100000
    $ manaMax = 100000
    
    $ charismaMax = 100000
    $ intelligenceMax = 100000 
    $ stregnthMax = 100000
    $ agilityMax = 100000
    $ stressMax = 100000
    
    $ show_profiles = False
    $ viewing = "Francesca" #<-- the default character to show when the info screen is first called
        
screen profile_screen:
    tag menu
    zorder 10
    # creates a string for proper display of each fact (+some bars) 
    for i in allchars:
        $ char = i
        if viewing == char.name: 
            $ name = "Name: " + char.name
            $ bloodType = "Blood Type: " + char.bloodType
            $ mood = "Mood: " + char.mood
            $ age = "Age: " + char.age
            $ birthday = "Date of Birth: " + char.birthday
            $ sign = "Sign: " + char.sign
            $ likes = "Likes: " + char.likes
            $ dislikes = "Dislikes: " + char.dislikes
            $ description = "\n" + char.description + "\n"
            $ thoughts = "Current Thoughts: \n \"" + char.currentThoughts + "\""
            $ pic = char.pic
            $ mainChar = char.mainChar
            
            $ affectionBar = False
            $ friendshipBar = False
            $ charismaBar = False
            $ intelligenceBar = False
            $ stregnthBar = False
            $ agilityBar = False
            $ healthBar = False
            $ manaBar = False
            $ dessertBar = False
            
            if char.mainChar: 
                ##For the main character
                
                $ affectionBar = False
                $ friendshipBar = False
                
                $ charismaBar = True
                $ intelligenceBar = True
                $ stregnthBar = True
                $ agilityBar = True
                $ dessertBar = True
                $ healthBar = True
                $ manaBar = True
                
            elif char.dateable: ##If you define the main character, change this statement to elif
                $ affectionBar = True
                $ friendshipBar = True
            else:
                $ affectionBar = False
                $ friendshipBar = True
                  
            $ affection = char.affection    
            $ friendship = char.friendship
            $ charisma = char.charisma
            $ intelligence = char.intelligence
            $ stregnth = char.stregnth
            $ agility = char.agility
            $ stress = char.stress
            
            $ health = char.health
            $ mana = char.health

    #actually displays everything          
    frame xminimum 240 xmaximum 240 yminimum ymax: 
        style_group "infoscreen"  
        vbox yalign 0.5 xalign 0.5: 
            for i in allchars:
                #$ textbutton_name, dummy1, dummy2 = i.name.partition(' ') #cuts off the name after the first space
                textbutton i.name action SetVariable("viewing", i.name) xminimum 220 xmaximum 220 yminimum 50   
                #code for future imagebuttons
                #imagebutton idle "i.idlepic" hover "i.hoverpic" action SetVariable("viewing", i.name)
                $ i.normalizeAffection()
                $ i.normalizeFriendship()
                $ i.normalizeHealth()
                $ i.normalizeMana()
                $ i.normalizeCharisma()
                $ i.normalizeIntelligence()
                $ i.normalizeStregnth()
                $ i.normalizeAgility()
                $ i.normalizeStress()
        textbutton "Return" action Return() ypos 0.8
        
    window xanchor 0 xpos 240 yalign 0 xminimum 784 xmaximum 784 yminimum ymax ymaximum ymax:
        style_group "infoscreen"   
        vbox spacing 10: 
            vbox:
                text name
                text bloodType
                if mood != 'Mood: ???':
                    text mood
                    text age
                    text birthday
                    text sign
                vbox xmaximum 500:     
                    text likes
                    text dislikes
                vbox spacing 10 xmaximum 490:  
                    text description 
                    text thoughts            
                    if affectionBar:
                        hbox ypos 0.7:
                            text "Love: "
                            bar value affection range affectionMax style "infoscreen_bar" right_bar "bar_empty.png" left_bar "bar_full-pink.png"
                    if friendshipBar:
                        hbox ypos 0.8:
                            text "Friendship: "  
                            bar value friendship range friendshipMax style "infoscreen_bar" right_bar "bar_empty.png" left_bar "bar_full-purple.png"
                            
                    if mainChar:
                        #if healthbar:
                        hbox ypos 0.7:
                            text "Health: "
                            bar value health range healthMax style "infoscreen_bar" right_bar "bar_empty.png" left_bar "bar_full-red.png"
                        #if manaBar:
                        hbox ypos 0.59:
                            text "Mana: "
                            bar value mana range manaMax style "infoscreen_bar" right_bar "bar_empty.png" left_bar "bar_full-blue.png"
                        #if charismaBar:
                        hbox ypos 0.5:
                            text "Charisma: "
                            bar value charisma range charismaMax style "infoscreen_bar" 
                        #if intelligenceBar:
                        hbox ypos 0.4:
                            text "Intelligence: "
                            bar value intelligence range intelligenceMax style "infoscreen_bar"
                        #if stregnthBar:
                        hbox ypos 0.3:
                            text "Stregnth: "
                            bar value stregnth range stregnthMax style "infoscreen_bar"
                        #if agilityBar:
                        hbox ypos 0.2:
                            text "Agility: "
                            bar value agility range agilityMax style "infoscreen_bar"
                        #if dessertBar:
                        hbox ypos 0.1:
                            text "Stress: "
                            bar value stress range stressMax style "infoscreen_bar"
                                
        if pic != 'none':
            add pic xalign 0.6 yalign 0.0 #Tinker with these numbers as needed to change where the image goes
New Picture (4).png
Personal (R-13) | Now at IndieDB | Circle Cosine's itch.io
I wanna be done.

Mitula
Newbie
Posts: 8
Joined: Sun Mar 10, 2013 1:19 pm
Contact:

Re: Information Screen

#4 Post by Mitula »

Hello, I do not understand how to avoid initialization of variables when the program quits, and when loading.
Could someone help me ?

User avatar
saguaro
Miko-Class Veteran
Posts: 560
Joined: Sun Feb 12, 2012 9:17 am
Completed: Locked-In, Sunrise, The Censor
Organization: Lucky Special Games
itch: saguarofoo
Location: USA
Contact:

Re: Information Screen

#5 Post by saguaro »

Declare the objects after the start label instead of init.

Mitula
Newbie
Posts: 8
Joined: Sun Mar 10, 2013 1:19 pm
Contact:

Re: Information Screen

#6 Post by Mitula »

The problem is that the code that follows, if I removed to put after start label, it make a mistake.

Code: Select all

init python:
    # declares a class called 'char'
    default_var = '???'
    class char:
        #--------------------------VV--------if you want to change how much affection they start with
        def __init__(self, affection=50, name=default_var, bloodType=default_var, major=default_var, age=default_var, birthday=default_var, sign=default_var, likes=default_var, dislikes=default_var, description=default_var, currentThoughts=default_var, dateable=True, pic='none'): #<-- this line sets all the defaults; the only one you'll probably use
            self.affection=affection
            self.name = name
            self.bloodType = bloodType
            self.major = major
            self.age = age
            self.birthday = birthday
            self.sign = sign
            self.likes = likes
            self.dislikes = dislikes
            self.description = description
            self.currentThoughts = currentThoughts
            self.dateable=dateable
            self.pic=pic
            #You can add more areas if you want, just put self. and whatever it is you need
           
        def add_affection(self, amount):
            self.affection += amount
            if self.affection > affectionMax:
                self.affection = affectionMax
               
        def normalize(self):
            if self.affection > affectionMax:
                self.affection = affectionMax
            if self.affection < 0:
                self.affection = 0
                

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1237
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, An Encounter ~In The Rain~, A Piece of Sweetness, Since When Did I Have a Combat Butler?!, Piece by Piece, +many more
Projects: Fateful Encounter, Operation: Magic Hero
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: Information Screen

#7 Post by Kokoro Hane »

I have a question; is there any way for the text stored in the currentThoughts to actually stay?

For example, the default when you start the game is the character smiling, with thoughts saying "Ready to be ambitious!"
Randomly, throughout the game, I have programmed her thoughts and expressions to change. However, when I load the saved game again, the info screen information returns back to what I typed in for the default. Is there a way to fix that?
PROJECTS:
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Information Screen

#8 Post by apricotorange »

Try declaring your characters after "label start" instead of in an "init python" block? Declaring objects in an init python block, then mutating them, is generally a bad idea: the save system doesn't notice the variable has changed, and discards it.

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1237
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, An Encounter ~In The Rain~, A Piece of Sweetness, Since When Did I Have a Combat Butler?!, Piece by Piece, +many more
Projects: Fateful Encounter, Operation: Magic Hero
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: Information Screen

#9 Post by Kokoro Hane »

apricotorange wrote:Try declaring your characters after "label start" instead of in an "init python" block? Declaring objects in an init python block, then mutating them, is generally a bad idea: the save system doesn't notice the variable has changed, and discards it.
Do you mean the second part of the code, where all my defaults are set? (That one, I currently have in its own script)
I tried it with the first one, and it won't work, so I am guessing it's the second half of the code, right?
PROJECTS:
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Information Screen

#10 Post by apricotorange »

I mean the lines like "$ girl = char(".

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1237
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, An Encounter ~In The Rain~, A Piece of Sweetness, Since When Did I Have a Combat Butler?!, Piece by Piece, +many more
Projects: Fateful Encounter, Operation: Magic Hero
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: Information Screen

#11 Post by Kokoro Hane »

apricotorange wrote:I mean the lines like "$ girl = char(".
Ah, I see! I am going to try it

EDIT: Now the default thoughts are permanent and do not change anymore...
PROJECTS:
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Information Screen

#12 Post by apricotorange »

"default thoughts are permanent"? That's strange... I'm not sure what could cause that.

H.S.
Newbie
Posts: 8
Joined: Fri Aug 10, 2012 4:55 am
Location: Russia
Contact:

Re: Information Screen

#13 Post by H.S. »

Show you how to make an information screen characters are added as they are added to the game? That is, to hide the anyone who has not yet appeared on the scene.

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Information Screen

#14 Post by apricotorange »

The "allchars" variable controls which characters are visible on the information screen.

User avatar
Reikun
Miko-Class Veteran
Posts: 565
Joined: Tue Dec 20, 2011 9:57 pm
Completed: Mnemonic Devices, Ciikos Bridge, Helena's Flowers, The Madness
Projects: Fox in the Hollyhocks
Organization: skyharborr
itch: skyharborr
Contact:

Re: Information Screen

#15 Post by Reikun »

I've been trying to figure out how to modify this code so that every time you view the info screen a random character is displayed. I've tried

Code: Select all

$ viewing = renpy.random.choice(names)
"names" being a variable that's a list of all the char.name values. What I get is a traceback telling me

Code: Select all

AttributeError: 'NoneType' object has no attribute 'random'
Not sure where to go from here (.__.) Any help is appreciated!

Edit: Solved! :D I shouldn't be using random.choice under an init, haha;;
Last edited by Reikun on Fri Oct 11, 2013 11:42 pm, edited 1 time in total.
ImageImageImage

fastest way to contact me: DM @skyharborr on twitter

Post Reply

Who is online

Users browsing this forum: No registered users