[SOLVED] How to access a transform inside a named store?

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
trajano
Regular
Posts: 60
Joined: Sun Jun 16, 2019 7:59 pm
Github: trajano
Contact:

[SOLVED] How to access a transform inside a named store?

#1 Post by trajano » Thu Jul 25, 2019 2:43 pm

I have the following code where I want to namespace my methods, but I want it to access a transformation that I defined outside. How do I refer to this transformation inside the python code?

Code: Select all

transform saybox_namebox_transform(xoffset=0, yoffset=0, degs = 10, yoffset_transform = 40, easein = 0.15):
    rotate_pad True
    xoffset xoffset
    yoffset yoffset
    rotate 0
    easein easein rotate degs yoffset pmui.scale_p(yoffset-yoffset_transform)

init python in pmui:
    from math import sqrt
    from renpy.defaultstore import At
    from renpy.display.core import absolute
    from renpy.display.imagelike import Frame, Solid
    from renpy.display.layout import AlphaMask, Composite
    def dialogbox(st, at, who=None):
        w = scale_f(1080)
        h = scale_f(375)
        z = sqrt(w*w + h*h)
        xoffset = absolute(-((z - w) /2.0 ))
        yoffset = absolute(-((z - h) /2.0 ))
        return Composite(
            (scale_p(w), scale_p(h)),
            (0,0), At(
                Composite(
                    (scale_p(1080), scale_p(375)),
                    (0,0), AlphaMask(Solid(say_extra_box_color),Frame("portrait-mode-ui/ui/say-alphamask.png")),
                    (0,0), "portrait-mode-ui/ui/say-dropshadow.png",
                    (scale_p(50), scale_p(50)), who
                ),
                saybox_namebox_transform(
                    xoffset=xoffset,
                    yoffset=yoffset,
                    yoffset_transform=40,
                    degs = 15,
                    easein = 0.20)
                ),
            (0, 0), At(
                Composite(
                    (scale_p(1080), scale_p(375)),
                    (0,0), AlphaMask(Solid(say_name_box_color), Frame("portrait-mode-ui/ui/say-alphamask.png")),
                    (0,0), "portrait-mode-ui/ui/say-dropshadow.png",
                    (scale_p(50), scale_p(50)), who
                ),
                saybox_namebox_transform(
                    xoffset=xoffset,
                    yoffset=yoffset,
                    yoffset_transform=40,
                    degs = 10)
                ),
            (0,0), AlphaMask(Solid(say_dialog_box_color_1), Frame("portrait-mode-ui/ui/say-alphamask.png")),
            (0,0), AlphaMask(Solid(say_dialog_box_color_2), Frame("portrait-mode-ui/ui/say-alphamask-gradient.png")),
            (0,0), At(AlphaMask(SideImage(), Frame("portrait-mode-ui/ui/say-alphamask-gradient.png")), saybox_side_image_transform),
            (0,0), "portrait-mode-ui/ui/say-dropshadow.png"
        ), None
Last edited by trajano on Thu Jul 25, 2019 11:56 pm, edited 1 time in total.

trajano
Regular
Posts: 60
Joined: Sun Jun 16, 2019 7:59 pm
Github: trajano
Contact:

Re: How to access a transform inside a named store?

#2 Post by trajano » Thu Jul 25, 2019 11:56 pm

Solved:

Code: Select all

renpy.store
stores the values

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], minyan