Week 1 Flashcards
Copy the example and add code to remove the word “hotel” from the screen after 2000 ms and then have an empty 1500ms inter-stimulus interval between words. Also, remove the word “table” from the screen at the end.
text(“hotel”);
await(2000);
text(“table”);
await(2000);
text(“hotel”);
await(2000);
clear();
await(1500)
text(“table”);
await(2000);
clear();
How do you write a code for an input box and save the response under a certain variable?
input(“Write down the words remembered”, “words1”);
Write down the NeuroTask Scripting statement for a block that puts the following on the screen: A crimson-colored block with the text ‘Hello’. The block must have a margin of 20% from the left and 30% from the top with similar margins on the right and bottom.
var b = main.addblock(20,30,60,40, "yellow","Display text");
Which statement can you use to make the font 60% of the default size when then use the text() function (or any of the standard controls)?
main.setfontsize(60);
Write the JavaScript code that shows the words “One”, then when you click “Two”, and when you click again “Three”.
text(“One”);
await(“click”);
text(“Two”);
await(“click”);
text(“Three”);
If you want to use images as stimuli, why is it absolutely necessary to preload these?
Because it loads the images before they have to be presenting in the script making presentation times instantaneous, therefore more accurate.
Why is it usually not possible to show an image for 15 ms on a computer screen?
Because 15ms is typically faster than the refresh rate on a computer monitor, therefore the image will possibly be presented and gone before it even refreshes the screen or it could be longer than 15ms while the screen waits to refresh.
Write one line of code that waits for either the left or the right arrow to be pressed with a time-out of 3000 ms.
awaitkey(“RIGHT_ARROW,LEFT_ARROW”,3000);
Copy and modify the following code so that the subject sees a message that says: “Please, try to respond faster next time (within 3 seconds)” when that are slow (i.e., slower than 3000 ms).
var e;
text(“Press s or l within 3 s”);
e = awaitkey(‘s,l’,3000);
text(“Your RT was: “ + e.RT.toFixed(2) + “ ms”);
var e;
text(“Press s or l within 3 s”);
e = awaitkey(‘s,l’);
if (e.RT >3000) or if (e.type === "timeout") { text("Your RT was: " + e.RT.toFixed(2) + " ms, Please try to be faster next time (within 3 seconds)"); await(4000); clear(); } else if (e.RT.toFixed(2)<3000) { text("Your RT was: " + e.RT.toFixed(2) + " ms, Good job!"); await(4000); clear(); }
If you have written code such as: e = awaitkey(‘s,l’,3000), how can you find out whether the s-key or the l-key was pressed? log + display
e = awaitkey(‘s,l’,3000);
text(“You pressed “ + e.key); // to display it
log(e.key, “key_resp”); // to record it as data
Give the code for making a bigger input box to allow for lists
largeinput(“Write down the words remembered”,”words_remembered”);
List three things wrong with the following script:
1 var i;
2 var words = (“glass”, “chair”, “train”, “balloon”,
3 “horse”, “curtain”, “pencil”, “baker”);
4
5 text(“Try to remember the following words”);
6 await(5000); // 5000 ms or 5 s
7
8 for (i = 0, i < words.length, i = i + 1)
9 [
10 text(words[i]);
11 await(2000);
12 clear();
13 await(1000);
14 ]
15
16 text(“Now, count back in threes starting with 307: 307, 304, 301,…”);
17 await(20000);
18
19 largeinput(“Write down the words remembered”,”words_remembered”);
20
21 text(“Thank you for participating!”);
22 await(3000);
[ ] are used for an array
{ } are used for if statements
, used instead of ; in for loop specifics
write a for loop that goes through 5 cycles
for (i = 0; i < 5; i = i + 1) { text(words[i]); await(2000); clear(); await(1000); }
Describe how to use an array of words using a text file
+ first make a text file (i.e., with the extension “.txt”) that contains the stimulus words without quotation marks, but separated by commas.
+ This file must be uploaded with NeuroTask’s Upload Files feature
+ the filename will appear in the Quick Reference side panel next to your script
+ words = getwords(“words.txt”);