ignoring classes?

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
lovebby
Regular
Posts: 106
Joined: Mon Sep 09, 2013 12:24 am
Deviantart: lovebby
Contact:

ignoring classes?

#1 Post by lovebby »

I feel really silly not being able to understand what's happening, but I can't get renpy to recognize my class?

Code: Select all

init python:
    class Human(object):
        def __init__(self, name, village, strength, charisma, endurance,knowledge):
            self.name = name
            self.village = village
            self.Strength = strength
            self.charisma = charisma
            self.endurance = kndurance
            self.knowledge = knowledge
            "hello"
    p1 = Human("Alder", "Gorondel", 4, 5, 3, 1)
    p2 = Human("Donley", "Forton", 10, 7, 1, 1)
and in the script I have

Code: Select all

    sub"[p2.name] lives at [p2.village] and has [p2.strength] strength."
but it keeps printing exactly as it is in there, and when I chek the variables, no class is defined.
what am I missing?

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: ignoring classes?

#2 Post by hell_oh_world »

lovebby wrote: Sun May 03, 2020 10:54 am I feel really silly not being able to understand what's happening, but I can't get renpy to recognize my class?

Code: Select all

init python:
    class Human(object):
        def __init__(self, name, village, strength, charisma, endurance,knowledge):
            self.name = name
            self.village = village
            self.Strength = strength
            self.charisma = charisma
            self.endurance = kndurance
            self.knowledge = knowledge
            "hello"
    p1 = Human("Alder", "Gorondel", 4, 5, 3, 1)
    p2 = Human("Donley", "Forton", 10, 7, 1, 1)
and in the script I have

Code: Select all

    sub"[p2.name] lives at [p2.village] and has [p2.strength] strength."
but it keeps printing exactly as it is in there, and when I chek the variables, no class is defined.
what am I missing?

Code: Select all

init python:
    class Human(object):
        def __init__(self, name, village, strength, charisma, endurance,knowledge):
            self.name = name
            self.village = village
            self.Strength = strength
            self.charisma = charisma
            self.endurance = kndurance
            self.knowledge = knowledge
            "hello"
            
default p1 = Human("Alder", "Gorondel", 4, 5, 3, 1)
default p2 = Human("Donley", "Forton", 10, 7, 1, 1)

label start:
	"[p1.name]"

User avatar
lovebby
Regular
Posts: 106
Joined: Mon Sep 09, 2013 12:24 am
Deviantart: lovebby
Contact:

Re: ignoring classes?

#3 Post by lovebby »

Ah silly me! Thanks so much its working again!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]