[Solved] Exception: Possible infinite 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
User avatar
apexchimps
Regular
Posts: 29
Joined: Mon Jan 25, 2016 6:12 pm
Completed: Detective Max, Nick's Night Out!, Arthur & Susan: Almost Detectives
Projects: Arthur & Susan: Almost Detectives
Contact:

[Solved] Exception: Possible infinite loop

#1 Post by apexchimps »

Hi,

We are developing a game in which sometimes the game is waiting for the player to click something. The way we managed to do this is by using a while-true-pause scheme. It has worked in previous games and even in this one until recently. This error appears:

Image

The underlying code is the following:

Code: Select all

label navegacion:
    $flag_boton = True
    $flag_navegacion_activa = True

    while True:
        $ renpy.pause(200, hard=True)
This has worked for years. If we click Ignore in the error page the game continues smoothly. We would like (if possible) to just continue without the error. Is it possible?

We have tried unsuccesfully:
- to use a try-except
- to delete the while-true and use a jump to the beginning
- to fool the while True

Any ideas?

Thank you in advance!
Last edited by apexchimps on Sat Jul 24, 2021 8:45 am, edited 1 time in total.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Exception: Possible infinite loop

#2 Post by hell_oh_world »

try

Code: Select all

default playing = true

label start:
  while playing:
    pass 
not sure though, never used this kind of method before. I wouldn't suggest doing it either since renpy itself is already running on an infinite loop to make the game work.
If you're monitoring something, use periodic callbacks or screens.

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

Re: Exception: Possible infinite loop

#3 Post by Ocelot »

How about forcing interaction instead of using pause with a timeout? Maybe with a jump back if there are buttons which do not jump in different parts of script?
< < insert Rick Cook quote here > >

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

Re: Exception: Possible infinite loop

#4 Post by Alex »

apexchimps wrote: Fri Jul 23, 2021 7:22 pm

Code: Select all

label navegacion:
    $flag_boton = True
    $flag_navegacion_activa = True

    while True:
        $ renpy.pause(200, hard=True)
Try

Code: Select all

label navegacion:
    $flag_boton = True
    $flag_navegacion_activa = True

    $ renpy.pause(hard=True)
or

Code: Select all

label navegacion:
    $flag_boton = True
    $flag_navegacion_activa = True

    $ ui.interact()
https://www.renpy.org/doc/html/screen_p ... i.interact

User avatar
apexchimps
Regular
Posts: 29
Joined: Mon Jan 25, 2016 6:12 pm
Completed: Detective Max, Nick's Night Out!, Arthur & Susan: Almost Detectives
Projects: Arthur & Susan: Almost Detectives
Contact:

Re: Exception: Possible infinite loop

#5 Post by apexchimps »

Thank you for your quick answers, hell_oh_world, Ocelot and Alex!

I have tried your solutions and I was able to solve it! In the end it has been a mixture of Ocelot's #1 solution and Alex's #1 solution.

By removing the while-true and leaving just the pause (thanks Alex!) it worked almost right, but one button returned to the main menu. That is where Ocelot's answer kicks in. This button wasn't jumping appropriately. So thanks Ocelot!

Code: Select all

label navegacion:
    $flag_boton = True
    $flag_navegacion_activa = True

    $ renpy.pause(hard=True)
    jump navegacion
Best regards!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], frankm200