expected 'comma or end of line' not found when defining an image

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
neutrino
Newbie
Posts: 12
Joined: Thu Mar 09, 2023 3:29 pm
Completed: Mignyan Meetup
Projects: Holy Incineration / What Dwells / TEN / motherboard.
Deviantart: amalgambite
itch: amalgambite
Location: south usa
Discord: amalgam8 [do not frq without letting me know here first]
Contact:

expected 'comma or end of line' not found when defining an image

#1 Post by neutrino »

hii! this is probably gonna be a really simple answer but im having trouble with an image i'm trying to define and i'm not sure what to do to fix it

background deets are as follows:
  • i'm defining all of my images & transformations in separate .rpy files rather than just in the script file itself
  • i've made separate folders for different sets of my games images for ease of organizing, therefore all of my images in the image defining file are structured like "/foldername/file.png"
  • i'm trying to make an image consisting of a foreground and background separated out. the offending line is the background image

pictured below are my error message and the code i currently have. "sky" is a transition i made to make the clouds of the bg move a little bit. i was wondering if it might be that im trying to use a transition within a defined image, but removing that and trying to define movement manually didn't do anything to help so i'm not quite sure how i could fix that if thats the issue :?

Image

Image
creature made of nerves, and flesh, and other things - maybe

deviantart
twitter
itch
weebly

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: expected 'comma or end of line' not found when defining an image

#2 Post by m_from_space »

neutrino wrote: Sun Mar 17, 2024 3:00 am hii! this is probably gonna be a really simple answer but im having trouble with an image i'm trying to define and i'm not sure what to do to fix it
You cannot put the keyword "at" inside an image definition, it's used inside screens and when showing images.

If you want to apply a transform you can do:

Code: Select all

image airplane = At("airplane2", sky)
Also, if you write multiple lines of images inside an image definition, only the last line will apply, since it overwrites the former images. Multiple images are only useful as part of an animation, like that:

Code: Select all

image airplane:
    "airplane1"
    pause 1.0
    "airplane2"
If you want to have a layered image, you need to create it in this way: https://www.renpy.org/doc/html/layeredimage.html

edit:
Or you could also use a composite image: https://www.renpy.org/doc/html/displaya ... #Composite

Code: Select all

image airplane = Composite((800, 600), (0, 0), "airplane1", (0, 0), At("airplane2", sky))

User avatar
neutrino
Newbie
Posts: 12
Joined: Thu Mar 09, 2023 3:29 pm
Completed: Mignyan Meetup
Projects: Holy Incineration / What Dwells / TEN / motherboard.
Deviantart: amalgambite
itch: amalgambite
Location: south usa
Discord: amalgam8 [do not frq without letting me know here first]
Contact:

Re: expected 'comma or end of line' not found when defining an image

#3 Post by neutrino »

oh i totally forgot about layered images, i think ive only used those like once HEJLP., THANK YOU!!
another thing im wondering, can layered images only use at statements for transitions if the transition is in the same .rpy file as the image is? my previous usage of a layered image had an at statement on one of the images for a custom motion i made and that worked fine, but when i try to do the same thing here it still doesnt work so im assuming its a thing of where im defining my transitions..
creature made of nerves, and flesh, and other things - maybe

deviantart
twitter
itch
weebly

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: expected 'comma or end of line' not found when defining an image

#4 Post by m_from_space »

neutrino wrote: Sun Mar 17, 2024 1:23 pm oh i totally forgot about layered images, i think ive only used those like once HEJLP., THANK YOU!!
another thing im wondering, can layered images only use at statements for transitions if the transition is in the same .rpy file as the image is? my previous usage of a layered image had an at statement on one of the images for a custom motion i made and that worked fine, but when i try to do the same thing here it still doesnt work so im assuming its a thing of where im defining my transitions..
Renpy reads .rpy files in alphabetical order (with a default init value of 0 for every image definition, transform etc. in that file). So you either change the filename or you just change the init value, by putting the transform inside an init block with a value lower than 0.

Code: Select all

init -1:
    transform mytrans:
        ...

User avatar
neutrino
Newbie
Posts: 12
Joined: Thu Mar 09, 2023 3:29 pm
Completed: Mignyan Meetup
Projects: Holy Incineration / What Dwells / TEN / motherboard.
Deviantart: amalgambite
itch: amalgambite
Location: south usa
Discord: amalgam8 [do not frq without letting me know here first]
Contact:

Re: expected 'comma or end of line' not found when defining an image

#5 Post by neutrino »

OH WOW THANK YOU this is my first time separating my script out into multiple files like this so i had no idea the alphabetical of it was important 0: changing the file name fr my transitions fixed it, tysm!!!
creature made of nerves, and flesh, and other things - maybe

deviantart
twitter
itch
weebly

Post Reply

Who is online

Users browsing this forum: No registered users