Variables in lists

Tony Zuccolotto anthony.zuccolotto at pstnet.com
Wed Mar 22 14:35:43 UTC 2006


Robert,

You're very close to what you need to do.   You do need to use an
attribute in the time limit box, but the part you're missing is that all
attributes exist in the experimental "context" and you need to get the
value you want to use into the context.   The Context is a concept
unique to E-Prime and it constitutes a hierarchical/multi-leveled data
space which is separate from E-Basic variables (e.g. variables you would
declare with the Dim statement).  The Context in E-Prime conceptually
represents all the "experimental data" that you care about and directly
dictates what gets written to the data file.

All attributes declared on List objects automatically get put into the
context when the List is run.   Also, stimulus presentation objects will
insert items into the context after they run or at the end of
procedures, e.g. to add in dependent measures like Stimulus.RT,
Stimulus.ACC, etc.

You are free to put essentially any piece of useful data into context
via script and can do so with the following syntax.

	c.SetAttrib "attributeName", value

for example...

Dim Dura As Long		' declare a variable in E-Basic for
computations
Dura = AveRT - 0.5*stddev	' do the computation
c.SetAttrib "Dura", Dura	' add the value of the computation into
the context under the specified name (the names used do not have to
match).

After you call c.SetAttrib and add something into the context then the
"[Dura]" syntax can be used on object properties and at runtime the
system will look up the value of the specified attribute.

When c.SetAttrib is called and an attribute already exists then the
attributes value will just be updated.   If the attribute doesn't
already exist it will be created.   Every new attribute you put in the
context it will automatically become a new column of data in the data
file.

If you need to get a value from the context via script the syntax is
	value = c.GetAttrib( "attributeName" )

When you call c.GetAttrib the system will check the current level first
(e.g. Trial level) and if it can't resolve the reference it will move up
the next level of the hierarchy (e.g. Block level, then Session level)
until it finds the attribute.  If an attribute can't be found you will
receive a runtime error.  

For more information you should look in the E-Basic help system under
the Context object.

Hope that helps.
-Tony

Anthony P. Zuccolotto
President and Chief Executive Officer
Psychology Software Tools, Inc.
2050 Ardmore Boulevard
Suite 200
Pittsburgh, PA 15221-4610
Phone     412-271-5040
FAX       412-271-7077
Email     anthony.zuccolotto at pstnet.com
Internet  http://www.pstnet.com


> -----Original Message-----
> From: eprime at mail.talkbank.org [mailto:eprime at mail.talkbank.org] On
Behalf
> Of Robert F. Buzan
> Sent: Tuesday, March 21, 2006 12:48 PM
> To: eprime at mail.talkbank.org
> Subject: Variables in lists
> 
> I'm a fairly green E-Prime programmer and have encountered a problem I
> can't
> find an answer for.  I'd appreciate any help that anyone can provide.
I'm
> trying to create an experiment that limits the amount of time that
> participants can respond.  It's done in this way:
> 
> RT data is collected in the practice phase and the mean and standard
> deviation
> are computed.  We then create a variable to be used for the allowable
> response
> duration on one of the later blocks, thusly:  Dura = AveRT -
0.5*stddev.
> This
> works just fine.
> 
> Later, when I need to use this, I want to set the allowable response
time
> for
> the stimulus to which participants must respond to Dura.  We've tried
> putting
> Dura directly into the timelimit box, but it must be an integer or an
> attribute.  We've tried putting [Dura] directly into the timelimit
box,
> but
> that is considered an attribute.  We've created a separate attribute,
> [MyTime], and populated that column with Dura (which, I believe, it
> interprets
> as a string) or with [Dura] (which is then an attribute).  I think
I've
> narrowed the problem down to this question:  How do I use a variable
in a
> list?
> 
> If that's the wrong question, does anyone have a suggestion for making
> this
> program limit response time to the value of Dura (Average RT minus
one-
> half
> the standard deviation)?
> 
> Thanks for your help.
> 
> Gratefully,
> 
> Robb Buzan
> 



More information about the Eprime mailing list