[SOLVED] DON'T USE $ PRINT IN SCREENS.

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
henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

[SOLVED] DON'T USE $ PRINT IN SCREENS.

#1 Post by henvu50 »

Don't ever use $ print in screens. if you need to debug, use text "" instead.

------------------------------------------------------
I need to run a for loop in a screen that uses eval to check conditions in a dictionary. Unfortunately, eval has a major problem:

When you run eval ten times in a row in a for loop within a screen. It will fail one out of ten times, EVEN THE THOUGHT CONDITION IS EXACTLY THE SAME, making it unreliable to use.

You can reproduce the problem in a brand new renpy project:

Code: Select all

default weirdproblem = False
default boolVarEval = "weirdproblem == False"

screen test50():
    # expected behavior is to print true 10 times, but one loop results in printing false, despite condition being the same
    for i in range(0,10):
        #if boolVarEval:    WHAT THE HELL, DOING THIS CAUSES THE SAME PROBLEM? SO IT'S NOT UNIQUE TO EVAL?! 
        if eval( boolVarEval ) == True:
            $ print "true"
        else:
            $ print "false"

label start:
  call screen test50
  return
So now I need to alternative to eval.

Someone in the discord said I need to do this:

Code: Select all

on 'show' action If(boolVarEval , Function(print, "True"), Function(print, "False"))
But I don't understand how the above code can fix my problem. I just need EVAL TO WORK GOD DAMN IT! LOL

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]