Millisecond Forums

selection of a shape for branching

https://forums.millisecond.com/Topic33508.aspx

By peter - 11/25/2021

Hi all, am trying to use mouse position over a shape as a validresponse for branching.
I am trying to use mouse position over three shapes (start, start2, start3) to branch from trial.choice to trial.TL_high.
Can anyone see what I am doing wrong please
 
<values>
/ x = -1
/ y = -1
/ trialcounter = 0
/ reinforcement = 0
/ agency = 0
/ iteration = 0
</values>



<block search>
/ trials = [1-10 = search]
</block>


<trial search>
/ stimulustimes = [1=clearscreen, bord, viewhole, hoop]
/ ontrialbegin = [picture.bord.hposition = 1px * mouse.x;picture.bord.vposition = 1px * mouse.y; picture.hoop.width = picture.hoop.width -.2%; values.iteration = values.iteration +1]
/ inputdevice = mouse
/ validresponse = (mousemove)
/ branch = [if (values.iteration == 430) {
  trial.choice;
    } else {
   trial.search;
  }
]
/timeout =1
/ recorddata = false
</trial>


** NOTE start, start2, start3 are shape objects **

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>
                        

<trial TL_high>
/ ontrialbegin = [values.x = mouse.x; values.y = mouse.y; values.agency=1]
/ ontrialbegin = [trial.TL_high.insertstimulustime(sound.high, 100)]
/ stimulustimes = [1=clearscreen]
/ timeout= (100)
/ recorddata = true
</trial>
        
<sound high>
/items = high
/playthrough = true
/select = noreplace
</sound>

<item high>
/1 = "wave_high_fr1000.wav"
</item>
                    
                                            
                        
<shape start>
/ shape = circle
/ color = (0, 0, 200)
/ size = (100, 100)
/ position = (50%, 50%)
</shape>

<shape start2>
/ shape = circle
/ color = (0, 200, 0)
/ size = (400, 400)
/ position = (50%, 50%)
</shape>

<shape start3>
/ shape = circle
/ color = (200, 0, 0)
/ size = (800, 800)
/ position = (50%, 50%)
</shape>

<picture hoop>
/ items = ("hoop.png")
/ erase = false
/ width = 100%
/ height = 100%
</picture>

<picture viewhole>
/ items = ("Hole2.png")
/ erase = false
/ size=(3000, 3000)
</picture>

<picture bord>
/ items = ("bord4.jpg")
/ erase = false
/ size=(5000, 5000)
</picture>
By Dave - 11/25/2021

First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   
By peter - 11/25/2021

Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?
By Dave - 11/25/2021

peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.
By peter - 11/25/2021

Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 
By Dave - 11/25/2021

peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?

By peter - 11/25/2021

Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?
By Dave - 11/25/2021

peter - 11/25/2021

sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate Euclidean distance from screen center (or whatever else the common center point is, the circles are concentric after all) and do whatever you need to do based on that.


<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%)
/ txcolor = white
/ txbgcolor = black
/ canvasaspectratio = (4,3)
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = 0px
/ centery = 0px
</values>

<expressions>
/ distance = sqrt((values.x - values.centerx) * (values.x - values.centerx) + (values.y - values.centery) * (values.y- values.centery))
</expressions>

<expt>
/ onexptbegin = [
    values.centerx = display.canvaswidth/2;
    values.centery = display.canvasheight/2;
]
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [
    values.x=trial.start.responsex;
    values.y=trial.start.responsey;
]
/ branch = [
    return trial.move;
]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialbegin = [
    if (expressions.distance > shape.66pct.height/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else if (expressions.distance > shape.33pct.height/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ ontrialend = [
    values.x=trial.move.responsex;
    values.y=trial.move.responsey;
]
/ branch = [if (trial.move.response=="lbuttondown") {
        return trial.end;
    } else if (trial.move.response == "rbuttondown") {
        return trial.pause;
    } else if (trial.move.response == "mousemove") {
        return trial.move;
    };
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 0.33px * display.canvasheight
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 0.66px * display.canvasheight
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 0.99px * display.canvasheight
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [
    values.x=trial.pause.responsex;
    values.y=trial.pause.responsey;
]
/ branch = [if (trial.pause.response=="lbuttondown") {
        return trial.move;
    } else {
        return trial.pause;
    };
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
/ txbgcolor = transparent
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>
By peter - 11/25/2021

Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate euclidean distance from screen center and do whatever you need to do based on that.

<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%, true)
/ txcolor = white
/ txbgcolor = black
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
/ mirrorx = false // mirror horizontally
/ mirrory = false// mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.move.responsex - values.centerx) * (trial.move.responsex - values.centerx) + (trial.move.responsey - values.centery) * (trial.move.responsey - values.centery))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
values.y=trial.move.responsey;
    if (expressions.distance <= shape.33pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    } else if (expressions.distance >= shape.66pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
return trial.end;
} else if (trial.move.response == "rbuttondown") {
return trial.pause;
} else if (trial.move.response == "mousemove") {
trial.move;
};
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 33%
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 66%
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 99%
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
return trial.move;
} else {
return trial.pause;
};
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

good point, i will look at your code and get my head around it
big thanks for all your help 
By peter - 11/25/2021

peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate euclidean distance from screen center and do whatever you need to do based on that.

<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%, true)
/ txcolor = white
/ txbgcolor = black
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
/ mirrorx = false // mirror horizontally
/ mirrory = false// mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.move.responsex - values.centerx) * (trial.move.responsex - values.centerx) + (trial.move.responsey - values.centery) * (trial.move.responsey - values.centery))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
values.y=trial.move.responsey;
    if (expressions.distance <= shape.33pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    } else if (expressions.distance >= shape.66pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
return trial.end;
} else if (trial.move.response == "rbuttondown") {
return trial.pause;
} else if (trial.move.response == "mousemove") {
trial.move;
};
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 33%
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 66%
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 99%
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
return trial.move;
} else {
return trial.pause;
};
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

good point, i will look at your code and get my head around it
big thanks for all your help 

yes that looks like all the eliments are there . thanks again 
By Dave - 11/25/2021

peter - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate euclidean distance from screen center and do whatever you need to do based on that.

<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%, true)
/ txcolor = white
/ txbgcolor = black
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
/ mirrorx = false // mirror horizontally
/ mirrory = false// mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.move.responsex - values.centerx) * (trial.move.responsex - values.centerx) + (trial.move.responsey - values.centery) * (trial.move.responsey - values.centery))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
values.y=trial.move.responsey;
    if (expressions.distance <= shape.33pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    } else if (expressions.distance >= shape.66pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
return trial.end;
} else if (trial.move.response == "rbuttondown") {
return trial.pause;
} else if (trial.move.response == "mousemove") {
trial.move;
};
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 33%
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 66%
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 99%
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
return trial.move;
} else {
return trial.pause;
};
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

good point, i will look at your code and get my head around it
big thanks for all your help 

yes that looks like all the eliments are there . thanks again 

FYI, I've cleaned up the example code some. Updated code is in edited post above.
By peter - 12/1/2021

peter - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate euclidean distance from screen center and do whatever you need to do based on that.

<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%, true)
/ txcolor = white
/ txbgcolor = black
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
/ mirrorx = false // mirror horizontally
/ mirrory = false// mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.move.responsex - values.centerx) * (trial.move.responsex - values.centerx) + (trial.move.responsey - values.centery) * (trial.move.responsey - values.centery))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
values.y=trial.move.responsey;
    if (expressions.distance <= shape.33pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    } else if (expressions.distance >= shape.66pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
return trial.end;
} else if (trial.move.response == "rbuttondown") {
return trial.pause;
} else if (trial.move.response == "mousemove") {
trial.move;
};
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 33%
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 66%
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 99%
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
return trial.move;
} else {
return trial.pause;
};
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

good point, i will look at your code and get my head around it
big thanks for all your help 

yes that looks like all the eliments are there . thanks again 

hi, i am almost getting this to work now, your script contained much of what I needed but was not quite what I needed in of itsself.

in essence. I am trying to get the bellow branching to work constantly.
I need it to branch based on values of expressions.distance that are higher than some values yet lower than others.  So within a  range of expressions.distance relative to the shape items (100pct, 75pct, 50pct, 25pct)
Can you see what i am doin wrong please? 
Many thanks
Peter

<trial choice>
/ stimulusframes = [1=clearscreen, 100pct, 75pct, 50pct, 25pct]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
     else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
     else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
     else {trial.choice}]
/ timeout = 1
/ recorddata = false
/ ontrialend =[values.x =0; values.y= 0]
</trial>
By Dave - 12/1/2021

peter - 12/1/2021
peter - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate euclidean distance from screen center and do whatever you need to do based on that.

<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%, true)
/ txcolor = white
/ txbgcolor = black
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
/ mirrorx = false // mirror horizontally
/ mirrory = false// mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.move.responsex - values.centerx) * (trial.move.responsex - values.centerx) + (trial.move.responsey - values.centery) * (trial.move.responsey - values.centery))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
values.y=trial.move.responsey;
    if (expressions.distance <= shape.33pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    } else if (expressions.distance >= shape.66pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
return trial.end;
} else if (trial.move.response == "rbuttondown") {
return trial.pause;
} else if (trial.move.response == "mousemove") {
trial.move;
};
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 33%
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 66%
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 99%
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
return trial.move;
} else {
return trial.pause;
};
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

good point, i will look at your code and get my head around it
big thanks for all your help 

yes that looks like all the eliments are there . thanks again 

hi, i am almost getting this to work now, your script contained much of what I needed but was not quite what I needed in of itsself.

in essence. I am trying to get the bellow branching to work constantly.
I need it to branch based on values of expressions.distance that are higher than some values yet lower than others.  So within a  range of expressions.distance relative to the shape items (100pct, 75pct, 50pct, 25pct)
Can you see what i am doin wrong please? 
Many thanks
Peter

<trial choice>
/ stimulusframes = [1=clearscreen, 100pct, 75pct, 50pct, 25pct]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
     else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
     else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
     else {trial.choice}]
/ timeout = 1
/ recorddata = false
/ ontrialend =[values.x =0; values.y= 0]
</trial>

Once again: Please provide code that can actually be run and examined.
By peter - 12/1/2021

Dave - 12/1/2021
peter - 12/1/2021
peter - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
peter - 11/25/2021
Dave - 11/25/2021
First, if code you post requires external files to run, provide the files please.

Second, you should at least give a short overview what the code is supposed to do in the first place. That isn't obvious, especially not for code that does not work.

The only thing I can say without being actually able to run the script and examine things more closely is that

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == start) trial.TL_high]
/ branch = [if (trial.choice.response == start2) trial.TL_high]
/ branch = [if (trial.choice.response == start3) trial.TL_high]
</trial>

is wrong and ought to read

<trial choice>
/ stimulustimes = [1=clearscreen; 10=start3; 10=start2; 10=start]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ inputdevice = mouseover
/ validresponse = (start, start2, start3)
/ recorddata = true
/ branch = [if (trial.choice.response == "start") trial.TL_high]
/ branch = [if (trial.choice.response == "start2") trial.TL_high]
/ branch = [if (trial.choice.response == "start3") trial.TL_high]
</trial>
   

Yes of course it should what was I thinking. 

The script is supposed to work thus:
In  trial.search i use the mouse to move the board around (under the view hole) until the trial ends after a number of iterations. That works fine.
Then trail.choice begins. In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3), this should then trigger the start of a new trial, that works now but only if the mouse/cursor is moving at the start of trial.choice

Is it possible to get the mouse/curser to trigger the shape object (start start2 start3) even if the mouse is not moving?

> In trial.choice the curser/mouse starts the trial on a given shape object (start start2 start3)

Not clear to me for what trial choice is needed at all then.

basically I need the to branch to three different trials based on where the curser is at the end of  trial.choice. Only one was branch (trial.TL_high) was included on the demmo to cut down one script size I sent you. 

> basically I need the to branch to three different trials based on where the curser is at the end of trial.choice.

No, you just -- one post prior -- said that the cursor is on a given shape object at the *start* (not end) of trial choice. So, again, why is trial.choice needed? You know the cursor position at the end of your X iterations of trial.search, so why don't you /branch from trial.search to wherever you need to go based on the cursor position?


sorry yes i see my error. But end or start, trial.choice only does one thing. it takes the position of the mouse and activates a circle. 
I went for this approach because the cursor positions that we intend to use are complicated (many concentric circles, more than in the example I sent) using cursor position (x and y) would require uploading a large matrix file representing the image that we want map onto . Can inquisist do that?

Why does that require a large matrix? Seems to me you can simply calculate euclidean distance from screen center and do whatever you need to do based on that.

<defaults>
/ inputdevice = mouse
/ screencolor = black
/ fontstyle = ("Verdana", 2.50%, true)
/ txcolor = white
/ txbgcolor = black
</defaults>

<values>
/ x = 0px
/ y = 0px
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
/ mirrorx = false // mirror horizontally
/ mirrory = false// mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.move.responsex - values.centerx) * (trial.move.responsex - values.centerx) + (trial.move.responsey - values.centery) * (trial.move.responsey - values.centery))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<shape center>
/ shape = rectangle
/ size = (5px, 5px)
/ position = (50%, 50%)
/ erase = false
/ color = magenta
</shape>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
values.y=trial.move.responsey;
    if (expressions.distance <= shape.33pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = black;
        shape.99pct.color = black;
    } else if (expressions.distance >= shape.66pct.heightpx/2) {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = blue;
    } else {
        shape.33pct.color = red;
        shape.66pct.color = green;
        shape.99pct.color = black;
    };
]
/ stimulusframes = [1=clearscreen, 99pct, 66pct, 33pct, center, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
return trial.end;
} else if (trial.move.response == "rbuttondown") {
return trial.pause;
} else if (trial.move.response == "mousemove") {
trial.move;
};
]
/ recorddata = false
</trial>

<shape 33pct>
/ shape = circle
/ color = black
/ height = 33%
/ erase = false
</shape>

<shape 66pct>
/ shape = circle
/ color = black
/ height = 66%
/ erase = false
</shape>

<shape 99pct>
/ shape = circle
/ color = black
/ height = 99%
/ erase = false
</shape>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
return trial.move;
} else {
return trial.pause;
};
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%> | distance=<%expressions.distance%>")
/ position = (50%, 5%)
/ size = (40%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

good point, i will look at your code and get my head around it
big thanks for all your help 

yes that looks like all the eliments are there . thanks again 

hi, i am almost getting this to work now, your script contained much of what I needed but was not quite what I needed in of itsself.

in essence. I am trying to get the bellow branching to work constantly.
I need it to branch based on values of expressions.distance that are higher than some values yet lower than others.  So within a  range of expressions.distance relative to the shape items (100pct, 75pct, 50pct, 25pct)
Can you see what i am doin wrong please? 
Many thanks
Peter

<trial choice>
/ stimulusframes = [1=clearscreen, 100pct, 75pct, 50pct, 25pct]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
     else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
     else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
     else {trial.choice}]
/ timeout = 1
/ recorddata = false
/ ontrialend =[values.x =0; values.y= 0]
</trial>

Once again: Please provide code that can actually be run and examined.

ok apologies  


<port Trial_start_signal>
/ port = LPT3
/ subport = data
/ items = ("11111111")
</port>

<port Trial_end_signal>
/ port = LPT3
/ subport = data
/ items = ("00000001")
</port>

<port zero_signal>
/ port = LPT3
/ subport = data
/ items = ("00000000")
</port>

<port TL_signal_high>
/ port = LPT3
/ subport = data
/ items = ("10001000")
</port>

<port NS_signal>
/ port = LPT3
/ subport = data
/ items = ("10000100")
</port>

<port Agency_signal>
/ port = LPT3
/ subport = data
/ items = ("00001000")
</port>


<defaults>
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/ lptaddresses = (lpt3=DFB8)
/ inputdevice = mouse
/ screencolor = black
</defaults>

***************************************************************
<values>
/ completed = 0
/ groupnumber = 0
/ response = 0
/ latencyC = 0
/ age = 0
/ gender = 0
/ Qresponse = 0
/ trialcounter = 0
/ reinforcement = 0
/ agency = 0
/ iteration = 0
/ x = 0px
/ y = 0px
/ mirrorx = true // mirror horizontally
/ mirrory = true // mirror vertically
/ centerx = (display.canvaswidth)/2
/ centery = (display.canvasheight)/2
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
/ distance = sqrt((trial.choice.responsex - values.centerx) * (trial.choice.responsex - values.centerx) + (trial.choice.responsey - values.centery) * (trial.choice.responsey - values.centery))
</expressions>

*********************************************************************************************************************************
<block practice>
/ trials = [1-5 = search]
</block>


<trial search>
/ stimulustimes = [1=clearscreen, Trial_start_signal; 10 = zero_signal]
/ inputdevice = mouse
/ validresponse = (mousemove)
/ branch = [trial.search_all]
/timeout =.01
/ recorddata = false
</trial>

<trial search_all>
/ stimulustimes = [1=clearscreen, bord, viewhole, hoop]
/ ontrialbegin = [values.x=trial.search_all.responsex; values.y=trial.search_all.responsey; picture.hoop.width = picture.hoop.width -.2%; values.iteration = values.iteration +1]
/ inputdevice = mousekey 
/ validresponse = (mousemove)
/ branch = [if (values.iteration == 430) {
  trial.choice;
    } else {
   trial.search_all;
  }
]
/timeout =1
/ recorddata = false
</trial>


        this is the bit that is playingup

<trial choice>
/ stimulusframes = [1=clearscreen, 100pct, 75pct, 50pct, 25pct]
/ ontrialbegin = [values.iteration = 0; picture.hoop.width = 100%]
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
     else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
     else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
     else {trial.choice}]
/ timeout = 1
/ recorddata = false
/ ontrialend =[values.x =0; values.y= 0]
</trial>

    
********************************************************************TL*****************************************************************
       <trial TL_high>
       / ontrialbegin = [values.x = mouse.x; values.y = mouse.y; values.agency=1]
       / ontrialbegin = [trial.TL_high.insertstimulustime(sound.high, 100)]
         / stimulustimes = [1=clearscreen, TL_signal_high; 10 = zero_signal]
       / timeout= (10)
       / recorddata = true
         / branch = [likert.agency]
      </trial>
        
             <sound high>
        /items = high
        /playthrough = true
        /select = noreplace
        </sound>

        <item high>
        /1 = "wave_high_fr1000.wav"
        </item>
            
***********************************************************************************************************************************    
      <trial NS>
      / ontrialbegin = [values.x = mouse.x; values.y = mouse.y; values.agency=2]
         / ontrialbegin = [trial.TL_high.insertstimulustime(sound.high, 000)]
      / stimulustimes = [1=clearscreen, NS_signal; 10 = zero_signal]
      / timeout= (10)
      / recorddata = true
         / branch = [likert.agency]
      </trial>
        

***************************************************************
[/quote][quote]
****************************************************************

<likert agency>
/ stimulusframes=[1=clearscreen, Agency_signal; 10 = zero_signal]
/ inputdevice = keyboard
/ anchors=[1="excellent"; 2="good"; 3="satisfactory"; 4="bad"; 5="aweful"]
/ position=(50, 50)
/ branch = [trial.cent]
/ mouse=true
/ recorddata = true
</likert>
                        

<trial cent>
/ stimulusframes = [1= clearscreen, bord, viewhole, center]
/ ontrialbegin = [values.x=trial.search_all.responsex; values.y=trial.search_all.responsey]
/ inputdevice = mouse
/ validresponse = (mousemove)
/ branch = [if (mouse.x > 0.45*display.width && mouse.x < 0.55*display.width && mouse.y > 0.45*display.height && mouse.y < 0.55*display.height) {
trial.end;} else {trial.cent;}]
/ recorddata = false
</trial>

  <trial end>
  / stimulustimes = [1=clearscreen, Trial_end_signal, bord, viewhole, center; 10 = zero_signal]
  / inputdevice = mouse
    / recorddata = false
  / timeout= 1
  </trial>

    
<shape center>
/ shape = circle
/ color = white
/ height = 1%
/ erase = false
</shape>

****************************************************************************************************************************************

<picture bord>
/ items = ("bord4.jpg")
/ erase = false
/ size=(5000, 5000)
/ hposition = expressions.x
/ vposition = expressions.y
</picture>

<picture hoop>
/ items = ("hoop.png")
/ erase = false
/ width = 100%
/ height = 100%
</picture>

<picture high1>
/ items = ("high.jfif")
/ erase = false
/ width = 100%
/ height = 100%
</picture>


<picture viewhole>
/ items = ("Hole2.png")
/ erase = false
/ size=(3000, 3000)
</picture>


<shape 25pct>
/ shape = circle
/ color = black
/ height = 25%
/ erase = false
</shape>

<shape 50pct>
/ shape = circle
/ color = white
/ height = 50%
/ erase = false
</shape>

<shape 75pct>
/ shape = circle
/ color = black
/ height = 75%
/ erase = false
</shape>

<shape 100pct>
/ shape = circle
/ color = white
/ height = 100%
/ erase = false
</shape>
By Dave - 12/1/2021

Please don't paste entire scripts into a post's body and if a script requires external files to run -- as yours does -- provide those files along with the script. Ideally, put everything in a ZIP archive and attach said archive to your post (+Insert -> Add File...).
By peter - 12/1/2021

Dave - 12/1/2021
Please don't paste entire scripts into a post's body and if a script requires external files to run -- as yours does -- provide those files along with the script. Ideally, put everything in a ZIP archive and attach said archive to your post (+Insert -> Add File...).

no worries 
By Dave - 12/1/2021

peter - 12/1/2021
Dave - 12/1/2021
Please don't paste entire scripts into a post's body and if a script requires external files to run -- as yours does -- provide those files along with the script. Ideally, put everything in a ZIP archive and attach said archive to your post (+Insert -> Add File...).

no worries 

<expressions>
...
/ distance = sqrt((trial.choice.responsex - values.centerx) * (trial.choice.responsex - values.centerx) + (trial.choice.responsey - values.centery) * (trial.choice.responsey - values.centery))
</expressions>

This is obviously wrong. No response occurs in trial.choice. The relevant responses occur in trial.search_all. So the distance you calculate there has no meaning at all and it will never change.

By peter - 12/1/2021

Dave - 12/1/2021
peter - 12/1/2021
Dave - 12/1/2021
Please don't paste entire scripts into a post's body and if a script requires external files to run -- as yours does -- provide those files along with the script. Ideally, put everything in a ZIP archive and attach said archive to your post (+Insert -> Add File...).

no worries 

<expressions>
...
/ distance = sqrt((trial.choice.responsex - values.centerx) * (trial.choice.responsex - values.centerx) + (trial.choice.responsey - values.centery) * (trial.choice.responsey - values.centery))
</expressions>

This is obviously wrong. No response occurs in trial.choice. The relevant responses occur in trial.search_all. So the distance you calculate there has no meaning at all and it will never change.


Arrrr i see 
i was assuming it was the in trial coding that was wrong
big thanks for that 
Peter
By Dave - 12/1/2021

peter - 12/1/2021
Dave - 12/1/2021
peter - 12/1/2021
Dave - 12/1/2021
Please don't paste entire scripts into a post's body and if a script requires external files to run -- as yours does -- provide those files along with the script. Ideally, put everything in a ZIP archive and attach said archive to your post (+Insert -> Add File...).

no worries 

<expressions>
...
/ distance = sqrt((trial.choice.responsex - values.centerx) * (trial.choice.responsex - values.centerx) + (trial.choice.responsey - values.centery) * (trial.choice.responsey - values.centery))
</expressions>

This is obviously wrong. No response occurs in trial.choice. The relevant responses occur in trial.search_all. So the distance you calculate there has no meaning at all and it will never change.


Arrrr i see 
i was assuming it was the in trial coding that was wrong
big thanks for that 
Peter

> i was assuming it was the in trial coding that was wrong

That is why I ask for runnable code instead of isolated code snippets. That said, the trial.choice code is not without minor issues.

(1) The conditions aren't mutually exclusive. For example, if distance is exactly equal to to shape.50pct.heightpx/2, this meets both the first as well as the second condition:

/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
     else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
     else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
     else {trial.choice}]

(2) If none of the conditions are true, trial.choice ends up looping infinitely.

/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
  else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
  else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
  else {trial.choice}]


By peter - 12/1/2021

I see you point ,
thank you for all your help 
By peter - 12/2/2021

peter - 12/2/2021
I see you point ,
thank you for all your help 

>(1) The conditions aren't mutually exclusive. For example, if distance is exactly equal to to shape.50pct.heightpx/2, this meets both the first as well as the second condition: 
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
  else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
  else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
  else {trial.choice}]

Do you have any suggestions as to how to resolve the above issue?
for example can i transform expressions.distance into a screen percentage?
Many thanks
Peter
By Dave - 12/2/2021

peter - 12/2/2021
peter - 12/2/2021
I see you point ,
thank you for all your help 

>(1) The conditions aren't mutually exclusive. For example, if distance is exactly equal to to shape.50pct.heightpx/2, this meets both the first as well as the second condition: 
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
  else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
  else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
  else {trial.choice}]

Do you have any suggestions as to how to resolve the above issue?
for example can i transform expressions.distance into a screen percentage?
Many thanks
Peter

> for example can i transform expressions.distance into a screen percentage?

You can, but that obviously does nothing to resolve the issue.

The problem is that you have "is equal to" in both conditions. Just define ranges that are mutually exclusive.

branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance < shape.50pct.heightpx/2) {trial.TL_high}
  else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance < shape.75pct.heightpx/2) {trial.NS}
  else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
  else {trial.choice}]

You just need to decide which of the conditions should include the equality case and which shouldn't.
By peter - 12/2/2021

Dave - 12/2/2021
peter - 12/2/2021
peter - 12/2/2021
I see you point ,
thank you for all your help 

>(1) The conditions aren't mutually exclusive. For example, if distance is exactly equal to to shape.50pct.heightpx/2, this meets both the first as well as the second condition: 
/ branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance <= shape.50pct.heightpx/2) {trial.TL_high}
  else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance <= shape.75pct.heightpx/2) {trial.NS}
  else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
  else {trial.choice}]

Do you have any suggestions as to how to resolve the above issue?
for example can i transform expressions.distance into a screen percentage?
Many thanks
Peter

> for example can i transform expressions.distance into a screen percentage?

You can, but that obviously does nothing to resolve the issue.

The problem is that you have "is equal to" in both conditions. Just define ranges that are mutually exclusive.

branch = [if (expressions.distance >= shape.25pct.heightpx/2 && expressions.distance < shape.50pct.heightpx/2) {trial.TL_high}
  else if (expressions.distance >= shape.50pct.heightpx/2 && expressions.distance < shape.75pct.heightpx/2) {trial.NS}
  else if (expressions.distance >= shape.75pct.heightpx/2 && expressions.distance <= shape.100pct.heightpx/2) {trial.TL_high}
  else {trial.choice}]

You just need to decide which of the conditions should include the equality case and which shouldn't.

I see well that's nice and simple then
thanks for your help
Peter