1 / 8

More script commands (3) [Eye and Pen v2]

More script commands (3) [Eye and Pen v2]. 10. Looping. 12. Keywords (continued). LoopIfLabelIsBelow. %R value % % Keyword : Label %. 11. List. 13. Counting with labels. LoadList RandomizeList RandomizeListRange ResetList. SetLabelCounter AddToLabelCounter

najwa
Download Presentation

More script commands (3) [Eye and Pen v2]

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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 label’s counter value should be lower than a limit. 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 counter’s value of the label named Start is lower than 6,then go to this label. 10-12 April 2012, Mshs, University of Poitiers, France

  3. 11. List [ Eye and Pen 2 ] 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. 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.3. RandomizeListRange(Begin,End) Shuffle items in part of the list. ReplaceBegin 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. 11.4. ResetList Empties the list. 10-12 April 2012, Mshs, University of Poitiers, France

  4. List contains: Hello world 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 counter’s value read by the script interpretor (remember: script interpretor has a memory for this). Example: :Loop DisplayMsg(%L%,1000,-1,-1,TRUE) Jumpto(Loop) 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” 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

  5. Hands on scripts ! 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(That’s all !,3000,-1,-1,TRUE) 10-12 April 2012, Mshs, University of Poitiers, France

  6. Hands on scripts ! 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(That’s all,3000,-1,-1,TRUE) With pictures containing each a single word, named from the word: DisplayPic(%L%.bmp,-1,-1,-1) give a full file name 10-12 April 2012, Mshs, University of Poitiers, France

  7. 12.3. %Rvalue% [ Eye and Pen 2 ] When script is executed, %Rvalue% 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 counter’s 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 label’s counter (BigLoop) instead of the “default” label counter’s value (the last label encounter by script interpretor, here SmallLoop). 10-12 April 2012, Mshs, University of Poitiers, France

  8. 13. Couting with Labels [ Eye and Pen 2 ] The value of a label’s counter can be modified. 13.1. SetLabelCounter(Label,Value) Assign a value to a label’s 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 counter’s value. Replace Label with the name of the label you wish to modify and Value with the number to sum. 13.3. SubtractFromToLabelCounter(Label,Value) Add a number to a label counter’s 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 ? 10-12 April 2012, Mshs, University of Poitiers, France

More Related