AttributeError: 'StoreModule' object has no attribute 'D' [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.
Post Reply
Message
Author
User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

AttributeError: 'StoreModule' object has no attribute 'D' [SOLVED]

#1 Post by Luxliev »

Why this doesn't work? I can't change class variables with SetVariable?

Code: Select all

init python:
    class Cls:
        def __init__(self, name):
            self.n = name
    
    a = Cls("D")

screen butt:
    textbutton "[a.n]":
        action SetVariable(a.n, "C")
        # action Function(write_to_class, "C")

label start:
    show screen butt
    "Hello, world."

    return
Only way I can make it work is through function:

Code: Select all

    def write_to_class(stuff):
        a.n = stuff
Last edited by Luxliev on Wed Aug 23, 2017 9:34 am, edited 1 time in total.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

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

Re: AttributeError: 'StoreModule' object has no attribute 'D'

#2 Post by xela »

Like what we're doing? Support us at:
Image

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: AttributeError: 'StoreModule' object has no attribute 'D'

#3 Post by Luxliev »

Thanks for answer it works great.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

Post Reply

Who is online

Users browsing this forum: No registered users