Page 1 of 1

Line of code that checks for script:

Posted: Fri May 27, 2016 10:23 pm
by GROWLEX
Hello! I do say that signing up was a pain, but hopefully it was worth it. Our dev. team is writing an RPG style game. We want to use multiple scripts for convenience, but we are running into a problem with it. None of us can think of a way to have Ren 'Py check if a script is present. I thought we could use just a jump label, but if you don't have the script, it would give you an error, resulting in a bug we would need to fix. Then I thought we could assign a variable to the 2nd script, but that would also need to have a jump and label. Can anyone help me out?

By the way, it involves a chapter system, so that is why we want separate scripts, like DLC.

Re: Line of code that checks for script:

Posted: Fri May 27, 2016 10:46 pm
by saguaro

Re: Line of code that checks for script:

Posted: Fri May 27, 2016 10:51 pm
by GROWLEX
saguaro wrote:Try config.missing_label_callback
https://www.renpy.org/doc/html/config.h ... l_callback
Ok, I am completely new to this, so could you please explain this to me?

(I don't want an error to happen.)

Re: Line of code that checks for script:

Posted: Fri May 27, 2016 11:09 pm
by saguaro
God, I can't get it to work either. Hell if I know. It's an election year and I'm losing my mind.

Use renpy.has_label
https://www.renpy.org/doc/html/label.ht ... .has_label

Code: Select all

    if renpy.has_label("some_label"):
        jump some_label
    else:
        "Label doesn't exist."

Re: Line of code that checks for script:

Posted: Fri May 27, 2016 11:17 pm
by GROWLEX
Thank you!