selection of a shape for branching


Author
Message
peter
peter
posted Last Week HOT
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
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>

Dave
Dave
Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)
Group: Administrators
Posts: 11K, Visits: 76K
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>
   

Edited Last Week by Dave
peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
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?
Dave
Dave
Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)
Group: Administrators
Posts: 11K, Visits: 76K
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.
peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
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. 
Dave
Dave
Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)
Group: Administrators
Posts: 11K, Visits: 76K
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?


peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
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?

Dave
Dave
Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)
Group: Administrators
Posts: 11K, Visits: 76K
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>

Edited Last Week by Dave
peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
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 
peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
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 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search