Trouble Iterating Loop

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
decocloud
Newbie
Posts: 11
Joined: Fri May 13, 2022 7:15 pm
Contact:

Trouble Iterating Loop

#1 Post by decocloud »

Hey there, I've got this loop for randomly picking out/displaying images in a folder but I can't get it to iterate without coming back with a "expected comma or end of line not found" on the $ i+= 1

Image

My codeblock looks like:

Code: Select all

image mainmenumv = Movie(play = "images/mainmenuvid.ogv")
define spotlight_list = spotlight_shuffle()
$ i = 0
image mainmenubg:
    choice:
        spotlight_list[i % 100] with Dissolve(1.0, alpha=True)
        $ i += 1
        pause 1.5
    repeat

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

Re: Trouble Iterating Loop

#2 Post by Imperf3kt »

I think it's because you have a pause as part of your choice block, taking it back one indentation should fix it

Code: Select all

image mainmenumv = Movie(play = "images/mainmenuvid.ogv")
define spotlight_list = spotlight_shuffle()
$ i = 0
image mainmenubg:
    choice:
        spotlight_list[i % 100] with Dissolve(1.0, alpha=True)
        $ i += 1
    pause 1.5
    repeat
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

decocloud
Newbie
Posts: 11
Joined: Fri May 13, 2022 7:15 pm
Contact:

Re: Trouble Iterating Loop

#3 Post by decocloud »

Oh good eye! Unfortunately I'm still getting the exact same error. My chief suspicion now is that my code editor is highlighting my injected statement as red so I'm wondering if its something syntax related?

https://imgur.com/lhIuvtN

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2420
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Trouble Iterating Loop

#4 Post by Ocelot »

ATL ≠ RenPy Script. It is another language. You can only use ATL statements in image definitions. Python statements are not part of ATL (with a good reasons), so you cannot do that.
< < insert Rick Cook quote here > >

decocloud
Newbie
Posts: 11
Joined: Fri May 13, 2022 7:15 pm
Contact:

Re: Trouble Iterating Loop

#5 Post by decocloud »

AH that would make sense, thanks for the clarification. Back to the drawing board lol

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot