[SOLVED] Displaying Image Function Positioning

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
Westeford
Regular
Posts: 151
Joined: Mon Jun 19, 2017 4:43 pm
Completed: 12 Hours to Die
Projects: Project Premonition
itch: westeford
Location: United States
Contact:

[SOLVED] Displaying Image Function Positioning

#1 Post by Westeford » Thu Feb 14, 2019 2:52 pm

I have a set of images that go in and out the same way. This is what I did before.

Code: Select all

    play sound shoop_in
    show field 01 at holdleft
    with dissolveleft
It adds a lot of unneeded code to the project. So I created a function to do that. Everything is working except for the image positioning. (at holdleft)

Current working code:

Code: Select all

init python:
    def shoop(image):
        renpy.sound.play("sfx/shoop_in.ogg") #play sound
        renpy.show(image) #Show image
        renpy.with_statement(dissolveleft) #with dissolveleft

label start:
    $ shoop("field 01") 
    "test"
Like I said, this works perfectly, except for the transform necessary. I read in the documentation that the statement equivalent of at is at_list=. You can see it here.
https://www.renpy.org/doc/html/statemen ... renpy.show

So I thought I should do the following

Code: Select all

init python:
    def shoop(image):
        renpy.sound.play("sfx/shoop_in.ogg")
        renpy.show(image, at_list=holdleft) #Added ,at_list=holdleft
        renpy.with_statement(dissolveleft)

label start:
    $ shoop("field 01") 
    "test"
However, I get this

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/chapter2.rpy", line 117, in script
    $ shoop_in("field 01")
  File "game/chapter2.rpy", line 117, in <module>
    $ shoop_in("field 01")
  File "game/trialscreens.rpy", line 545, in shoop
    renpy.show(image)
TypeError: 'Curry' object is not iterable
I've tried putting "holdleft" in quotes. I tried replacing it with another transform. I'm confused, I don't know what I am doing wrong.

This is what holdleft is:

Code: Select all

init:
    $ holdleft = Position(xalign=0.05, yalign=0.5)
Any suggestions are appreciated. Thank you for your time.
Last edited by Westeford on Fri Feb 15, 2019 12:30 am, edited 1 time in total.

strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Displaying Image Function Positioning

#2 Post by strayerror » Thu Feb 14, 2019 7:50 pm

You're on the right track, but at_list is expecting an iterable type. In python that's typically a list or a tuple (although there are others). I've not had a chance to test this, but I believe you just need to wrap holdleft in a list. Here's a before and after:

Code: Select all

        renpy.show(image, at_list=holdleft)   # original
        renpy.show(image, at_list=[holdleft]) # using a list

User avatar
Westeford
Regular
Posts: 151
Joined: Mon Jun 19, 2017 4:43 pm
Completed: 12 Hours to Die
Projects: Project Premonition
itch: westeford
Location: United States
Contact:

Re: Displaying Image Function Positioning

#3 Post by Westeford » Fri Feb 15, 2019 12:31 am

strayerror wrote:
Thu Feb 14, 2019 7:50 pm
You're on the right track, but at_list is expecting an iterable type. In python that's typically a list or a tuple (although there are others).

Code: Select all

        renpy.show(image, at_list=[holdleft]) # using a list
Worked like a charm. Thank you very much.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]