raven
|
|
Group: Forum Members
Posts: 52,
Visits: 110
|
Hi Dave, I have a script running a block of 10 trials where each trial displays a stimulus on screen. Participants need to press "Y" if they think the stimulus will be correct, or "N" if incorrect. After their input is entered, a feedback screen should be shown after each if the trials, which displays their score of correct guesses and overall accuracy. However, even after using the /branch function, I can't seem to get the feedback screen to display as it just goes straight to the next trial after input. Any ideas?
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+xHi Dave, I have a script running a block of 10 trials where each trial displays a stimulus on screen. Participants need to press "Y" if they think the stimulus will be correct, or "N" if incorrect. After their input is entered, a feedback screen should be shown after each if the trials, which displays their score of correct guesses and overall accuracy. However, even after using the /branch function, I can't seem to get the feedback screen to display as it just goes straight to the next trial after input. Any ideas? Provide your code, then I can tell you where and what your mistakes are.
|
|
|
raven
|
|
Group: Forum Members
Posts: 52,
Visits: 110
|
Hi Dave,
Here's the section of code that doesn't branch to the feedback screen:
<trial one> / clearscreen / stimulusframes = [1=stimulusa, stimulusb, stimulusc] / inputdevice = keyboard / validresponse = ("y", "n") / correctresponse = ("n") / branch = [ if (trial.one == "n") { trial.fb } ] / timeout = 3000 </trial>
And here's the code for the feedback screen:
<trial fb> / clearscreen / stimulusframes = [1=fbscreen] / timeout = 8000 </trial>
Thanks!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+xHi Dave, Here's the section of code that doesn't branch to the feedback screen: <trial one> / clearscreen / stimulusframes = [1=stimulusa, stimulusb, stimulusc] / inputdevice = keyboard / validresponse = ("y", "n") / correctresponse = ("n") / branch = [ if (trial.one == "n") { trial.fb } ] / timeout = 3000 </trial> And here's the code for the feedback screen: <trial fb> / clearscreen / stimulusframes = [1=fbscreen] / timeout = 8000 </trial> Thanks! / branch = [ if ( trial.one == "n") { trial.fb } ] trial.one returns nothing, and especially not the response given. What you want is the trial's responsetext property, i.e. trial.one.responsetext. / branch = [ if ( trial.one.responsetext == "n") { trial.fb } ] https://www.millisecond.com/support/docs/current/html/language/properties/responsetext.htm
|
|
|
raven
|
|
Group: Forum Members
Posts: 52,
Visits: 110
|
Thanks Dave, that works perfectly!
Do you have any ideas on how to go about displaying the score and accuracy on the feedback screen?
For example, something that says they got 8 out of 10 responses correct so far. But, the feedback screen needs to update after each trial.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+xThanks Dave, that works perfectly! Do you have any ideas on how to go about displaying the score and accuracy on the feedback screen? For example, something that says they got 8 out of 10 responses correct so far. But, the feedback screen needs to update after each trial. This has been covered countless times here; also see the "Programming with IQScript" chapter in the programmer's manual ( https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf ). In short: <values> / n = 0 / ncorrect = 0 </values>
<block example> / trials = [1-10 = trial.one] </block>
<trial one> / ontrialend = [ values.n += 1; values.ncorrect += trial.one.correct; ] / stimulusframes = [1=clearscreen, stimulusa, stimulusb, stimulusc] / inputdevice = keyboard / validresponse = ("y", "n") / correctresponse = ("n") / branch = [ if (trial.one.responsetext == "n") { trial.fb } ] / timeout = 3000 </trial>
<trial fb> / stimulusframes = [1=clearscreen, fbscreen] / timeout = 8000 </trial>
<text stimulusa> / items = ("A") / position = (40%, 50%) </text>
<text stimulusb> / items = ("B") / position = (50%, 50%) </text>
<text stimulusc> / items = ("C") / position = (60%, 50%) </text>
<text fbscreen> / items = ("So far, you got <%values.ncorrect%> out of <%values.n%> trials correct.") </text> All the ingredients of the above, by the way, are things we have discussed before e.g. here: https://forums.millisecond.com/Topic35358.aspx
|
|
|
raven
|
|
Group: Forum Members
Posts: 52,
Visits: 110
|
|
|
|
raven
|
|
Group: Forum Members
Posts: 52,
Visits: 110
|
Hi Dave,
Following on from the previous query, is there a better/more efficient way to display the difference between the last and current score on the feedback page?
For example, if I have the following code, it doesn't seem to give the correct difference value on the feedback screen for each consecutive trial. Perhaps because it doesn't reset the difference back to 0 properly after each trial, even though I've included values.difference = 0.
<values> / n = 0 / ncorrect = 0 / difference = 0 </values>
<list lista> / items = (1, 1, -1) / selectionmode = random / replace = false </list>
<list listb> / items = (1, -1, -1) / selectionmode = random / replace = false </list>
<block start> / trials = [1-10 = noreplace(trial.one, trial.two)] </block>
<trial one> / ontrialend = [ values.n += 1; values.ncorrect += trial.one.correct;
if (trial.one.correct) { values.multiplier = list.lista.nextvalue; values.score += values.multiplier * 500; // if response is correct, increase the score by 500 values.difference = 0; values.difference += 500; // this should reflect the difference between the new and old score, either +500 or -500 } else { values.multiplier = list.lista.nextvalue; values.score += values.multiplier * 250; // if response is incorrect, increase the score by only 250 values.difference = 0; values.difference += 250; } ] ] / stimulusframes = [1=clearscreen, stimulusa, stimulusb, stimulusc] / inputdevice = keyboard / validresponse = ("y", "n") / correctresponse = ("n") / branch = [ if (trial.one.responsetext == "n") { trial.fb } ] / timeout = 3000 </trial>
<trial two> / ontrialend = [ values.n += 1; values.ncorrect += trial.one.correct;
if (trial.two.correct) { values.multiplier = list.listb.nextvalue; values.score -= values.multiplier * 500; // if response is correct, decrease the score by 500 3/4 times or increase by 500 1/4 as per listb values.difference = 0; values.difference -= 500; // this should reflect the difference between the new and old score, either +500 or -500 } else { values.multiplier = list.listb.nextvalue; values.score -= values.multiplier * 250; // if response is incorrect, decrease the score by only 250 values.difference = 0; values.difference -= 250; } ] ] / stimulusframes = [1=clearscreen, stimulusa, stimulusb, stimulusc] / inputdevice = keyboard / validresponse = ("y", "n") / correctresponse = ("n") / branch = [ if (trial.one.responsetext == "n") { trial.fb } ] / timeout = 3000 </trial> <trial fb> / stimulusframes = [1=clearscreen, fbscreen] / timeout = 8000 </trial>
<text stimulusa> / items = ("A") / position = (40%, 50%) </text>
<text stimulusb> / items = ("B") / position = (50%, 50%) </text>
<text stimulusc> / items = ("C") / position = (60%, 50%) </text>
<text fbscreen> / items = ("So far, you got <%values.ncorrect%> out of <%values.n%> trials correct.") / items = ("The difference between the last score and current score is <%values.difference%>.") </text>
|
|
|
raven
|
|
Group: Forum Members
Posts: 52,
Visits: 110
|
Also, I forgot to ask if there is a way to have it so that the score for some participants, goes up 3/4 or 1/4 times as per the respective lista or listb in stimulusa, stimulusb, or stimulusc, and for others it will be different. For example, it should be different for even numbered participants compared to odd numbered participants, to reduce the chance of participants telling each other which is which. I was looking into how to do that with the /expt element, but haven't had much luck in getting that to work so far. Any ideas?
Thanks in advance!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
First, the code you provided is incomplete and thus not useful. Provide complete, actually runnable code. Second, yes, of course it's possible to implement different between-subjects conditions.
|
|
|