dynamically created List only operates for level 1
JACanterbury
jacanterbury at gmail.com
Fri Oct 7 14:18:21 UTC 2011
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 athttp://groups.google.com/group/e-prime?hl=en.
--
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