+x+x+x+x+x+x+x+x+x+x+xFirst, 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>