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

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
Fatimah
Regular
Posts: 94
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

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

#1 Post by Fatimah »

Hello,

Could someone help me with this error?
I have this screen with image buttons that changes the value of Boolean variables. The code works great until I try to exit the game while the screen is called.

The screen is being called here:

Code: Select all

$ ladysmantles = True
$ redrobin = True
while ladysmantles or redrobin:
                       call screen shelf
                       
                       if _return == "ladysmantles":
                           
                           if redrobin == True:
                               show redrobinShelf
                           else:
                               show emptyShelf
                               
                           jawad_serious "لقد وجدتك!"
                           show ladysmantles with zoomin
                           $ renpy.pause(1, hard=True)
                      
                           hide ladysmantles with zoomout
        
                           $inventory.add(ladysmantlesIcon)
                           
                           hide redrobinShelf
                           hide emptyShelf
                           
                       elif _return == "redrobin":
                           
                           if ladysmantles == True:
                               show ladysmantlesShelf
                           else:
                               show emptyShelf
                           
                           jawad_serious "عشبةٌ ذات ساقٍ أحمر."
                           
                           show redrobin with zoomin
                           $ renpy.pause(1, hard=True)
                      
                           hide redrobin with zoomout
        
                           $inventory.add(redrobinIcon)
                           
                           hide ladysmantlesShelf
                           hide emptyShelf
This is the screen code:

Code: Select all

screen shelf:
    add "emptyShelf.jpg"
    
    if ladysmantles:
        imagebutton idle "ladysmantlesImagebutton.png" hover "ladysmantlesImagebutton.png" xpos 1069 ypos 693 action [Return("ladysmantles"), ToggleVariable("ladysmantles", False)] mouse "imagemap"
    if redrobin:
        imagebutton idle "redrobinImagebutton.png" hover "redrobinImagebutton.png" xpos 267 ypos 131 action [Return("redrobin"), ToggleVariable("redrobin", False)] mouse "imagemap"
    
    hbox align (.95,.04) spacing 20:
        imagebutton idle "backpack.png" hover "backpack.png" action Show("inventory_screen")
This is the error I'm getting, I get this error when I reach the "Are you sure you want to go back to the main menu?" screen and I click Yes:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00action_data.rpy", line 168, in get_selected
    rv = getattr(self.object, self.field)
AttributeError: 'StoreModule' object has no attribute 'ladysmantles'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\ast.py", line 814, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\python.py", line 1695, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 30, in <module>
    ui.interact()
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2492, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2759, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 482, in visit_all
    d.visit_all(callback)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 482, in visit_all
    d.visit_all(callback)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 482, in visit_all
    d.visit_all(callback)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 482, in visit_all
    d.visit_all(callback)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\screen.py", line 403, in visit_all
    self.child.visit_all(callback)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 482, in visit_all
    d.visit_all(callback)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 484, in visit_all
    callback(self)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2759, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 788, in per_interact
    if self.is_selected():
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 778, in is_selected
    return is_selected(self.action)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 356, in is_selected
    return any(is_selected(i) for i in action)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 356, in <genexpr>
    return any(is_selected(i) for i in action)
  File "C:\Users\Fatimah\Desktop\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 359, in is_selected
    return action.get_selected()
  File "renpy/common/00action_data.rpy", line 168, in get_selected
    rv = getattr(self.object, self.field)
AttributeError: 'StoreModule' object has no attribute 'ladysmantles'

Windows-8-6.2.9200
Ren'Py 6.99.12.2.2029
Any thoughts on this?
Thanks
Last edited by Fatimah on Tue Jan 10, 2017 2:31 am, edited 1 time in total.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: AttributeError: 'StoreModule' object has no attribute

#2 Post by nyaatrap »

Did you defined, or defaulted variables before start?
Variables that is used in screens (and transforms, styles, anything other than label) need to be declared by define or default statement.

Fatimah
Regular
Posts: 94
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: AttributeError: 'StoreModule' object has no attribute

#3 Post by Fatimah »

nyaatrap wrote:Did you defined, or defaulted variables before start?
Variables that is used in screens (and transforms, styles, anything other than label) need to be declared by define or default statement.
I didn't know that & it did solve my problem.
Thank you so much!

HiddenLife
Newbie
Posts: 16
Joined: Wed Sep 09, 2020 8:10 pm
Contact:

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

#4 Post by HiddenLife »

I had the same problem, but the reason is slightly different. I explain it for anyone who comes over this conversation looking for a solution.

Basically I had created an inventory, created the game and made some saves.
After that, I decided to rework the inventory from scratch. From that moment on, whatever I did, it kept coming out

Code: Select all

AttributeError: 'StoreModule' object has no attribute 'Inventory'
After countless attempts, I found that it was enough to simply recreate the saves from scratch and play the game form the start at least once, and everything worked fine, instead of using the ones I had made when I had the old version of the inventory.

I hope I was helpful.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]