Gallery (multiple images on the same button) [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
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Gallery (multiple images on the same button) [solved]

#1 Post by rinrin »

I'm having problems with the Gallery code (and I'm not even on the unlocking / persistent stage yet, just putting all the CGs in there). It works if I'm only showing one image per button, but things fall apart if I try to implement this part:

Code: Select all

    # This button has multiple images assocated with it. We use unlock_image
    # so we don't have to call both .image and .unlock. We also apply a
    # transform to the first image.
    g.button("dark")
    g.unlock_image("bigbeach1")
    g.transform(slowpan)
    g.unlock_image("beach1 mary")
    g.unlock_image("beach2")
    g.unlock_image("beach3")
All I changed was the transition (slowpan -> dissolve) and the names and number of images:

Code: Select all

    g.button("proposal")
    g.unlock_image("proposal1") 
    g.transform(dissolve)
    g.unlock_image("proposal2")
...and it doesn't work. I get this error:

Code: Select all

AttributeError: 'str' object has no attribute 'visit_all'
Last edited by rinrin on Mon Jul 23, 2012 1:16 am, edited 1 time in total.

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Gallery (multiple images associated with the same button

#2 Post by rinrin »

Does anybody have any ideas how to fix this?

Or, alternatively, did anybody manage to implement that particular feature of the gallery (multiple images) successfully? If so, how does your code differ from mine? (Seeing an example of this that actually works would be ideal.)

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

Re: Gallery (multiple images associated with the same button

#3 Post by Alex »

Not so much help, but look at the line that has "visit_all" - smth is wrong with it definitely. (does it have quotes?)

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Gallery (multiple images associated with the same button

#4 Post by rinrin »

Alex wrote:Not so much help, but look at the line that has "visit_all" - smth is wrong with it definitely. (does it have quotes?)
I'm not even sure which line is causing this. Here's the full traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
AttributeError: 'str' object has no attribute 'visit_all'

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

Full traceback:
  File "D:\nekomura-production\renpy-6.13.12\renpy\execution.py", line 265, in run
  File "D:\nekomura-production\renpy-6.13.12\renpy\ast.py", line 632, in execute
  File "D:\nekomura-production\renpy-6.13.12\renpy\python.py", line 972, in py_exec_bytecode
  File "common/00library.rpy", line 625, in <module>
  File "D:\nekomura-production\renpy-6.13.12\renpy\ui.py", line 237, in interact
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 1803, in interact
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 2329, in interact_core
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\layout.py", line 714, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\layout.py", line 714, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\layout.py", line 714, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\screen.py", line 300, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\layout.py", line 714, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\layout.py", line 174, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\behavior.py", line 627, in event
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\behavior.py", line 211, in run
  File "D:\nekomura-production\renpy-6.13.12\renpy\curry.py", line 38, in __call__
  File "D:\nekomura-production\renpy-6.13.12\renpy\game.py", line 289, in invoke_in_new_context
  File "common/00gallery.rpy", line 105, in show
  File "common/00gallery.rpy", line 80, in show
  File "D:\nekomura-production\renpy-6.13.12\renpy\ui.py", line 237, in interact
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 1803, in interact
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 2041, in interact_core
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 246, in visit_all
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 246, in visit_all
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 246, in visit_all
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 246, in visit_all
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 248, in visit_all
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 2041, in <lambda>
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\screen.py", line 155, in per_interact
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\screen.py", line 255, in update
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 246, in visit_all
  File "D:\nekomura-production\renpy-6.13.12\renpy\display\core.py", line 246, in visit_all
AttributeError: 'str' object has no attribute 'visit_all'

Windows-7-6.1.7601-SP1
Ren'Py 6.13.12.1728

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

Re: Gallery (multiple images associated with the same button

#5 Post by Alex »

Which line of your code has "visit_all"? I didn't see one in first post.

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Gallery (multiple images associated with the same button

#6 Post by rinrin »

None. I think "visit_all" must be a part of Ren'Py itself. (Just to confirm it, I did a global search and indeed, my code doesn't contain this.)

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

Re: Gallery (multiple images associated with the same button

#7 Post by Alex »

Then - "oops", I suppose... :oops:

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Gallery (multiple images associated with the same button

#8 Post by rinrin »

Thanks anyway!

If nobody can help with this I'll probably have to write my own gallery code from scratch... but it won't be a very elegant solution so I'm still hoping somebody out there knows how to make this work.

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

Re: Gallery (multiple images associated with the same button

#9 Post by Alex »

The problem is in <g.transform(dissolve)> - looks like only transforms can be used here (not transitions), so change it a bit

Code: Select all

transform my_dissolve:
    alpha .0
    linear 0.5 alpha 1.0

code code code

    g.transform(my_dissolve)

code code code

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Gallery (multiple images associated with the same button

#10 Post by rinrin »

Alex wrote:The problem is in <g.transform(dissolve)> - looks like only transforms can be used here (not transitions)
I completely missed that (even referred to it as "transition" in the first post)... :oops:
Alex wrote:

Code: Select all

transform my_dissolve:
 alpha .0
 linear 0.5 alpha 1.0

code code code

 g.transform(my_dissolve)

code code code
This works, thank you! :D

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], RewindTheGame