[SOLVED] 'bool' object is not iterable error

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
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

[SOLVED] 'bool' object is not iterable error

#1 Post by isobellesophia »

Hi!

I have a small problem while i was coding my vn.

And i have a error when i was about to test it in physically,

After i read the dialogue, the error appears. (I cant show the error because forgot to move the traceback error)

It was just a simple dialogue.

This is in my script.rpy

Code: Select all

 scene bg classroomnoon 1
    with flashbulb
    
    $ persistent.unlock_55 = True
    $ persistent.unlock_55 = False
    
    "Wohoo! Finally class is over." <---- After i read this dialogue, an error will appear.
    
    $ persistent.flowersbloom = False
Did i do something wrong? :?

I know about persistent data, (i use persistent data alot, especially galleries and etc..)

Is there something wrong i gave the code above?

Plus, i did a persistent code like, $ persistent.finaseen = False before starting the game, but i didn't put that persistent in true after reading that dialogue.

Maybe i did wrong IS putting $ persistent.finaseen = False before starting the game, and after that, i putted $ persistent.finaseen = True somewhere in the code?
Last edited by isobellesophia on Fri Feb 01, 2019 2:56 am, edited 1 time in total.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: 'bool' object is not iterable error

#2 Post by Karl_C »

Can you post the contents of "errors.txt"?

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 'bool' object is not iterable error

#3 Post by Imperf3kt »

what you need before the start label is a "default" statement, not a python $
Example:

Code: Select all

default persistent.flowersbloom = False

label start:
instead of

Code: Select all

$ persistent.flowersbloom = False

label start:
Also, this

Code: Select all

    $ persistent.unlock_55 = True
    $ persistent.unlock_55 = False
does absolutely nothing, you first set a variable true, but then you immediately set it false.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#4 Post by isobellesophia »

Ooohhh.. i seee that, thanks for the advice! :D

I'll try that later on! :)


Edit: also you've been talking about putting my persistent data to True and again False, i was testing it for my gallery code fo unlocking. :P :P
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#5 Post by isobellesophia »

Hi again! still an error, i did this though.

Code: Select all

default persistent.finaseen = False
default persistent.unlock_55 = False

# The game starts here.

label start:
    
    #Did the game beat the first part?
    $ mp.beat_part_1 = False
    
    #Defining the choices. Let the choice True?
    $ go = False
    $ dontgo = False
    $ share = False
    $ dontshare = False
    
    scene day1 load
    with dissolve
    $ renpy.pause (3.0, hard=True)
    
    scene day1 ctc
    $ renpy.pause ()

    define flashbulb = Fade(0.2, 0.0, 0.8, color='#fff')

    scene bg classroomnoon 1
    with flashbulb
    
    $ persistent.unlock_55 = True
    
    "Wohoo! Finally class is over."
What should i do about this?

the error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 564, in script
    "Wohoo! Finally class is over."
TypeError: 'bool' object is not iterable

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

Full traceback:
  File "game/script.rpy", line 564, in script
    "Wohoo! Finally class is over."
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\ast.py", line 678, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\exports.py", line 1229, in say
    who(what, *args, **kwargs)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 1039, in __call__
    self.do_done(who, what)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 811, in do_done
    self.add_history("adv", who, what, multiple=multiple)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 1130, in add_history
    for i in renpy.config.history_callbacks:
TypeError: 'bool' object is not iterable

Windows-7-6.1.7601-SP1
Ren'Py 7.1.3.1092
Elementary School: Choices 1.8 beta
Thu Jan 31 20:26:17 2019

Although, the persistent data came from the class book like, "Schedule" to unlock.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: 'bool' object is not iterable error

#6 Post by Karl_C »

Put "define flashbulb = Fade(0.2, 0.0, 0.8, color='#fff')" outside label start (together with your defaults)

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 'bool' object is not iterable error

#7 Post by Imperf3kt »

I think the error is this line:

Code: Select all

define flashbulb = Fade(0.2, 0.0, 0.8, color='#fff')
place it before the start label, should take care of the issue.

Additionally, all your variables really should use define or default (if they will change) before the start label, the same way you did to the persistent data.

Code: Select all

    #Did the game beat the first part?
    $ mp.beat_part_1 = False
    
    #Defining the choices. Let the choice True?
    $ go = False
    $ dontgo = False
    $ share = False
    $ dontshare = False
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#8 Post by isobellesophia »

Sorry for this but, i did put my defaults before the label start.

Code: Select all

$ mp.beat_part_1 = False    
    
default persistent.unlock_55 = False
default persistent.unlock_44 = False
default persistent.unlock_45 = False
default persistent.unlock_22 = False
default persistent.unlock_41 = False
default persistent.unlock_23 = False
default persistent.unlock_32 = False
default persistent.unlock_25 = False
default persistent.unlock_24 = False
default persistent.finaseen = False
default persistent.tiffanyseen = False
default persistent.maddoxseen = False
default persistent.topazseen = False
default persistent.jasperseen = False

define flashbulb = Fade(0.2, 0.0, 0.8, color='#fff')

# The game starts here.

label start:
    scene day1 load
    with dissolve
    $ renpy.pause (3.0, hard=True)
    
    scene day1 ctc
    $ renpy.pause ()

    scene bg classroomnoon 1
    with flashbulb
    
    $ persistent.unlock_55 = True
    
    "Wohoo! Finally class is over."

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 562, in script
    "Wohoo! Finally class is over."
TypeError: 'bool' object is not iterable

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

Full traceback:
  File "game/script.rpy", line 562, in script
    "Wohoo! Finally class is over."
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\ast.py", line 678, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\exports.py", line 1229, in say
    who(what, *args, **kwargs)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 1039, in __call__
    self.do_done(who, what)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 811, in do_done
    self.add_history("adv", who, what, multiple=multiple)
  File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 1130, in add_history
    for i in renpy.config.history_callbacks:
TypeError: 'bool' object is not iterable

Windows-7-6.1.7601-SP1
Ren'Py 7.1.3.1092
Elementary School: Choices 1.8 beta
Thu Jan 31 21:42:03 2019
Still showing the error :|
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: 'bool' object is not iterable error

#9 Post by Karl_C »

Code: Select all

File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 811, in do_done
    self.add_history("adv", who, what, multiple=multiple)
File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 1130, in add_history
    for i in renpy.config.history_callbacks:
Try this one just to check if the error disappears:

Code: Select all

    "Wohoo! Finally class is over."
    $ persistent.unlock_55 = True
Just curious: Why do you set "persistent.unlock_55 = True" without any condition anyway?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: 'bool' object is not iterable error

#10 Post by Remix »

Search your project for history_callbacks (especially if you have added any cookbook or drop-in library) ... It should be a list of functions.

Perhaps also try a print(config.history_callbacks) and check the console lines prior to the error.
Frameworks & Scriptlets:

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: 'bool' object is not iterable error

#11 Post by Alex »

Just a shot in the dark, but don't you have a variable named "narrator" or "interact"?

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#12 Post by isobellesophia »

Karl_C wrote: Thu Jan 31, 2019 12:00 pm

Code: Select all

File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 811, in do_done
    self.add_history("adv", who, what, multiple=multiple)
File "C:\Users\Client\Downloads\renpy-7.1.3-sdk\renpy\character.py", line 1130, in add_history
    for i in renpy.config.history_callbacks:
Try this one just to check if the error disappears:

Code: Select all

    "Wohoo! Finally class is over."
    $ persistent.unlock_55 = True
Just curious: Why do you set "persistent.unlock_55 = True" without any condition anyway?
Hi! It's because, when i showed an image for the first time, it will unlock right after the image shows, unlock_55 unlocks one images to the gallery.

So.. that means.. the code you gave above..
I will replace the persistent.unlock_55, right after a dialogue finishes?
I think that'll work.. :roll:
Last edited by isobellesophia on Thu Jan 31, 2019 10:24 pm, edited 1 time in total.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#13 Post by isobellesophia »

Remix wrote: Thu Jan 31, 2019 12:30 pm Search your project for history_callbacks (especially if you have added any cookbook or drop-in library) ... It should be a list of functions.

Perhaps also try a print(config.history_callbacks) and check the console lines prior to the error.
Yes, i added a cookbook like.. Extra screen with gallery, achivements, and an replay scene.
This is the extra gallery i added.

Code: Select all

init python:
    mg= MusicRoom()
    mg.add("open door.ogg", always_unlocked=True)
    mg.add("close door.ogg")
    
    
    x = Gallery()
And

Code: Select all

default awards=[
    ["Real Ending","Beat the most real ending in this real game. And congrats!","persistent.endingreal1==True"]]

Code: Select all

screen scenegallery():
    tag menu
    use exgame_menu(scroll="viewport"):
        grid 1 12:
            style_prefix "gslot"
            xalign 0.5
            yalign 0.5
            spacing gui.slot_spacing
            ## scene 1
            if persistent.flowersbloom:
                textbutton "Flowers do bloom" action Jump("flowersbloom")
            else:
                text "The sub story is not unlocked yet."
And like a school book, it contains a persistent, just when playing normally an list will unlock in the school book./ And last, the info screen where i can unlock the characters infos when met.

Like,

Code: Select all

screen infonavi():
    vbox:
        style_prefix "navigation"
        xpos gui.navigation_xpos
        yalign 0.5
        spacing gui.navigation_spacing
        if persistent.finaseen:
            textbutton _("Fina") action ShowMenu("finainfo")
And

Code: Select all

screen finainfo():
    tag menu
    use infogame_menu(scroll="viewport"):
        vbox:
            xalign 0.5
            yalign 0.5
            if persistent.finaseen:
                text "Name: Fina Summer"
Lastly

Code: Select all

screen booknavi():
    vbox:
        style_prefix "navigation"
        xpos gui.navigation_xpos
        yalign 0.5
        spacing gui.navigation_spacing
        if persistent.schoolrules:
            textbutton _("The School Rules") action ShowMenu("schoolrules")
            
screen schoolrules():
    tag menu
    use bookgame_menu(scroll="viewport"):
        vbox:
            xalign 0.5
            yalign 0.5
            if persistent.schoolrules:
                text "Test"
Im not really good at this though :roll:
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#14 Post by isobellesophia »

Alex wrote: Thu Jan 31, 2019 4:48 pm Just a shot in the dark, but don't you have a variable named "narrator" or "interact"?
I defined narrator in the characters, yes.

But i didn't add interact..
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: 'bool' object is not iterable error

#15 Post by isobellesophia »

HMMM.. NEVEMIND.

lol it was the

define config.renpy.callbacks = True

after all.. (Sigh.. what a waste of time.)


By the way, thanks for all your help guyz, really cool.
I am a friendly user, please respect and have a good day.


Image

Image


Post Reply

Who is online

Users browsing this forum: No registered users