Reply To: Problems inserting locations from table for selector

PennController for IBEX Forums Support Problems inserting locations from table for selector Reply To: Problems inserting locations from table for selector



I think your code is a little more complex than it needs to be, and maybe doesn’t do exactly what you want it to do. Keep in mind that PennController executes the trial’s script in a linear top-down stream unless you use special commands (such as callback). Your design seems perfectly adapted to a linear execution, so I rewrote your code like this:

Template( variable =>
    newTrial( "trialin" ,
        // Start by creating the image, but don't print it yet
        // Its width will adapt to the screen width (75%)
        newImage("imagefile", variable.Imagein).size("75vw", "auto")
        // All images below this will be 2vw x 2vw, hidden, and in the selector
        // 75% screen width, 75% screen height
        newCanvas("images", "75vw", "75vh") 
            // Place the main image at the center of the Canvas
            .add("center at 50%", "middle at 50%", getImage("imagefile") )
            // Now place the 6 (hidden) AOIs on the Canvas
            .add("center at 25%", "middle at 70%", newImage("aoiLM", "square.png") ) //left.middle
            .add("center at 75%", "top at 90%",    newImage("aoiRL", "square.png") ) //right low
            .add("center at 80%", "middle at 70%", newImage("aoiRM", "square.png") ) //right middle
            .add("center at 27%", "middle at 90%", newImage("aoiLL", "square.png") ) //left low
            .add("center at 27%", "middle at 40%", newImage("aoiLH", "square.png") ) //left high
            .add("center at 75%", "middle at 40%", newImage("aoiRH", "square.png") ) //right high
            // Finally, place a button at the top of the Canvas
            .add("center at 50%", "middle at 0%",  newButton("start") )
            // Use print here only, it will display the Canvas' (non-hidden) content
        // Script will stay on this line until button is clicked, then remove it
        // Button has been clicked: play the audio
        newAudio("audiofile", variable.Audio).play()
        // Start mouse-tracking right away (no wait on Audio)
        // Show this trial's AOIs
        // Script will stay on this line until an AOI is clicked
        // Stop the mouse tracker once an AOI is clicked
        // Stop the audio early in case it hasn't fully played yet
    )//trial end
)//template end

And here are the first two lines of my table:


Hopefully the script and setup above are self-explanatory, but please let me know if you have questions