[SOLVED] How to store XScrollValue to variable?

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
Renpie
Newbie
Posts: 14
Joined: Sat Jul 11, 2015 9:49 am
Contact:

[SOLVED] How to store XScrollValue to variable?

#1 Post by Renpie » Sat Dec 05, 2020 7:38 am

I want to store viewport XScrollValue to variable so when returned to screen it will be set to that earlier value or reset outside of the screen if I want to. How to do that? Right now it writes some memory address to the variable not the value.

Code: Select all

screen viewporttest:
    viewport:
        edgescroll (150, 500)
        xinitial variable
        imagemap:
            hotspot (0, 0, 2560, 720) action [SetVariable("variable", XScrollValue), Return(1)]
EDIT:

Okay, I managed to fix this problem. :o

Code: Select all

screen viewporttest:
    viewport:
        edgescroll (150, 500)
        #xinitial variable
        xadjustment variable
        imagemap: ...
Added xadjustment variable in the screen viewport

Code: Select all

label start:
    #Panning room adjustments
    $ variable = ui.adjustment()
Defined the variable at the start

Code: Select all

$ variable.change(1280) #0 = panned left, 640 = panned middle, 1280 = panned right
And now I can change the value with this code in the text or whatever.

Thanks me.
Tags, viewport panning, viewport scrolling, storing viewport scrolling

Post Reply

Who is online

Users browsing this forum: No registered users