NameError: name 'zoom' is not defined

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
Dsiak
Newbie
Posts: 15
Joined: Fri Jul 06, 2018 10:26 pm
IRC Nick: [Actual Horse]
Contact:

NameError: name 'zoom' is not defined

#1 Post by Dsiak »

Hello, I'm having a strange problem where Python will not accept my attemp at passing a property as a parameter, it goes as follow:

Code: Select all

Line 67:
    show bg dream at daughter_crop
    with dissolve
Line 29:
    transform daughter_crop:
    linear .75 subpixel True xpos 0.0 ypos 0.0 xanchor 0.0 yanchor 0.0 zoom 2.58 rotate None
    parallel:
        breath(zoom)
        repeat

transform breath(zoom_value, zoom_offset = 0.1, zoom_time = 5.0):
    linear zoom_time zoom zoom_value - zoom_offset
    linear zoom_time zoom zoom_value
Even though zoom appears as it is set in-game, and the function works if I send a 'float' instead of 'zoom', the trace back tells me that zoom is not defined, traceback bellow:

Code: Select all

I'm sorry, but an uncaught exception occurred.

Compiling ATL code at game/script.rpy:29
  File "game/script.rpy", line 67, in script
    show bg dream at daughter_crop
NameError: name 'zoom' is not defined

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

Full traceback:
  File "game/script.rpy", line 67, in script
    show bg dream at daughter_crop
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\ast.py", line 1131, in execute
    show_imspec(self.imspec, atl=getattr(self, "atl", None))
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\ast.py", line 1101, in show_imspec
    atl=atl)
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\exports.py", line 705, in show
    sls.add(layer, img, key, zorder, behind, at_list=at_list, name=name, atl=atl, default_transform=default_transform, transient=transient)
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\display\core.py", line 1040, in add
    thing._show()
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\display\transform.py", line 1041, in _show
    super(ATLTransform, self)._show()
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\display\transform.py", line 1007, in _show
    self.update_state()
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\display\transform.py", line 1029, in update_state
    fr = self.execute(self, self.st, self.at)
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 513, in execute
    block = self.compile()
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 481, in compile
    block = self.atl.compile(self.context)
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 676, in compile
    statements = [ i.compile(ctx) for i in self.statements ]
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 1296, in compile
    return Parallel(self.loc, [i.compile(ctx) for i in self.blocks])
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 676, in compile
    statements = [ i.compile(ctx) for i in self.statements ]
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 889, in compile
    child = ctx.eval(expr)
  File "C:\Users\censored\Documents\renpy-7.0.0-sdk\renpy\atl.py", line 246, in eval
    return eval(expr, renpy.store.__dict__, self.context)  # @UndefinedVariable
  File "<string>", line 1, in <module>
NameError: name 'zoom' is not defined

Windows-8-6.2.9200
Ren'Py 7.0.0.196
Test 1.0
Fri Jul 06 23:24:03 2018
Off course I could just send the 2.58 instead, but this will be cumbersome when I have to make a change and when I use in other situations. I wanted to know how come I can not get the value stored in 'zoom' like this and what would be the correct way to go about it.
neigh

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: NameError: name 'zoom' is not defined

#2 Post by Donmai »

Isn't "zoom" a reserved name? Have you tried "my_zoom", or something else?
https://www.renpy.org/doc/html/reserved ... rved-names
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: NameError: name 'zoom' is not defined

#3 Post by xavimat »

Inside the "transform daughter_crop" you don't have a variable named "zoom", so renpy can't understand the line "breath(zoom)". Another problem is, as Donmai has pointed out, that you shouldn't use "zoom" as a variable name.
The long line where you define "zoom 2.58" does not mean that renpy has a variable "zoom" that now is equal to 2.58, that's a property, not a variable.

On the other hand, you could shorten this:
xpos 0.0 ypos 0.0 xanchor 0.0 yanchor 0.0
to this:
align (0.0, 0.0)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Dsiak
Newbie
Posts: 15
Joined: Fri Jul 06, 2018 10:26 pm
IRC Nick: [Actual Horse]
Contact:

Re: NameError: name 'zoom' is not defined

#4 Post by Dsiak »

I was under the impression the property should return me a float because of this part in the atl documentation.

I'm still a little bit confused, I see that the zoom is not a variable (as I though it was) but is there a way I could check the value of this property to store it in a variable of mine? (something like $ my_zoom = zoom)

Code: Select all

linear start subpixel True align (0.0, 0.0) zoom 2.6 rotate None
    $ my_zoom = zoom
    parallel:
        breath(my_zoom)
        repeat

did not work, but I'm just guessing at this point.

Code: Select all

File "game/dream.rpy", line 28: expected 'comma or end of line' not found.
    $ my_zoom = zoom
neigh

Post Reply

Who is online

Users browsing this forum: Google [Bot]