|
|
|
Forum Member
      
Group: Forum Members
Last Login: 7/30/2007 6:06:51 PM
Posts: 25,
Visits: 36
|
|
| Hello, I wish to display one at a time each element of an array (arrSentence) for 400 ms (each). Furthermore, when the element displayed is the same as strTriggerWord, I want it to send a port trigger. I did some code, however I'm not sure if (1) the timing would be right and (2) how to log timing information for each element in the array. Here is my code (txtWord is a textdisplay element associated with SlideDisplayStimuli) Do While x < UBound(arrSentence) 'do until each element has been showed SlideDisplayStimuli.Duration = 400 'each element is displayed for 400ms SlideDisplayStimuli.PreRelease = 200 txtWord.Text = arrSentence(x) 'display element in array If arrSentence(x) = strTriggerWord then 'if element is a trigger word writeport portAdd, cint(1) 'send a trigger by port end if SlideDisplayStimuli.Run x = x + 1 Loop 'next element Thank you for your help.
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: Yesterday @ 5:00:06 PM
Posts: 569,
Visits: 1,238
|
|
| The script you mention will perform and E-Prime will record any values/behavior accurately. However, the script you have shown above will not do the following and will not perform as I believe you intend. The Slide.Run command will cause the entire object to "run" again. If there is a duration, it will wait that duration. If there is PreRelease, input, wait for top of screen, etc will be handled. If your goal is to log each of these iterations and to start at a specific time, then the script will not do so. It would only log the last iteration and could have problems with effective duration if not divisible by the refresh rate. Since the values are not being logged for later analysis it would be difficult or impossible to know if a specific iteration completed successfully. In addition, the signal is being sent prior to the stimulus going on screen. Because of the complexity of what happens inside of an object .Run command coupled with the possibility that script will break in later versions by peforming your own input (which you don't do in this case, but general topic), using the GUI components to lay the foundation is typically encouraged. My recommendation would be to use the GUI to setup a subtrial and then either use script to populate a list at runtime or to read from the array to set an attribute so that the code generation capabilities in E-Studio would handle everything. By using the GUI tools, the setup of scheduling and logging are done w/o script or hassle. Please see the attached experiment. It loads values from a unref list into an array, which you can substitute for however you are generating your array. Then the first set of trials looks at the array value and sets the appropriate attribute. The code generation the GUI setup will look for this attribute and display the word. The second set of trials loads values from the array into a List at runtime. The attached uses the OnsetSignal properties to send the port values. This is recommended since the port value will be sent at the exact time of the onset of the object. All the script does is determine if the signal should be sent or not and enable/disables the onset signal properties. It could easily be modified to add a different port value to be sent depending on the word trigger. -Brandon
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 7/30/2007 6:06:51 PM
Posts: 25,
Visits: 36
|
|
| Brandon, thank you so much for your help ! Thanks to you, I changed my experiment and now it runs far better : I trust the timing more, the experiment is less confusing, it is easier to modify, etc. Not only that, but I learned a lot of new commands and I know understand the logic of e-prime. Thank you again for your terrific help and have a good day, Guillaume
|
|
|
|