dynamically created List only operates for level 1
David McFarlane
mcfarla9 at msu.edu
Fri Oct 7 15:08:29 UTC 2011
John,
Stock reminder: 1) I do not work for PST. 2) PST's trained staff
takes any and all questions at
http://support.pstnet.com/e%2Dprime/support/login.asp , and they
strive to respond to all requests in 24-48 hours -- this is pretty
much their substitute for proper documentation, so make full use of
it. 3) If you do get an answer from PST Web Support, please extend
the courtesy of posting their reply back here for the sake of others.
That said, here is my take...
I have successfully made dynamic Lists work using E-Basic
code. Whenever I want to figure out how to do something like that, I
start by making some simple relevant mock-up in E-Studio, have it
generate the code, and then look at that generated code.
In this case, add a List (e.g., "List1"), add a few levels to that
List, set Load Method to "Script" (so that it generates full code for
making the List), and Generate the code. Then scroll down to the
InitObjects area in the full code. There you will find a few lines like
Set List1.TerminateCondition = Cycles(1)
Set List1.ResetCondition = Samples(5)
List1.Reset
I think your key lies there. After adding your levels, in addition
to Resetting the List (as Ben already mentioned), you still need to
set the TerminateCondition and ResetCondition -- see the
List.TerminateCondition and List.ResetCondition topics, as well as
the Cycles and Samples topics, in the E-Basic Help facility.
-- David McFarlane, Professional Faultfinder
At 10/7/2011 10:18 AM Friday, you wrote:
>Hi Ben,
>
>Thanks for the suggestion. Actually I had the .Reset (I just missed it
>off the bottom of the cut and paste).
>
>It's frustrating because the debug.print returns 50 which is what I'd
>expect its just that the loop only runs once.
>
>I've jsut condensed it down to the bare bones :-
>
> >>>const NUMBER_OF_TRIALS as integer = 50
>
>dim index as integer 'loop variable
>
>for index = 1 to NUMBER_OF_TRIALS
>
> TrialList.setProc index, "TrialProc"
> TrialList.setWeight index, "1"
> TrialList.setAttrib index, "text", "cat"
> TrialList.setAttrib index, "correct", "a"
>
> if index < NUMBER_OF_TRIALS then
> TrialList.AddLevel index + 1
> end if
>
> debug.print index & " - " & TrialList.getAttrib(index, "text") & " -
>" & TrialList.getAttrib(index, "correct")
>
>next
>
>debug.print "TrialList size = " & TrialList.Size
>
>TrialList.Reset
><<<<
>
>with a basic TrialList with a single level as follows;-
>
> >>>
>ID Weight nested procedure Text Correct
>1 1 TrialProc Cat a
><<<
>
>
>which has the same problem :(
>
>Is anyone else successfully using AddLevel ? If so, then some sample
>code would be appreciated,
>
>Many thanks,
>
>John
>
>
>
>On Oct 6, 6:30 pm, ben robinson <baltimore.... at gmail.com> wrote:
> > don't forget to add TrialList.Reset after adding all those levels.
> > hope that helps.
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Oct 6, 2011 at 11:53 AM, JACanterbury
> <jacanterb... at gmail.com> wrote:
> > > Hi
> >
> > > I'm setting up my TrialList to have only 1 level and then building it
> > > on the fly something like this ...
> >
> > > for index = 1 to NUMBER_OF_TRIALS
> >
> > > TrialList.setProc index, "TrialProc"
> > > TrialList.setWeight index, "1"
> > > TrialList.setAttrib index, "response", responses( index )
> > > TrialList.setAttrib index, "image", "images\\" & images( index )
> > > TrialList.setAttrib index, "delay", Random( interval_min,
> > > interval_max )
> >
> > > if index < NUMBER_OF_TRIALS then
> > > TrialList.AddLevel index + 1 ' add the next
> level to the list
> > > ready for the next loop iteration
> > > end if
> >
> > > next
> >
> > > debug.print "TrialList size = " & TrialList.Size
> >
> > > this code all works fine and adds the extra levels and the final
> > > debug.print displays the correct value (50 in this case) however the
> > > script then only performs 1 iteration so it seems to ignore all the
> > > extra levels that have been dynamically added.
> > > Interestingly, if I add an extra level ie level 2) manually before
> > > running this code (with the approp tweak to stop AddLevel complaining)
> > > then the list operates for level 1 & level 2.
> >
> > > It's as if e-prime is using the startup value for the list size and
> > > ignoring what has happened at run time.
> >
> > > Any ideas would be appreciated ( i'd rather keep it dynamic if
> > > possible)
> >
> > > Thanks
--
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