Post by fabienne on Apr 8, 2022 19:08:56 GMT
Hi all,
I'm new to Psytoolkit and just need it to run two small experiments. One of them is already in the experiment library, it's the backwards Corsi task. I only modified it very slightly, showing the squares selection for 1000 instead of 300ms.
What I need help with is: How can I make the Corsi task forwards instead of backwards? I.e. participants should select the squares in the same order instead of the reverse order they were presented. I want both but the experiment library only had the backwards version.
I would be so grateful if someone could help me out <3
My code is below:
options
mouse on
origin topleft
set &Count 2 # starts with showing two blocks
bitmaps
titlescreen
revinstructions
yellow
purple
done
ticked
correct
wrong
ready1
ready2
ready3
fonts
arial 30
sounds
gosignal go.mp3
part delay
delay 1000
clear -1
delay 300
table revcorsidata
include revcorsitable.txt
task revcorsi
table revcorsidata
set $counter 0
set $b1 0
set $b2 0
set $b3 0
set $b4 0
set $b5 0
set $b6 0
set $b7 0
set $b8 0
set $b9 0
# mouse off so that people cannot mouse during sequence presentation
mouse off
# show nine blocks
draw off
show bitmap purple @1 @2
show bitmap purple @3 @4
show bitmap purple @5 @6
show bitmap purple @7 @8
show bitmap purple @9 @10
show bitmap purple @11 @12
show bitmap purple @13 @14
show bitmap purple @15 @16
show bitmap purple @17 @18
show bitmap done 750 550
draw on
# show sequence 1
show bitmap yellow @19 @20
part delay
show bitmap yellow @21 @22
part delay
if &Count > 2
show bitmap yellow @23 @24
part delay
fi
if &Count > 3
show bitmap yellow @25 @26
part delay
fi
if &Count > 4
show bitmap yellow @27 @28
part delay
fi
if &Count > 5
show bitmap yellow @29 @30
part delay
fi
if &Count > 6
show bitmap yellow @31 @32
part delay
fi
if &Count > 7
show bitmap yellow @33 @34
part delay
fi
if &Count > 8
show bitmap yellow @35 @36
part delay
fi
# go!
sound gosignal
mouse show # now show cursor again
delay 100 # not really necessary, but gives a bit of time between sound and people's response
# read in sequence
while $x != 10
readmouse l 1 10000 range 1 10
set $myMouseX MOUSE_X
set $myMouseY MOUSE_Y
set $x under $myMouseX $myMouseY up range 1 10
if $x != 10
set $counter increase
fi
if $counter == 1 && $x != 10
set $b1 $x
fi
if $counter == 2 && $x != 10
set $b2 $x
fi
if $counter == 3 && $x != 10
set $b3 $x
fi
if $counter == 4 && $x != 10
set $b4 $x
fi
if $counter == 5 && $x != 10
set $b5 $x
fi
if $counter == 6 && $x != 10
set $b6 $x
fi
if $counter == 7 && $x != 10
set $b7 $x
fi
if $counter == 8 && $x != 10
set $b8 $x
fi
if $counter == 9 && $x != 10
set $b9 $x
fi
show bitmap ticked $myMouseX $myMouseY ## it has to be here, check while-end javascript coding
while-end
set $x 0
# now check if sequence is correct
set $SeqCorrect 0 # this means wrong
if $counter == &Count
if &Count == 2 && $b2 == @37 && $b1 == @38
set $SeqCorrect 1
fi
if &Count == 3 && $b3 == @37 && $b2 == @38 && $b1 == @39
set $SeqCorrect 1
fi
if &Count == 4 && $b4 == @37 && $b3 == @38 && $b2 == @39 && $b1 == @40
set $SeqCorrect 1
fi
if &Count == 5 && $b5 == @37 && $b4 == @38 && $b3 == @39 && $b2 == @40 && $b1 == @41
set $SeqCorrect 1
fi
if &Count == 6 && $b6 == @37 && $b5 == @38 && $b4 == @39 && $b3 == @40 && $b2 == @41 && $b1 == @42
set $SeqCorrect 1
fi
if &Count == 7 && $b7 == @37 && $b6 == @38 && $b5 == @39 && $b4 == @40 && $b3 == @41 && $b2 == @42 && $b1 == @43
set $SeqCorrect 1
fi
if &Count == 8 && $b8 == @37 && $b7 == @38 && $b6 == @39 && $b5 == @40 && $b4 == @41 && $b3 == @42 && $b2 == @43 && $b1 == @44
set $SeqCorrect 1
fi
if &Count == 9 && $b9 == @37 && $b8 == @38 && $b7 == @39 && $b6 == @40 && $b5 == @41 && $b4 == @42 && $b3 == @43 && $b2 == @44 && $b1 == @45
set $SeqCorrect 1
fi
fi
## feedback
if $SeqCorrect == 1
show bitmap correct 750 550
fi
if $SeqCorrect == 0
show bitmap wrong 750 550
fi
delay 1000
clear -1
delay 1000
## now goto next seq if correct twice
set $currentcount &Count
if $SeqCorrect == 1
set &corsispan &Count ## the best score so far
set &Count increase
set &ErrorCount 0
fi
## count errors in a row
if $SeqCorrect == 0
set &ErrorCount increase
fi
## save data
save &corsispan $currentcount $SeqCorrect TABLEROW
## if two errors in a row or if all are correctly clicked, end of task
if &ErrorCount == 2 || &Count == 10
end tasklist
fi
block test
message titlescreen
message revinstructions
bitmap ready3
delay 1000
bitmap ready2
delay 1000
bitmap ready1
delay 1000
tasklist
revcorsi 100 all_before_repeat
end
feedback
text 0 400 &corsispan ; prefix "Your Corsi backward span is " ; postfix " items."
text 0 500 "Press space bar to continue"
end
I'm new to Psytoolkit and just need it to run two small experiments. One of them is already in the experiment library, it's the backwards Corsi task. I only modified it very slightly, showing the squares selection for 1000 instead of 300ms.
What I need help with is: How can I make the Corsi task forwards instead of backwards? I.e. participants should select the squares in the same order instead of the reverse order they were presented. I want both but the experiment library only had the backwards version.
I would be so grateful if someone could help me out <3
My code is below:
options
mouse on
origin topleft
set &Count 2 # starts with showing two blocks
bitmaps
titlescreen
revinstructions
yellow
purple
done
ticked
correct
wrong
ready1
ready2
ready3
fonts
arial 30
sounds
gosignal go.mp3
part delay
delay 1000
clear -1
delay 300
table revcorsidata
include revcorsitable.txt
task revcorsi
table revcorsidata
set $counter 0
set $b1 0
set $b2 0
set $b3 0
set $b4 0
set $b5 0
set $b6 0
set $b7 0
set $b8 0
set $b9 0
# mouse off so that people cannot mouse during sequence presentation
mouse off
# show nine blocks
draw off
show bitmap purple @1 @2
show bitmap purple @3 @4
show bitmap purple @5 @6
show bitmap purple @7 @8
show bitmap purple @9 @10
show bitmap purple @11 @12
show bitmap purple @13 @14
show bitmap purple @15 @16
show bitmap purple @17 @18
show bitmap done 750 550
draw on
# show sequence 1
show bitmap yellow @19 @20
part delay
show bitmap yellow @21 @22
part delay
if &Count > 2
show bitmap yellow @23 @24
part delay
fi
if &Count > 3
show bitmap yellow @25 @26
part delay
fi
if &Count > 4
show bitmap yellow @27 @28
part delay
fi
if &Count > 5
show bitmap yellow @29 @30
part delay
fi
if &Count > 6
show bitmap yellow @31 @32
part delay
fi
if &Count > 7
show bitmap yellow @33 @34
part delay
fi
if &Count > 8
show bitmap yellow @35 @36
part delay
fi
# go!
sound gosignal
mouse show # now show cursor again
delay 100 # not really necessary, but gives a bit of time between sound and people's response
# read in sequence
while $x != 10
readmouse l 1 10000 range 1 10
set $myMouseX MOUSE_X
set $myMouseY MOUSE_Y
set $x under $myMouseX $myMouseY up range 1 10
if $x != 10
set $counter increase
fi
if $counter == 1 && $x != 10
set $b1 $x
fi
if $counter == 2 && $x != 10
set $b2 $x
fi
if $counter == 3 && $x != 10
set $b3 $x
fi
if $counter == 4 && $x != 10
set $b4 $x
fi
if $counter == 5 && $x != 10
set $b5 $x
fi
if $counter == 6 && $x != 10
set $b6 $x
fi
if $counter == 7 && $x != 10
set $b7 $x
fi
if $counter == 8 && $x != 10
set $b8 $x
fi
if $counter == 9 && $x != 10
set $b9 $x
fi
show bitmap ticked $myMouseX $myMouseY ## it has to be here, check while-end javascript coding
while-end
set $x 0
# now check if sequence is correct
set $SeqCorrect 0 # this means wrong
if $counter == &Count
if &Count == 2 && $b2 == @37 && $b1 == @38
set $SeqCorrect 1
fi
if &Count == 3 && $b3 == @37 && $b2 == @38 && $b1 == @39
set $SeqCorrect 1
fi
if &Count == 4 && $b4 == @37 && $b3 == @38 && $b2 == @39 && $b1 == @40
set $SeqCorrect 1
fi
if &Count == 5 && $b5 == @37 && $b4 == @38 && $b3 == @39 && $b2 == @40 && $b1 == @41
set $SeqCorrect 1
fi
if &Count == 6 && $b6 == @37 && $b5 == @38 && $b4 == @39 && $b3 == @40 && $b2 == @41 && $b1 == @42
set $SeqCorrect 1
fi
if &Count == 7 && $b7 == @37 && $b6 == @38 && $b5 == @39 && $b4 == @40 && $b3 == @41 && $b2 == @42 && $b1 == @43
set $SeqCorrect 1
fi
if &Count == 8 && $b8 == @37 && $b7 == @38 && $b6 == @39 && $b5 == @40 && $b4 == @41 && $b3 == @42 && $b2 == @43 && $b1 == @44
set $SeqCorrect 1
fi
if &Count == 9 && $b9 == @37 && $b8 == @38 && $b7 == @39 && $b6 == @40 && $b5 == @41 && $b4 == @42 && $b3 == @43 && $b2 == @44 && $b1 == @45
set $SeqCorrect 1
fi
fi
## feedback
if $SeqCorrect == 1
show bitmap correct 750 550
fi
if $SeqCorrect == 0
show bitmap wrong 750 550
fi
delay 1000
clear -1
delay 1000
## now goto next seq if correct twice
set $currentcount &Count
if $SeqCorrect == 1
set &corsispan &Count ## the best score so far
set &Count increase
set &ErrorCount 0
fi
## count errors in a row
if $SeqCorrect == 0
set &ErrorCount increase
fi
## save data
save &corsispan $currentcount $SeqCorrect TABLEROW
## if two errors in a row or if all are correctly clicked, end of task
if &ErrorCount == 2 || &Count == 10
end tasklist
fi
block test
message titlescreen
message revinstructions
bitmap ready3
delay 1000
bitmap ready2
delay 1000
bitmap ready1
delay 1000
tasklist
revcorsi 100 all_before_repeat
end
feedback
text 0 400 &corsispan ; prefix "Your Corsi backward span is " ; postfix " items."
text 0 500 "Press space bar to continue"
end