'NoneType' object has no attribute 'style'[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
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

'NoneType' object has no attribute 'style'[SOLVED]

#1 Post by TellerFarsight »

I'm trying to make units move around, and I'm trying to do it by calling labels. Here's the relevant parts of my code, and Kazuya.place = 1 at initialization. The problem is that when I get down to the "Place 1" and "Place 2" buttons, clicking on one gives the error
'NoneType' object has no attribute 'style'
but I'm not sure where the 'NoneType' object is. The 'None' value created by clicking the "Move" button is for the transition of the screen, and is not the problem here. The error only happens when I click the "Place 1" and "Place 2" buttons.

Code: Select all

screen your_turn(unit,name):
    modal True
    vbox:
        imagebutton auto "gui/Battle/phase_button_%s.png" action [SensitiveIf(unit.move_flag), Show("where_you_goin",None,unit,name), Hide("your_turn")]
        imagebutton auto "gui/Battle/phase_button_%s.png" action [SensitiveIf(unit.attack_flag), Show("choose_your_battles",None,unit,name), Hide("your_turn")]
        imagebutton auto "gui/Battle/phase_button_%s.png" action Return()
    vbox:
        text "Move"
        text "Attack"
        text "End"

screen where_you_goin(unit,name):
    modal True
    vbox:
        text "I exist!"
        if unit.place == 2:
            textbutton "Place 1" action Function(renpy.call, name + "_place1",unit,name)
        if unit.place == 1:
            textbutton "Place 2" action Function(renpy.call, name + "_place2",unit,name)

label Kazuya_place2(unit,name):
    # displayables move and stuff
    $ Kazuya.place = 2
    $ Kazuya.move_flag = False
    call screen your_turn(unit,name)
    return

label and_stuff:
    $ Kazuya.move_flag = False
    $ Kazuya.attack_flag = True
    call screen your_turn(Kazuya,"Kazuya")
    # and so on
Last edited by TellerFarsight on Thu Sep 14, 2017 10:28 pm, edited 1 time in total.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: 'NoneType' object has no attribute 'style'

#2 Post by philat »

...why are you trying to "move units" using labels? Why not just use ATL?

In any case, this doesn't seem to give enough of the picture to know what the error is.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: 'NoneType' object has no attribute 'style'

#3 Post by TellerFarsight »

Okay. I found the error. It was in a transform in the Kazuya_place2 label that I forgot I added in.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]