base timing of a trial on total time taken in previous trials--mismatch error?

David McFarlane mcfarla9 at msu.edu
Thu Jun 30 21:26:58 UTC 2011


This got addressed on the PST Forum 
(http://www.pstnet.com/forum/Topic5419-7-1.aspx ), but you did well 
to post here as well -- generally I respond only here on the E-Prime 
Group, and now I can post a few more details and provide code with 
proper indentation.

First, as you might find explained in Chapter 4 of the User's Guide 
that came with E-Prime, and have instead discovered the hard way, 
attributes propogate only downward through logging levels, they do 
not persist as you pop back up to higher levels, and as a result they 
do not persist as you pop up a level and then back down to the same 
level, as happens at the end of a Procedure run by a List.  IOW, 
despite some appearance, "attributes" are *not* "variables", and they 
will not fulfill the role of variables.  Variables and attributes 
each have their own roles.

So, as explained on the Forum, in short you need to use a global 
variable.  As explained in Chapter 4 of the User's Guide, you do that 
in the User tab of the Script view.  Define a variable such as 
TRemaining, e.g.,

Dim TRemaining as Long

Then use that global variable to keep track of the value from trial 
to trial, as in ...  well, when I tried to write out the code it 
didn't seem quite right, and I have to run off and catch a bus 
now.  Maybe you or someone else can now sort this out based on the 
clues given so far.

-- David McFarlane, Professional Faultfinder

At 6/30/2011 02:18 PM Thursday, you wrote:
>I am programming an experiment where the total time a person can take
>is 10 minutes (600000 ms) (to do 12 trials), with a maximum of 2
>minutes per trial (the trial terminates and starts the next trial
>after 2 minutes). I have set the program to terminate the list if the
>total time is over 10 minutes, however there is a problem--say a
>person has taken 9:45 do to 7 trials, so they have 15 seconds left.
>BUT...on trial 8, the duration is still set to max 2 min--so a person
>can theoretically have a total of 11:45, not 10:00 before it
>terminates. So I need to have the program know that if more than 8
>minutes (480000) has been used, the duration of the trial should be
>600000-however much time has been used so far.
>
>I have tried to fix this by putting an attribute in the list object
>called "trial" which is just the number of the trial, and another
>attribute called "trialtime", which will be the duration of the slide
>object (where the stimulus/trial is presented). in the slide object
>properties, I have set timelimit to be the attribute "trialtime".
>Lastly, after each trial, the attribute "timertrial" is calculated,
>which essentially calculates the length of time taken for that trial
>and adds it to the previous time taken, so that this attribute is
>constantly updated to reflect the total time taken. All of this seems
>to work fine, and running through the program shows that "timertrial"
>is indeed calculating correctly and is recording in the edata file.
>the problem occurs, however, when I put all this together, and try to
>change the duration of the next trial based on the "timertrial"
>attribute. Here is my code:
>
>Using the inline statement below, I have set the first trial duration
>is 120 seconds, and every other trial after that the duration is
>calculated based on total time taken so far
>
>If c.GetAttrib ("trial") = 1 then c.SetAttrib "trialtime", 120000
>If c.GetAttrib ("trial") > 1 then
>If c.getAttrib ("timertrial") >= 480000 then c.setAttrib "trialtime",
>600000 - c.getAttrib ("timertrial")
>If c.getAttrib ("timertrial") < 480000 then c.SetAttrib "trialtime",
>120000
>End If
>
>The problem is, the program cannot find the attribute "timertrial"--it
>calculates fine at the end of each trial, but when I start a new trial
>(within the same list), it does not have a value yet for timertrial,
>since that is calculated at the END of the trial. How do I get it to
>pull the value of "timertrial" from the previous trial and use it as
>an attribute in the NEXT trial? I am sure this is simple, but I can't
>seem to get anywhere.
>
>Also, Note: I have tried using this code instead:
>If c.GetAttrib ("Trial") > 1 then
>if LetterSetList.GetPrevAttrib ("timertrial") >= 480000 then
>c.setAttrib "trialtime", 600000 - LetterSetList.GetPrevAttrib
>("timertrial")
>if LetterSetList.GetPrevAttrib ("timertrial") < 480000 then
>c.setAttrib "trialtime", 120000
>End If
>
>And I keep getting type mismatch errors, which should be easy to
>resolve, but this one keep stumping me.  Again, I'm sure this is
>something simple, but for some reason I can't get it.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list