'NoneType' object has no attribute add

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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

'NoneType' object has no attribute add

#1 Post by Kinmoku »

Hi all,

I've come across a bug. I've attached the error report.

On exploration.rpy line 572 and 573, it adds a persistent item. This is for the Steam achievement "True Detective" where you have to click on every item in the game.

Code: Select all

    elif result == "phone":    
        if "phonetable" in found:
            t "What else is here?"
            
        else:
            $ found.append("phonetable")
            python: # line 572
                persistent.itemcount.add("phone") # line 573
Every item has something similar to this, but "phone" in particular seems to be bugging the most. Could it be that I have used "phone" twice? Unfortunately, I cannot recreate the bug myself so I'm not so sure.

In script.rpy:

Code: Select all

label splashscreen:

    python:
        if type(persistent.itemcount) is not set:
             persistent.itemcount = set(persistent.itemcount)

Code: Select all

init:
    define persistent.itemcount = set( )
Or, could this bug just be because my tester is testing the Steam build outside of Steam, where achievements won't work? I'd like to understand.

After an exploration, you return and this code is present (to register if you have looked at everything):

Code: Select all

    if len(persistent.itemcount) == 31:
        $achievement.grant("detective")
        init:
            $achievement.register("detective")
I appreciate any help :)
Attachments
One Night Stand_2017-08-20_04-26-02.png

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: 'NoneType' object has no attribute add

#2 Post by PyTom »

You probably want:

Code: Select all

default persistent.itemcount = set()
This error makes it seem to me persistent.itemcount is not being initialized properly.
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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: 'NoneType' object has no attribute add

#3 Post by Kinmoku »

PyTom wrote: Thu Aug 24, 2017 1:27 am You probably want:
CODE: SELECT ALL
default persistent.itemcount = set()
This error makes it seem to me persistent.itemcount is not being initialized properly.
Thanks Tom! I'll try this instead :)

Post Reply

Who is online

Users browsing this forum: No registered users