Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 107K
|
I don't know where the specific mistake is in your modified code (which I don't have). In the example where I outlined the solution, the part relevant to your question is this:
<trial clicktrial> ... / ontrialend = [values.solution_1_applicable = values.solution_1_applicable * values.response_applies_to_solution_1; values.solution_2_applicable = values.solution_2_applicable * values.response_applies_to_solution_2; values.solution_3_applicable = values.solution_3_applicable * values.response_applies_to_solution_3; ] ... </trial>
You multiple the "applicable solutions* by the solutions tied to the response. This will always give you the *most restricted* version. Suppose you start with all three solutions available and select a response that applies to solutions #1 and #3:
Trial #1 Start: 1 - 1 - 1 Response: 1 - 0 - 1 Result: 1 - 0 - 1
Now, in the next trial, only solutions #1 and #3 are still in the cards:
Trial #2: Start: 1 - 0 - 1 Response: 0 - 1 - 0 Result: 0 - 0 - 0
and if you select any response option that does not apply to either solution, the response will be judged as wrong (as it should be). This approach should extend straightforwardly to as many solutions as you need. For the case you mention
> In few words, if I click on a corner that identify solution 2, then solutions 3,4 and 1 are all wrong.
Trial #1 Start: 1 - 1 - 1 - 1 Response: 0 - 1 - 0 - 0 Result: 0 - 1 - 0 - 0
And in the next trial, any response that *does not* apply to solution #2 would be marked as wrong:
Trial #2: Start: 0 - 1 - 0 - 0 Response: 1 - 0 - 1 - 1 Result: 0 - 0 - 0 - 0
|
|
|
wsly
|
|
Group: Forum Members
Posts: 10,
Visits: 61
|
Forget the previous one, I managed to modify the script myself.
thank you very much indeed, I have modified the script and now we are close to what we aimed to achieve. Slight issue: if I click on a corner that DOES discriminate a specific solution, i.e.: - 1st click = corner C3 in common with solutions 1,2,3 --> all are still clickable solutions -2nd click = corner C5 belonging to just solution 2 --> solutions 1 and 3 are now incorrect how can I mark the other solutions as wrong?
smth like / ontrialend = [if (trial.complexII_4.response = "a corner which is committed to only one solution") the only clickable corners are those belonging to that solution, all the other corners being marked as wrong..
In few words, if I click on a corner that identify solution 2, then solutions 3,4 and 1 are all wrong. Hope this makes sense....
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 107K
|
Despite thinking about it for a long time, I, however, don't see a way to pull this off reliably other than the one I outlined above. But perhaps Katja can seen another (less "invasive") way to get rid of the overlap problem in the existing codebase -- she is certainly vastly more familiar with the script as-is than I am. Hope this helps.
|
|
|
wsly
|
|
Group: Forum Members
Posts: 10,
Visits: 61
|
Thank you for your reply and your efforts. In fact, the code had been commissioned to Katja B. who wrote it for my research team. I am not sure I can fully understand how to customize the code according to your example, so I might need to pass it on her to be sure that everything run properly and correctly as it is a huge research and everything should be incontestable once we will have our data collected. Thank you very much indeed!!!!!!!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 107K
|
Thanks for the stripped-down example. That makes it somewhat easier to assess. The bottom line, in my opinion, is this: In order to make this work, the whole thing needs to be re-framed to a substantial degree. What you'll want to avoid at any cost is overlapping response objects. Instead, have one -- and only one -- object per corner. In case of the example problem, that means you'd have a total of 19 clickable circles on-screen. A given circle can "belong to" several possible solutions, in some cases as many 3 in the example. In each instance of the <trial>, you'll want to (a) store a the set of solutions the clicked object is part of and then (b) check whether there is overlap in the solutions associated with the selected object and those associated with the *previously* selected objects. As long as that holds true, the response is valid / correct.
To illustrate what I mean, consider a simple example. Suppose you have a rectangle comprised of eight circles on-screen -- named c1 to c8, left to right, top to bottom -- and your objective is to select four of them to highlight a square. There are three solutions: (1) Select c1, c2, c3 and c4 -- the four circles on the top, or (2) select c3, c4, c5 and c6 -- the four middle circles, or (3) the four bottom circles -- c5 to c8. Obviously, the c3 and c4 are part of solutions #1 and# 2, c5 and c6 are part of solutions #2 and 3. In other words: While selecting c1 automatically commits you to a particular solution (#1), selecting e.g. c3 first does not commit you to a single solution yet -- you could still go for #1 or #2. Selecting c4 as the 2nd response also doesn't commit you -- both #1 and #2 are still in the cards at this point, etc.
What is needed is a way to encode which possible solutions each circle applies to. E.g.
<values> ... / c3_applies_to_solution_1 = true / c3_applies_to_solution_2 = true / c3_applies_to_solution_3 = false ... </values>
means that response c3 applies to solution #1 (true), solution #2 (true), but not solution #3 (false). You can then evaluate those properties against the still applicable solutions as you proceed through the trial.
Here's how you would code that:
<values> / c1_applies_to_solution_1 = true / c1_applies_to_solution_2 = false / c1_applies_to_solution_3 = false
/ c2_applies_to_solution_1 = true / c2_applies_to_solution_2 = false / c2_applies_to_solution_3 = false
/ c3_applies_to_solution_1 = true / c3_applies_to_solution_2 = true / c3_applies_to_solution_3 = false
/ c4_applies_to_solution_1 = true / c4_applies_to_solution_2 = true / c4_applies_to_solution_3 = false
/ c5_applies_to_solution_1 = false / c5_applies_to_solution_2 = true / c5_applies_to_solution_3 = true
/ c6_applies_to_solution_1 = false / c6_applies_to_solution_2 = true / c6_applies_to_solution_3 = true
/ c7_applies_to_solution_1 = false / c7_applies_to_solution_2 = false / c7_applies_to_solution_3 = true
/ c8_applies_to_solution_1 = false / c8_applies_to_solution_2 = false / c8_applies_to_solution_3 = true
/ c1_x = 40% / c1_y = 20% / c2_x = 60% / c2_y = 20% / c3_x = 40% / c3_y = 40% / c4_x = 60% / c4_y = 40% / c5_x = 40% / c5_y = 60% / c6_x = 60% / c6_y = 60% / c7_x = 40% / c7_y = 80% / c8_x = 60% / c8_y = 80%
/ solution_1_applicable = true / solution_2_applicable = true / solution_3_applicable = true
/ response_applies_to_solution_1 = true / response_applies_to_solution_2 = true / response_applies_to_solution_3 = true
/ correctcorner_size = 3%
/ possible_solutions = "" / responsestorage = "" / current_response_solutions = "" / response_correct = 0 / committed = "No" / committedsolutionnumber = "" </values>
<block myblock> / trials = [1=starttrial] </block>
<trial starttrial> / ontrialbegin = [values.solution_1_applicable = true; values.solution_2_applicable = true; values.solution_3_applicable = true; values.response_applies_to_solution_1 = true; values.response_applies_to_solution_2 = true; values.response_applies_to_solution_3 = true; shape.selectedcorner.hposition = -10%; shape.selectedcorner.vposition = -10%; ] / stimulusframes = [1=c1,c2,c3,c4,c5,c6,c7,c8,done,debug] / trialduration = 1000 / branch = [trial.clicktrial] </trial>
<text debug> / items = ("Solution #1 applicable: <%values.solution_1_applicable%> | Solution #2 applicable: <%values.solution_2_applicable%> | Solution #3 applicable: <%values.solution_3_applicable%> Response <%trial.clicktrial.response%> applies to #1: <%values.response_applies_to_solution_1%> #2: <%values.response_applies_to_solution_2%> #3: <%values.response_applies_to_solution_3%> Responses: <%values.responsestorage%>") / position = (50%, 10%) / size = (90%, 10%) / erase = false </text>
<text done> / items = ("DONE") / position = (50%, 90%) / erase = false </text>
<trial clicktrial> / stimulusframes = [1=selectedcorner, debug] / validresponse = (c1,c2,c3,c4,c5,c6,c7,c8,done) / isvalidresponse = [!contains(values.responsestorage, trial.clicktrial.response)] / inputdevice = mouse / ontrialend = [values.responsestorage = concat(values.responsestorage, trial.clicktrial.response)] / ontrialend = [ if (trial.clicktrial.response == "c1") { values.response_applies_to_solution_1 = values.c1_applies_to_solution_1; values.response_applies_to_solution_2 = values.c1_applies_to_solution_2; values.response_applies_to_solution_3 = values.c1_applies_to_solution_3; shape.selectedcorner.hposition = values.c1_x; shape.selectedcorner.vposition = values.c1_y; } else if (trial.clicktrial.response == "c2") { values.response_applies_to_solution_1 = values.c2_applies_to_solution_1; values.response_applies_to_solution_2 = values.c2_applies_to_solution_2; values.response_applies_to_solution_3 = values.c2_applies_to_solution_3; shape.selectedcorner.hposition = values.c2_x; shape.selectedcorner.vposition = values.c2_y; }
else if (trial.clicktrial.response == "c3") { values.response_applies_to_solution_1 = values.c3_applies_to_solution_1; values.response_applies_to_solution_2 = values.c3_applies_to_solution_2; values.response_applies_to_solution_3 = values.c3_applies_to_solution_3; shape.selectedcorner.hposition = values.c3_x; shape.selectedcorner.vposition = values.c3_y; }
else if (trial.clicktrial.response == "c4") { values.response_applies_to_solution_1 = values.c4_applies_to_solution_1; values.response_applies_to_solution_2 = values.c4_applies_to_solution_2; values.response_applies_to_solution_3 = values.c4_applies_to_solution_3; shape.selectedcorner.hposition = values.c4_x; shape.selectedcorner.vposition = values.c4_y; }
else if (trial.clicktrial.response == "c5") { values.response_applies_to_solution_1 = values.c5_applies_to_solution_1; values.response_applies_to_solution_2 = values.c5_applies_to_solution_2; values.response_applies_to_solution_3 = values.c5_applies_to_solution_3; shape.selectedcorner.hposition = values.c5_x; shape.selectedcorner.vposition = values.c5_y; }
else if (trial.clicktrial.response == "c6") { values.response_applies_to_solution_1 = values.c6_applies_to_solution_1; values.response_applies_to_solution_2 = values.c6_applies_to_solution_2; values.response_applies_to_solution_3 = values.c6_applies_to_solution_3; shape.selectedcorner.hposition = values.c6_x; shape.selectedcorner.vposition = values.c6_y; }
else if (trial.clicktrial.response == "c7") { values.response_applies_to_solution_1 = values.c7_applies_to_solution_1; values.response_applies_to_solution_2 = values.c7_applies_to_solution_2; values.response_applies_to_solution_3 = values.c7_applies_to_solution_3; shape.selectedcorner.hposition = values.c7_x; shape.selectedcorner.vposition = values.c7_y; }
else if (trial.clicktrial.response == "c8") { values.response_applies_to_solution_1 = values.c8_applies_to_solution_1; values.response_applies_to_solution_2 = values.c8_applies_to_solution_2; values.response_applies_to_solution_3 = values.c8_applies_to_solution_3; shape.selectedcorner.hposition = values.c8_x; shape.selectedcorner.vposition = values.c8_y; }; ]
/ ontrialend = [values.solution_1_applicable = values.solution_1_applicable * values.response_applies_to_solution_1; values.solution_2_applicable = values.solution_2_applicable * values.response_applies_to_solution_2; values.solution_3_applicable = values.solution_3_applicable * values.response_applies_to_solution_3; ]
/ ontrialend = [if (values.solution_1_applicable || values.solution_2_applicable || values.solution_3_applicable) values.response_correct = 1 else values.response_correct = 0; ]
/ branch = [if (values.response_correct == 1) trial.clicktrial else trial.errortrial] </trial>
<trial errortrial> / ontrialbegin = [text.redx.hposition = shape.selectedcorner.hposition; text.redx.vposition = shape.selectedcorner.vposition; ] / stimulusframes = [1=redx] / trialduration = 500 / branch = [trial.starttrial] </trial>
<text redx> / items = ("X") / fontstyle = ("Arial", 5%, true) / txcolor = red / txbgcolor = transparent / erase = true(white) </text>
<shape c1> / shape = circle / color = blue / hposition = values.c1_x / vposition = values.c1_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c2> / shape = circle / color = blue / hposition = values.c2_x / vposition = values.c2_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c3> / shape = circle / color = blue / hposition = values.c3_x / vposition = values.c3_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c4> / shape = circle / color = blue / hposition = values.c4_x / vposition = values.c4_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c5> / shape = circle / color = blue / hposition = values.c5_x / vposition = values.c5_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c6> / shape = circle / color = blue / hposition = values.c6_x / vposition = values.c6_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c7> / shape = circle / color = blue / hposition = values.c7_x / vposition = values.c7_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape c8> / shape = circle / color = blue / hposition = values.c8_x / vposition = values.c8_y / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false </shape>
<shape selectedCorner> / shape = circle / color = yellow / size = (values.correctcorner_size * 0.75, values.correctcorner_size) / erase = false / hposition = -10% / vposition = -10% </shape>
Hope this helps.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 107K
|
Thanks for the stripped-down script. FYI: I am working on / through this, but this isn't exactly trivial.
|
|
|
wsly
|
|
Group: Forum Members
Posts: 10,
Visits: 61
|
here it is, just the code for problem II_4 with the stimuli.
Different solutions have different corners' colors.
I'm in despair, please helpppppppppppp!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :( :( :(
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 107K
|
Since I cannot run that script and actually see what it's supposed to do (I don't have all the image files it requires, obviously), it is of limited use to me, I'm afraid. Can you strip that thing down to a single example and post just that along with the few stimuli needed to actually execute it?
> And is there any way to randomize the order?
No.
> What I need is to code: "if the values of current solution is set to 0 (no corners belonging to that solution already clicked), then the > current solution can be 4 AND 3. Is there such a thing?
Not like that:
if (values.currentsolutionII_4 == 0){ values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3; } else {};
A variable (<values> entry) can take on a single value at any given time. It cannot be equal to both 1 AND 3 at the same time. You'd need two separate variables instead. In the above code, values.currentsolutionII_4 would always end up being set to 3.
|
|
|
wsly
|
|
Group: Forum Members
Posts: 10,
Visits: 61
|
And is there any way to randomize the order? I have added the script so you can check for yourself what i am doing wrong. I thought it was a matter of adding a sort of logical to my conditionals.
if (values.currentsolutionII_4 == 0){ values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3; } else {};
What I need is to code: "if the values of current solution is set to 0 (no corners belonging to that solution already clicked), then the current solution can be 4 AND 3. Is there such a thing?
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 107K
|
Sorry, but the code does not make much sense in isolation. I can tell you this, though: The response options you list in /validresponse are evaluated *in the order given*. I.e., suppose you have two stimuli that overlap on-screen, <shape red> in the background and <shape green> in the foreground as per the /stimulusframes attribute: ---- <shape red> / shape = rectangle / color = red / size = (25%, 25%) / position = (50%, 40%) </shape>
<shape green> / shape = rectangle / color = green / size = (25%, 25%) / position = (55%, 45%) </shape>
<trial mytrial> / stimulusframes = [1=red, green] / inputdevice = mouse / validresponse = (red, green) </trial>
<block myblock> / trials = [1=mytrial] </block> ----
With
/ validresponse = (red, green)
defined in the <trial>, clicking anywhere on the green shape *within the area it overlaps with the red shape* will record the response as "red".
Conversely, defining
/ validresponse = (green, red)
will record a response in the overlapping area as "green".
|
|
|