[Nevermind...] Break out of a Ren'Py while 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
Ivlivs
Veteran
Posts: 266
Joined: Sun Feb 25, 2007 1:00 pm
Contact:

[Nevermind...] Break out of a Ren'Py while loop

#1 Post by Ivlivs » Thu Aug 26, 2010 6:40 pm

Is their any way to break out of a standard Ren'Py while loop? It's obviously doable in Python code, but Ren'Py doesn't seem to support anything that can break out of a loop altogether. Is there something I'm missing?
Last edited by Ivlivs on Thu Aug 26, 2010 8:52 pm, edited 1 time in total.
Jitteh Dawn --- A VN by Ivlivs
Parasite Lance --- A puzzle game by Ivlivs (Rawle Nyanzi)

fortaat
Regular
Posts: 183
Joined: Tue May 18, 2010 1:16 pm
Contact:

Re: Break out of a Ren'Py while loop

#2 Post by fortaat » Thu Aug 26, 2010 7:26 pm


Ivlivs
Veteran
Posts: 266
Joined: Sun Feb 25, 2007 1:00 pm
Contact:

Re: Break out of a Ren'Py while loop

#3 Post by Ivlivs » Thu Aug 26, 2010 8:11 pm

Not quite what I'm looking for; I need a break statement that can take me out of a loop as soon as its called.
Jitteh Dawn --- A VN by Ivlivs
Parasite Lance --- A puzzle game by Ivlivs (Rawle Nyanzi)

fortaat
Regular
Posts: 183
Joined: Tue May 18, 2010 1:16 pm
Contact:

Re: Break out of a Ren'Py while loop

#4 Post by fortaat » Thu Aug 26, 2010 8:18 pm

I don't think I understand what you want to do.

You want to have a logical check whether you should loop or not, right after you called the loop?
Shouldn't you check it before, and if True send the player looping?

Side note, I couldn't find an end loop command, which would have been better than all those variables.

Ivlivs
Veteran
Posts: 266
Joined: Sun Feb 25, 2007 1:00 pm
Contact:

Re: [Nevermind...] Break out of a Ren'Py while loop

#5 Post by Ivlivs » Thu Aug 26, 2010 8:53 pm

Never mind. I haven't found a way to do a break statement the way Python does, but I found an alternative solution to my own problem -- a solution that didn't involve a break statement.
Jitteh Dawn --- A VN by Ivlivs
Parasite Lance --- A puzzle game by Ivlivs (Rawle Nyanzi)

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: [Nevermind...] Break out of a Ren'Py while loop

#6 Post by PyTom » Thu Aug 26, 2010 9:21 pm

The way I suggest doing this is to put a label after the loop, and then jump to that label.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

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