E-Prime Knowledge Base

3026 - INFO: Use of IsPending() to execute script while a response object is running.

Detail
The IsPending() method returns a Boolean value (i.e. True or False) which indicates whether the input masks on a particular object are pending (i.e. waiting for a response). This method is particularly useful when you want to execute InLIne script while an object is running and waiting for a response. For example, a While loop can be used in an InLine following the object that loops repeatedly as long as the input masks are pending. Any script you want to execute while the object waits for a response can be placed inside the While loop.

The object collecting the response must have its Duration property set to 0. All of the input masks must have their Time Limit property set to (infinite), and their End Action property set to (none). All of these properties can be found on the Duration/Input tab of the object's Properties pages. This causes E-Prime to draw the object on the screen and then immediately begin executing the InLine script following the object. The object will continue collecting responses while the script is running.



Example: On the TrialProc, you have an object named Stimulus which presents a text string to the subject and collects a response. The experiment does not proceed until the subject responds. After the object has been displayed for 5 seconds, you want to display a message that encourages the subject to respond quickly. After setting the Duration, Time Limit, and End Action properties on the Stimulus object as described above, place an InLine object immediately following the Stimulus object on the TrialProc. Enter the following script into this InLine:

'Create a Canvas object.
Dim cnvs As Canvas
Set cnvs = Display.Canvas

Do While Stimulus.InputMasks.IsPending()

  If (Clock.Read - Stimulus.OnsetTime) >= 5000 Then

       cnvs.Text 0, 0, "Please Respond Quickly!"

  End If

Loop

The While loop will repeat continuously until a response from the subject is received. During the loop, the code assesses how much time has passed since the onset of the Stimulus object. If 5 seconds or more have passed, the Canvas object is used to display a message. The experiment will proceed once the subject responds.



This topic was created on:
Updated on 1/8/2007 7:48:00 PM (GMT)

This topic was last updated on:
Updated on 1/8/2007 7:50:00 PM (GMT)



End User Comments:    Add... (login required)



Click here to log into Web Support.
Privacy | Terms of Use | Terms and Conditions | Legal Trademarks | Authorized Use | Quality Policy
Copyright 2013 Psychology Software Tools, Inc. All Rights Reserved
Email: Info@pstnet.com | Telephone: 412.449.0078 | Fax: 412.449.0079