Error detected in script, but code looks correct? Any help is appreciated

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
jingleriot
Regular
Posts: 25
Joined: Mon Sep 05, 2016 7:53 pm
Projects: Ventio Mortis, Sector Chimera, Monster Party
Deviantart: jingleriot
itch: https://jingleriotga
Contact:

Error detected in script, but code looks correct? Any help is appreciated

#1 Post by jingleriot »

Hello! I have some old games i've been working on, and on this project in particular I picked up some code for a codex, but i can't get it to work (even though it used to work perfectly?) and i keep getting an error every time I try to open the game. I don't see what's wrong with the code as I have other chucks of code that are similar that DO work. Only this entry is causing issues. I checked the indentation as well, seems correct to me. Any help would be greatly appreciated. Below is the error and the broken code. I'm also including another error I keep getting that doesn't make sense to me either. Thank you again! If you need more information or code, please let me know!


Specific Code 1 (i.e. The Ruby Problem)

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/backup-code.rpy", line 14: u'screen' is not a keyword argument or valid child for the screen statement.
    screen wiki_ruby():
          ^

File "game/codex.rpy", line 382: u'screen' is not a keyword argument or valid child for the screen statement.
    screen wiki_ruby():
          ^

Ren'Py Version: Ren'Py 7.5.0.22062402
Thu Mar 21 13:06:13 2024

Code: Select all

screen wiki_ruby():

    tag menu
    if ruby_locked == True:
        use game_menu(_("Ruby")):

            text _p("""
                Ruby ???, AgeeeeeeeEEEẸ̵̠̤͖̮̲͕̤̈́̒̈́͋̅̚R̲͍̪͈̗̥̔̓̂̚͝R̢̫̦̬̰̫̳̮͐̽̽̂̓͜Ȏ̼̩͚̤̆͑͛́̂̃͢͡ͅR̟̪͇͙̣̜̺̤̒̔̇̀̊̕ D̸̡̛̼͍͙͙̫͂͐̓͋A̡̢̲̜͔̤̝̼͔̍́̓̏̽̒̑T̷̡̛̛͕̭̟̩̅̃̄̈A̢̧͙̤̖̺͈̍͒̎͌̊̀̒ C̷̡̤̬̬̱̺͍̓̅̎̄͂̾͗̇͞O̶̦̖͙̹̓͂͛̊͑͒͟ͅR̵̥̜̼̼̜͍̝̹̔̈̑͊͠R̛̖̪̖̱͇̔͗̍̌́Ú̡̨̝̝͓̜̥̫͈̏̈̏̿̌̀̀̊̀͢P͙̻̖̰͖̰͇̘̏̀̈́͛͐̓͜͠T̫͔͎̤̰͈͈̹͚̼̒̐͆̈́̈́̓̍̌̽͡


                {a=wiki_index}Back to Index{/a}
                """)
    else:
        screen wiki_ruby():

            tag menu

            use game_menu(_("Ruby")):

                text _p("""
                    Ruby, otherwise known as Aus, is Astraeus's alter ego in limbo. How Astraeus managed to hide this information is unknown and must be found out to prevent 
                    data corruption and data scrambling in the future.


                    {a=wiki_index}Back to Index{/a}
                    """)
Broken Code 2 (The Index Error)

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/codex.rpy", line 550, in execute
    screen wiki_index():
  File "game/codex.rpy", line 550, in execute
    screen wiki_index():
  File "game/codex.rpy", line 554, in execute
    use game_menu(_("Codex Entries")):
  File "game/screens.rpy", line 420, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 420, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 429, in execute
    frame:
  File "game/screens.rpy", line 432, in execute
    hbox:
  File "game/screens.rpy", line 438, in execute
    frame:
  File "game/screens.rpy", line 441, in execute
    if scroll == "viewport":
  File "game/screens.rpy", line 470, in execute
    transclude
  File "game/codex.rpy", line 554, in execute
    use game_menu(_("Codex Entries")):
  File "game/codex.rpy", line 555, in execute
    hbox:
  File "game/codex.rpy", line 739, in execute
    vbox:
  File "game/codex.rpy", line 824, in execute
    if ndefeat_locked == True:
  File "game/codex.rpy", line 824, in <module>
    if ndefeat_locked == True:
NameError: name 'ndefeat_locked' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "renpy/ast.py", line 1111, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 1049, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "renpy/ui.py", line 299, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3376, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs) # type: ignore
  File "renpy/display/core.py", line 3803, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/core.py", line 582, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 582, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 582, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 582, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/screen.py", line 451, in visit_all
    callback(self)
  File "renpy/display/core.py", line 3803, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/screen.py", line 462, in per_interact
    self.update()
  File "renpy/display/screen.py", line 653, in update
    self.screen.function(**self.scope)
  File "game/codex.rpy", line 550, in execute
    screen wiki_index():
  File "game/codex.rpy", line 550, in execute
    screen wiki_index():
  File "game/codex.rpy", line 554, in execute
    use game_menu(_("Codex Entries")):
  File "game/screens.rpy", line 420, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 420, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 429, in execute
    frame:
  File "game/screens.rpy", line 432, in execute
    hbox:
  File "game/screens.rpy", line 438, in execute
    frame:
  File "game/screens.rpy", line 441, in execute
    if scroll == "viewport":
  File "game/screens.rpy", line 470, in execute
    transclude
  File "game/codex.rpy", line 554, in execute
    use game_menu(_("Codex Entries")):
  File "game/codex.rpy", line 555, in execute
    hbox:
  File "game/codex.rpy", line 739, in execute
    vbox:
  File "game/codex.rpy", line 824, in execute
    if ndefeat_locked == True:
  File "game/codex.rpy", line 824, in <module>
    if ndefeat_locked == True:
NameError: name 'ndefeat_locked' is not defined

Windows-10-10.0.19041 AMD64
Ren'Py 7.5.0.22062402
Sector Chimera 1.0
Thu Mar 21 13:11:01 2024

Code: Select all

screen wiki_ndefeat():

    tag menu

    use game_menu(_("Nydiema Translation")):

        text _p("""
            Subject's battle with {a=wiki_nydiema}Nydiema{/a} has proven to be invaluable. We've been able to gather enough data to begin translating corrupt speak. Transcript as follows: {p}{p} 
            ĐØ₦'₮ ₮ØɄ₵Ⱨ ₥Ɏ ₮Ⱨł₦₲₴!!.-. !!!..- -.!!!!........!!!! = Don't touch my things; RUN {p}
            ɎØɄ ₲ɄɆ₴₴ɆĐ Ɽł₲Ⱨ₮.. .// = You guessed right {p}
            ł ₵₳₦'₮ ₩₳ł₮ ₮Ø ₱Ⱡ₳Ɏ ₩ł₮Ⱨ ₥Ɏ ฿₳฿łɆ₴ ₳₲₳ł₦ !-.! . !- ...- . = I can't wait to play with my babies again; LEAVE {p}
            ⱠØØ₭₴ Ⱡł₭Ɇ ₴Ø₥ɆØ₦Ɇ ₥₳ĐɆ ₳₦ ØØ₱₴łɆ\\\.. ·----· --\\ = Looks like someone made an oopsie; I'M {p}
            ₩Ⱨ₳₮ ₳ ₴Ⱨ₳₥Ɇ ?!! --- .-? .-. -!-- = What a shame; SORRY{p}
            ₦Ø₮ ɎØɄ-- !! !!! - !- -!- ! = Not you; MISTAKE {p}
            Đ₳Ʉ₲Ⱨ₮ɆⱤ Ø₣ ₮ⱧɆ ₵ɄⱤ!!!! !! !!! -- !! !!! - !- -!- !; Daughter of the cur; HIS MISTAKE{p}
            ₦Ø ₣ØɄⱠ Ⱡ₳₦₲Ʉ₳₲Ɇ-! !- !!- --! !!!! - -!-- = No foul language; NAUGHTY {p}
            ₳₦Đ ₩ⱧɆⱤɆ ₳ⱤɆ ɎØɄⱤ₴? = And where are yours? 
            ₩Ⱨ₳₮ гРł JɄ₴₮ ₴₳Ɏ ??? - --- ?--. = What did I just say?; STOP {p}
            ɎØɄ'ⱤɆ ₥ł₦Ɇ!! !-!! --- !!!- ! = You're mine; I LOVE{p}
            ⱧØ₩ Đ₳ⱤɆ ɎØɄ ₣ØⱤ₲Ɇ₮-!-- --- !!- = How dare you forget; YOU{p}
            ĐØ₦'₮ ɎØɄ ɆVɆⱤ ₴₱Ɇ₳₭ ₮Ø ₥Ɇ ₳₲₳ł₦-!! !! ! !- !-!! !-! ! !- -!! -!-- = Don't you ever speak to me again; DIE ALREADY{p}
            ĐØ₦'₮ ₱Ⱡ₳Ɏ ₵ØɎ, ₥ł₴₮₳₭Ɇ... ..- ..-. ..-. . .-. = Don't play coy, mistake; SUFFER{p}
            ɎØɄ ₩ØɄⱠĐ Đ₳ⱤɆ ₲Ɇ₮ ł₦ ₥Ɏ ₩₳Ɏ--- -? .-?! -.-- -!-- --- !.- = You would dare get in my way?; ONLY YOU{p}
            ₳₴₮Ɽ₳ɆɄ₴-- -.-- ₳₴₮Ɽ₳ɆɄ₴ ₦ɆɆĐ₴ ₳ ₮ł₥Ɇ ØɄ₮.- ..- ... = Astraeus, Astraeus needs a time out; MY AUS{p}
            ⱧɆⱤ ₥₳Ⱡł₵Ɇ.. ·----· -- ... --- .-. .-. -.-- = Her malice; I'M SORRY {p}
            ɎØɄ ₴ⱧØɄⱠĐ₦'₮ Ⱨ₳VɆ ₵Ø₥Ɇ ⱧɆⱤɆ.-. ..- -. = You shouldn't have come here; RUN {p}
            ₳ ⱤɆ₳Ⱡ ₣₳₥łⱠɎ-. --- - .- -. -.-- -- --- .-. . = (We could have been) A real family; NOT ANYMORE {p}
            ₥Ɏ ₴Ø₦ ł₴ ₥ØⱤɆ ฿Ɇ₳Ʉ₮ł₣- .... .- -. -.- f-.-- --- ..- = My son is more beautif(ul than the sins of his father); THANK YOU{p} 
                

            {a=wiki_index}Back to Index{/a}
            """)
        

Code: Select all

screen wiki_index():

    tag menu

    use game_menu(_("Codex Entries")):
        hbox:
            vbox:
                ypos 0.0
                
######################################################################################################
#CHIMERA CITY
######################################################################################################

                text _p("""
                -----------------{p}
                Chimera City{p}
                -----------------{p}
                > {a=locked:wiki_uNLIT}uNLIT{/a}{p}
                > {a=locked:wiki_chimera}Sector Chimera{/a}
                """)

                if serum_locked == True:
                    text _p("""
                    > ???
                    """)
                else:
                    text _p("""
                    > {a=locked:wiki_serum}Dream Serum{/a}
                    """)
                    

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Error detected in script, but code looks correct? Any help is appreciated

#2 Post by m_from_space »

jingleriot wrote: Thu Mar 21, 2024 1:12 pm
Specific Code 1 (i.e. The Ruby Problem)

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/backup-code.rpy", line 14: u'screen' is not a keyword argument or valid child for the screen statement.
    screen wiki_ruby():
          ^

File "game/codex.rpy", line 382: u'screen' is not a keyword argument or valid child for the screen statement.
    screen wiki_ruby():
          ^

Ren'Py Version: Ren'Py 7.5.0.22062402
Thu Mar 21 13:06:13 2024
So, there is a screen with the same name "wiki_ruby" in both backup-code.rpy and codex.rpy. I don't know if that is really the cause of the error, but you shouldn't create two screens with the same name I guess. But the error appears as if you are using the word "screen" inside another screen. You could try hitting "Force recompile" inside the launcher and see if that helps.

Code: Select all

    if ndefeat_locked == True:
NameError: name 'ndefeat_locked' is not defined
Well, the error states that the variable "ndefeat_locked" is not defined. Is it defined and how so?

Post Reply

Who is online

Users browsing this forum: MisterPinetree