NameError: The variable...doesn't exist

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
ElonMuskIsMyDad
Newbie
Posts: 10
Joined: Sun Nov 29, 2020 4:02 pm
Contact:

NameError: The variable...doesn't exist

#1 Post by ElonMuskIsMyDad »

Hello, everyone!

I've run into an issue with one of my screens. I've never had this issue before, but suddenly, my screen was rendered useless.

Here's the error I'm receiving:

Code: Select all

[code]
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 284, in script
    
  File "game/script.rpy", line 284, in <module>
    
  File "renpy/common/00action_data.rpy", line 79, in get_selected
    return __get_field(self.object, self.field, self.kind) == self.value
  File "renpy/common/00action_data.rpy", line 39, in _m1_00action_data__get_field
    raise NameError("The {} {} does not exist.".format(kind, name))
NameError: The variable has_katia does not exist.

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

Full traceback:
  File "game/script.rpy", line 284, in script
    
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\ast.py", line 914, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\python.py", line 2028, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 284, in <module>
    
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\exports.py", line 1538, in movie_cutscene
    roll_forward=roll_forward)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\ui.py", line 297, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 2702, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 3094, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\screen.py", line 434, in visit_all
    self.child.visit_all(callback, seen=None)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 543, in visit_all
    callback(self)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\core.py", line 3094, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\behavior.py", line 857, in per_interact
    if self.is_selected():
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\behavior.py", line 845, in is_selected
    return is_selected(self.action)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\behavior.py", line 388, in is_selected
    return any(is_selected(i) for i in action)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\behavior.py", line 388, in <genexpr>
    return any(is_selected(i) for i in action)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\display\behavior.py", line 391, in is_selected
    return action.get_selected()
  File "renpy/common/00action_data.rpy", line 79, in get_selected
    return __get_field(self.object, self.field, self.kind) == self.value
  File "renpy/common/00action_data.rpy", line 39, in _m1_00action_data__get_field
    raise NameError("The {} {} does not exist.".format(kind, name))
NameError: The variable has_katia does not exist.

Windows-8-6.2.9200
Ren'Py 7.3.5.606
Professor Layton and the Minor Inconvenience 1.0
Sun May 16 17:43:17 2021
[/code]




Here's the code in question:

Code: Select all

screen katia_there:
    modal False
    imagebutton:
        xpos 30 ypos 103
        idle "katia.png"
        hover "katia.png"
        action [SetVariable("has_katia", True), Hide("katia_there"), Jump("puzzle003wrong")]

I'm not sure what the problem is. What do you advise?

Thank you!

User avatar
mavyxdawn
Regular
Posts: 72
Joined: Sun Dec 20, 2015 6:18 pm
Github: mavyxdawn
itch: zeillearnings
Discord: _zeil
Contact:

Re: NameError: The variable...doesn't exist

#2 Post by mavyxdawn »

Hi! You got an error:

Code: Select all

 NameError: The variable has_katia does not exist.
This means you haven't told Ren'Py you have a variable `has_katia`.

You just need to add:

Code: Select all

default has_katia= False
YouTube: Zeil Learnings
itch.io: Zeil Learnings

Image

ElonMuskIsMyDad
Newbie
Posts: 10
Joined: Sun Nov 29, 2020 4:02 pm
Contact:

Re: NameError: The variable...doesn't exist

#3 Post by ElonMuskIsMyDad »

Thank you, I'll try that!

Post Reply

Who is online

Users browsing this forum: No registered users