We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Accessing puzzles variable from separate script running inside child iframe?

Home Forums General Questions Accessing puzzles variable from separate script running inside child iframe?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #55750
    Crunch
    Customer

    How could I access a variable set in puzzles from within a separate script loaded in child iframe (same origin, same server)?
    Help! thanks

    #55755
    kdv
    Participant

    Do you want just to read this variable?

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #55763
    Crunch
    Customer

    yes. Just read the value.

    As a workaround until i can find something better, I called a puzzles function that returns the value of the variable I want to work with on the external script – again, external script is located in child frame of my main verge app.

    var xy = parent.window.v3d.puzzles.procedures.getdata(“id”);

    Attachments:
    You must be logged in to view attached files.
    #55768
    kdv
    Participant

    It looks like a solution not workaround ))) Using v3d.puzzles as an intermediate link you can read/write any variable… And according to your screenshot you know about it. What else do you want?

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #55769
    Crunch
    Customer

    how so? say i wanted to just read a variable i have in puzzles, whats the syntax? Assume vname is variable set in puzzles to “hello verge”.

    window.v3d.puzzles.variable (vname);
    window.v3d.puzzle.VARS[‘vname’];
    ?

    thx in advance

    #55771
    kdv
    Participant

    read
    const dir = v3d.puzzles.variables.direction;
    write
    v3d.puzzles.variables.direction = 150;

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.