Presentation is loading. Please wait.

Presentation is loading. Please wait.

More script commands (3) [Eye and Pen v2] 10. Looping 11. List LoopIfLabelIsBelow LoadList RandomizeList RandomizeListRange ResetList 12. keywords %L%

Similar presentations


Presentation on theme: "More script commands (3) [Eye and Pen v2] 10. Looping 11. List LoopIfLabelIsBelow LoadList RandomizeList RandomizeListRange ResetList 12. keywords %L%"— Presentation transcript:

1 More script commands (3) [Eye and Pen v2] 10. Looping 11. List LoopIfLabelIsBelow LoadList RandomizeList RandomizeListRange ResetList 12. keywords %L% %M% April 2012, Mshs, University of Poitiers, France 13. Counting with labels SetLabelCounter AddToLabelCounter SubtractFromLabelCounter Hands on scripts 12. Keywords (continued) %R value % % Keyword : Label %

2 10. Looping Definition: a sequence of commands that is executed repeatedly. Following are basic scripts elements used to create a loop LoopIfLabelIsBelow (Label,Iterations,MustCloseRec) [ Eye and Pen 2 ] This command has the script interpretor to go to a label, until a condition is met: this labels counter value should be lower than a limit April 2012, Mshs, University of Poitiers, France Replace Label with the name of the label to check. Replace iterations with the maximum number of loops you require. Replace MustCloseRec with TRUE if an acquisition data file should be closed before jumping to the label. Example: LoopIfLabelIsBelow(Start,6,FALSE) Translation: While the counters value of the label named Start is lower than 6, then go to this label.

3 11. List [ Eye and Pen 2 ] LoadList (FileName) Loads items for the list from a text file. Replace FileName with the name of the file containing the items. Items are added at the end of the list, they do not replace the list content. Ex: LoadList(MyList.txt) RandomizeList Shuffle items in the list ResetList Empties the list. The list is an unique collection of items in which you can put words, numbers, sentences, filenames, etc., anything that can be written with letters and numbers. Any element in list can be set or retrieved April 2012, Mshs, University of Poitiers, France RandomizeListRange (Begin,End) Shuffle items in part of the list. Replace Begin and End with the number of the first and last item of the set to randomize. This command can be used to subdivide the list into sub-blocks separately randomized.

4 12. Keywords Keywords are special symbols, replaced with values computed when script is run. Keywords are mainly used in command parameters. Within the whole set of keywords, %L% and %M% are particularly devoted to list %L% [ Eye and Pen 2 ] Retrieves the Nth item in the list. N is the value of the last label counters value read by the script interpretor (remember: script interpretor has a memory for this) %M% [ Eye and Pen 2 ] When script is executed, %M% is replaced with the current number of items in the list April 2012, Mshs, University of Poitiers, France Example: :Loop DisplayMsg(%L%,1000,-1,-1,TRUE) Jumpto(Loop) List contains: Hello world On first pass, Loop will count 1 and thus DisplayMsg will display item n°1 in list: Hello On second pass, Loop will count 2 and DisplayMsg will display item n°2 in list: World

5 Exercise 5 Write a script such that a list of word is displayed, one word at a time, each second. (list of word is in the file WordsList.txt in the Stimuli folder) LoadList(WordsList.txt) :Start DisplayMsg(%L%,1000,-1,-1,TRUE) LoopIfLabelIsBelow(Start,%M%,FALSE) DisplayMsg(Thats all !,3000,-1,-1,TRUE) Hands on scripts ! April 2012, Mshs, University of Poitiers, France

6 Exercise 6 Write a script such that a participant copies a list of words presented in a random order, one by one. LoadList(WordsList.txt) RandomizeList :Start DisplayMsg(%L%,-1,-1,-1,TRUE) OpenRec(_%L%_%I%) WaitForTabZoneAt(35725,20987,44697,27932,FALSE,TRUE) CloseRec LoopIfLabelIsBelow(Start,%M%,FALSE) DisplayMsg(Thats all,3000,-1,-1,TRUE) With pictures containing each a single word, named from the word: D isplayPic(%L%.bmp,-1,-1,-1) give a full file name April 2012, Mshs, University of Poitiers, France Hands on scripts !

7 10-12 April 2012, Mshs, University of Poitiers, France %R value % [ Eye and Pen 2 ] When script is executed, %R value % is replaced with a random number between 0 and Value (excluded). Ex: Wait(%R500%) The script will be paused for a random duration between 0 and 500 milliseconds % Keyword : Label % [ Eye and Pen 2 ] Use a label counters value with a keyword. Keyword should be replaced with a keyword, either I, L or R, and Label with the name of an existing script label. Example: :BigLoop :SmallLoop DisplayMsg(%L:BigLoop%,1000,-1,-1,TRUE) %L:BigLoop% specifies a labels counter ( BigLoop ) instead of the default label counters value (the last label encounter by script interpretor, here SmallLoop).

8 13. Couting with Labels [ Eye and Pen 2 ] SetLabelCounter (Label,Value) Assign a value to a labels counter. Replace Label with the name of label you wish to set and Value with… the value. Ex: SetLabelCounter(MyCounter,6) AddToLabelCounter (Label,Value) Add a number to a label counters value. Replace Label with the name of the label you wish to modify and Value with the number to sum. The value of a labels counter can be modified April 2012, Mshs, University of Poitiers, France SubtractFromToLabelCounter (Label,Value) Add a number to a label counters value. Replace Label with the name of the label you wish to modify and Value with the number to subtract. Hint: instead of setting numbers as value, why not use keywords ?


Download ppt "More script commands (3) [Eye and Pen v2] 10. Looping 11. List LoopIfLabelIsBelow LoadList RandomizeList RandomizeListRange ResetList 12. keywords %L%"

Similar presentations


Ads by Google