Trouble with Double Vision Code (solved)

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
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Trouble with Double Vision Code (solved)

#1 Post by AsHLeX »

Hello! So I was using the Double Vision code from here, and this occured.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/story-day2.rpy", line 3324, in script
    "I open my mouth to protest, but feel my vision blurring."
Exception: MoveTransition can only be applied to one or all layers, not Position.

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

Full traceback:
  File "game/story-day2.rpy", line 3324, in script
    "I open my mouth to protest, but feel my vision blurring."
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\ast.py", line 930, in execute
    renpy.exports.say(who, what, *args, **kwargs)
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\exports.py", line 1474, in say
    who(what, *args, **kwargs)
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\character.py", line 1352, in __call__
    self.do_display(who, what, cb_args=self.cb_args, dtt=dtt, **display_args)
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\character.py", line 1003, in do_display
    display_say(who,
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\character.py", line 693, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\ui.py", line 299, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\core.py", line 3582, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\core.py", line 4175, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\core.py", line 2782, in draw_screen
    surftree = renpy.display.render.render_screen(
  File "render.pyx", line 492, in renpy.display.render.render_screen
  File "render.pyx", line 266, in renpy.display.render.render
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\layout.py", line 888, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 266, in renpy.display.render.render
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\layout.py", line 888, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 266, in renpy.display.render.render
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\layout.py", line 888, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 266, in renpy.display.render.render
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\transform.py", line 909, in render
    return RenderTransform(self).render(width, height, st, at)
  File "accelerator.pyx", line 979, in renpy.display.accelerator.RenderTransform.render
  File "accelerator.pyx", line 404, in renpy.display.accelerator.RenderTransform.render_child
  File "render.pyx", line 266, in renpy.display.render.render
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\anim.py", line 279, in render
    self.update_cache()
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\anim.py", line 231, in update_cache
    im = self.edge.trans(old_widget=self.states[self.edge.old].get_image(),
  File "C:\Users\andre\Documents\renpy-8.1.3-sdk\renpy\display\movetransition.py", line 498, in MoveTransition
    raise Exception("MoveTransition can only be applied to one or all layers, not %s." % type(old_widget).__name__)
Exception: MoveTransition can only be applied to one or all layers, not Position.

Windows-10-10.0.22621 AMD64
Ren'Py 8.1.3.23091805
Cafe Mysteria 1.0
Mon Dec 18 21:34:32 2023
This is the code I was using:

Code: Select all

label start:
	"The corners of his lips curl upwards, but there is no warmth to his smile."
        $ blur_vision_on("cs1")
        show haruki intense smile v2
        "I open my mouth to protest, but feel my vision blurring."
        p "... How?"
        "The last thing I see is Haruki's sinister smile before my consciousness wanes."
        $ blur_vision_off()

Code: Select all

# blur_vision code
init:
    transform transpa:
        alpha 0.0
    python hide:
        def gen_randmotion(count, dist, delay):
            import random
            args = [ ]
            for i in range(0, count):
                args.append(anim.State(i, None,
                                       Position(xpos=random.randrange(-dist, dist),
                                                ypos=random.randrange(-dist, dist),
                                                xanchor='left',
                                                yanchor='top',
                                                )))
            for i in range(0, count):
                for j in range(0, count):
                    if i == j:
                        continue
                    args.append(anim.Edge(i, delay, j, MoveTransition(delay)))
            return anim.SMAnimation(0, *args)
        store.randmotion = gen_randmotion(5, 5, 1.0)
init python:
    def blur_vision_on(picture):
        renpy.scene()
        renpy.show(picture)
        renpy.show(picture, at_list=[transpa,randmotion], tag="blur_image")
        #renpy.with_statement()
    def blur_vision_off():
        renpy.hide("blur_image")
        #renpy.with_statement()

Code: Select all

init:
    image cs1 = Image("images/cafe day.png")
What did I do wrong? Please help. Thanks!!!
Last edited by AsHLeX on Tue Jan 02, 2024 5:20 am, edited 1 time in total.
Image
New demo out 24/12/23!!

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

Re: Trouble with Double Vision Code

#2 Post by m_from_space »

AsHLeX wrote: Mon Dec 18, 2023 6:37 am What did I do wrong? Please help. Thanks!!!
Biggest mistake is using code that is marked "out of date" since it is 13 years old. Just don't!

But I don't want to appear as rude, so the code is just doing something simple. It creates a half-transparent image out of an image and shows this moving in front of the background so it creates this blurry vision effect. I actually do this sometimes in my game as well. You just can use simple transforms that move and rotate an image and make it transparent etc.

Here is the code I made for my game. It also accepts arguments to suit your needs, you get the idea. Write your own transform if you want.

Code: Select all

transform atl_dizzy(x=0.5, y=0.5, xa=0.5, ya=0.5, a=1.0, t=0.4, z=1.05):
    alpha 1.0 rotate 0.0 zoom 1.0
    xpos x ypos y
    xanchor xa yanchor ya
    transform_anchor True
    choice:
        parallel:
            ease t rotate a
        parallel:
            linear t alpha 0.5 zoom z
        ease t rotate -a
    choice:
        parallel:
            ease t rotate -a
        parallel:
            linear t alpha 0.5 zoom z
        ease t rotate a
    linear t rotate 0.0 alpha 1.0 zoom 1.0
    
label start:
    show cs1
    "The corners of his lips curl upwards, but there is no warmth to his smile."
    show cs1 as cs1_copy at atl_dizzy
    show haruki intense smile v2
    "I open my mouth to protest, but feel my vision blurring."
    hide cs1_copy
    p "... How?"
    "The last thing I see is Haruki's sinister smile before my consciousness wanes."

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Trouble with Double Vision Code

#3 Post by AsHLeX »

Thank you!!
Image
New demo out 24/12/23!!

Post Reply

Who is online

Users browsing this forum: LuckyT