Slide duration defined by variable, not attribute

Tobias tobias.fw at gmail.com
Fri Jul 8 11:23:24 UTC 2011


Thanks for your sage advice. I think I just found it annoying to
always use "c.setattrib" etc., never really knowing by heart the exact
syntax. Also, I sometimes had error mesagges because the variable
types didn't match etc. I'll think about it, but for the moment: THis
snip of code you were writing, at what point in the procedure should I
include it? I was actually aware that "StimText.Duration = durationA"
should work, but if I put at a point before the object, the value
entered in the object will overwrite it. And after the object, it's
already too late :-p

Best,
Tobias

On 7 Jul., 19:56, David McFarlane <mcfar... at msu.edu> wrote:
> Tobias,
>
> First, I disagree with your premise about attribute references being
> "more complicated and not really straight forward" than
> variables.  It is just as simple and straightforward to use attribute
> references in code as it is to use variables in code, and in most
> cases attribute references offer distince advantages.  I started out
> using variables just as you describe (and so will get around to
> actually answering your question :)), but once I understood attribute
> references better I switched to using those whenever I can, for the
> following reasons:
>
> - Using a variable for, say, Duration, leaves *no* clue in the
> program design that that value will vary -- to the contrary, the
> object's Duration will show as a constant, so programmers just have
> to "know" that this value will vary in some code somewhere.  By
> contrast, an attribute reference in the object serves notice that
> that value varies, and thus is much "friendlier" to programmers.
>
> - Using a variable does *not* log the varying value, so after the
> experiment you have no record of what really happened.  Using an
> attribute reference fixes this at no extra cost.  Yes, you could
> throw in a c.SetAttrib "DurationA", durationA just to log the, but
> once you go to that length you might as well just use the attribute
> in your object, no?
>
> So except for extreme cases, if I need to vary a property value from
> code instead of a List, I always do something like
>
> c.SetAttrib "DurationA", durationA
>
> and then use [DurationA] for the Duration property of my stimulus object.
>
> But let's suppose that you really have a valid purpose for this (or
> wish to simply ignore my sage advice).  Here's how you do
> that.  Suppose you want to set the Duration property of a stimlus
> object called StimText to a variable called durationA.  In code, you simply do
>
> StimText.Duration = durationA
>
> That's it!  Absurdly simple.  You can do this for a whole host of
> object properties, just look at the E-Basic Help page for any desired
> object.  For that matter, work through Chapter 4 of the User's Guide
> that came with E-Prime, and take a course in Introduction to Computer
> Programming.
>
> Regards,
> -- David McFarlane, Professional Faultfinder
>
> At 7/7/2011 01:23 PM Thursday, you wrote:
>
>
>
>
>
>
>
> >Hi,
>
> >I would like to define the duration of an object (slide in this case)
> >in E-Prime with a variable. As far as I know, instead of specifying
> >the duration directly by a number, you can also use square brackets
> >and enter, let's say [durationA]. This refers to the attribute in the
> >current list named "durationA". However, using attributes is much more
> >complicated and not really straight forward. Is there a way of using
> >variables instead?
>
> >Thanks a lot in advance!
> >Tobias

-- 
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