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% 10-12 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. 10.1. 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. 10-12 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 ] 11.1. 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) 11.2. RandomizeList Shuffle items in the list. 11.4. 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. 10-12 April 2012, Mshs, University of Poitiers, France 11.3. 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. 12.1. %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). 12.2. %M% [ Eye and Pen 2 ] When script is executed, %M% is replaced with the current number of items in the list. 10-12 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 ! 10-12 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 10-12 April 2012, Mshs, University of Poitiers, France Hands on scripts !

7 10-12 April 2012, Mshs, University of Poitiers, France 12.3. %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. 12.4. % 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 ] 13.1. 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) 13.2. 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. 10-12 April 2012, Mshs, University of Poitiers, France 13.3. 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