Millisecond Forums

Error evaluating function?

https://forums.millisecond.com/Topic18245.aspx

By nashby - 2/2/2016

So I have function and it seems to work sporadically. It essentially cannot process the following line. Any ideas on the issue? Is it just to much for it to process?

/ ontrialbegin = [values.g1 = list.pickerhl.nextvalue; values.oh1 = list.ohl1.item(list.pickerhl.currentvalue); values.ol1 = list.ohl2.item(list.pickerhl.currentvalue); values.p1 = list.phl.item(list.pickerhl.currentvalue); values.g2 = list.pickerhl.nextvalue; values.oh2 = list.ohl1.item(list.pickerhl.currentvalue); values.ol2 = list.ohl2.item(list.pickerhl.currentvalue); values.p2 = list.phl.item(list.pickerhl.currentvalue); values.g3 = list.pickerhl.nextvalue; values.oh3 = list.ohl1.item(list.pickerhl.currentvalue); values.ol3 = list.ohl2.item(list.pickerhl.currentvalue); values.p3 = list.phl.item(list.pickerhl.currentvalue); values.g4 = list.pickerhl.nextvalue; values.oh4 = list.ohl1.item(list.pickerhl.currentvalue); values.ol4 = list.ohl2.item(list.pickerhl.currentvalue); values.p4 = list.phl.item(list.pickerhl.currentvalue); values.g5 = list.pickerhl.nextvalue; values.oh5 = list.ohl1.item(list.pickerhl.currentvalue); values.ol5 = list.ohl2.item(list.pickerhl.currentvalue); values.p5 = list.phl.item(list.pickerhl.currentvalue); values.g6 = list.pickerhl.nextvalue; values.oh6 = list.ohl1.item(list.pickerhl.currentvalue); values.ol6 = list.ohl2.item(list.pickerhl.currentvalue); values.p6 = list.phl.item(list.pickerhl.currentvalue); values.g7 = list.pickerhl.nextvalue; values.oh7 = list.ohl1.item(list.pickerhl.currentvalue); values.ol7 = list.ohl2.item(list.pickerhl.currentvalue); values.p7 = list.phl.item(list.pickerhl.currentvalue); values.g8 = list.pickerhl.nextvalue; values.oh8 = list.ohl1.item(list.pickerhl.currentvalue); values.ol8 = list.ohl2.item(list.pickerhl.currentvalue); values.p8 = list.phl.item(list.pickerhl.currentvalue); values.g9 = list.pickerhl.nextvalue; values.oh9 = list.ohl1.item(list.pickerhl.currentvalue); values.ol9 = list.ohl2.item(list.pickerhl.currentvalue); values.p9 = list.phl.item(list.pickerhl.currentvalue); values.g10 = list.pickerhl.nextvalue; values.oh10 = list.ohl1.item(list.pickerhl.currentvalue); values.ol10 = list.ohl2.item(list.pickerhl.currentvalue); values.p10 = list.phl.item(list.pickerhl.currentvalue); values.g11 = list.pickerhl.nextvalue; values.oh11 = list.ohl1.item(list.pickerhl.currentvalue); values.ol11 = list.ohl2.item(list.pickerhl.currentvalue); values.p11 = list.phl.item(list.pickerhl.currentvalue); values.g12 = list.pickerhl.nextvalue; values.oh12 = list.ohl1.item(list.pickerhl.currentvalue); values.ol12 = list.ohl2.item(list.pickerhl.currentvalue); values.p12 = list.phl.item(list.pickerhl.currentvalue); values.g13 = list.pickerhl.nextvalue; values.oh13 = list.ohl1.item(list.pickerhl.currentvalue); values.ol13 = list.ohl2.item(list.pickerhl.currentvalue); values.p13 = list.phl.item(list.pickerhl.currentvalue); values.g14 = list.pickerhl.nextvalue; values.oh14 = list.ohl1.item(list.pickerhl.currentvalue); values.ol14 = list.ohl2.item(list.pickerhl.currentvalue); values.p14 = list.phl.item(list.pickerhl.currentvalue); values.g15 = list.pickerhl.nextvalue; values.oh15 = list.ohl1.item(list.pickerhl.currentvalue); values.ol15 = list.ohl2.item(list.pickerhl.currentvalue); values.p15 = list.phl.item(list.pickerhl.currentvalue); values.g16 = list.pickerhl.nextvalue; values.oh16 = list.ohl1.item(list.pickerhl.currentvalue); values.ol16 = list.ohl2.item(list.pickerhl.currentvalue); values.p16 = list.phl.item(list.pickerhl.currentvalue); values.g17 = list.pickerhl.nextvalue; values.oh17 = list.ohl1.item(list.pickerhl.currentvalue); values.ol17 = list.ohl2.item(list.pickerhl.currentvalue); values.p17 = list.phl.item(list.pickerhl.currentvalue); values.g18 = list.pickerhl.nextvalue; values.oh18 = list.ohl1.item(list.pickerhl.currentvalue); values.ol18 = list.ohl2.item(list.pickerhl.currentvalue); values.p18 = list.phl.item(list.pickerhl.currentvalue); values.g19 = list.pickerhl.nextvalue; values.oh19 = list.ohl1.item(list.pickerhl.currentvalue); values.ol19 = list.ohl2.item(list.pickerhl.currentvalue); values.p19 = list.phl.item(list.pickerhl.currentvalue); values.g20 = list.pickerhl.nextvalue; values.oh20 = list.ohl1.item(list.pickerhl.currentvalue); values.ol20 = list.ohl2.item(list.pickerhl.currentvalue); values.p20 = list.phl.item(list.pickerhl.currentvalue);]


Here is the lists its drawn from:
<list ohl1>
/ items = (3.85,3.85,3.85,3.85,3.85,2,2,2,2,2)
</list>

<list ohl2>
/ items = (.10,.10,.10,.10,.10,1.60,1.60,1.60,1.60,1.60)
</list>

<list phl>
/ items = (.1,.2,.3,.4,.5,.6,.7,.8,.9,1,.1,.2,.3,.4,.5,.6,.7,.8,.9,1)
</list>

<list pickerhl>
/ selectionmode = random
/ items = (1-20)
/ selectionrate = always
</list>


By Dave - 2/2/2016

Since you only posted a fraction of the code / something that cannot be easily run and inspected, this is somewhat of a guess: The problem, I believe, is how you specified <list pickerhl>.

Instead specify

<list pickerhl>
/ selectionmode = random
/ poolsize = 20
/ selectionrate = always
</list>

and in your /ontrialbegin attribute replace all instances of 'nextvalue' with 'nextindex' as well as all instances of 'currentvalue' with 'currentindex'.

/ ontrialbegin = [values.g1 = list.pickerhl.nextindex;
    values.oh1 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol1 = list.ohl2.item(list.pickerhl.currentindex);
    values.p1 = list.phl.item(list.pickerhl.currentindex);

    values.g2 = list.pickerhl.nextindex;
    values.oh2 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol2 = list.ohl2.item(list.pickerhl.currentindex);
    values.p2 = list.phl.item(list.pickerhl.currentindex);

    values.g3 = list.pickerhl.nextindex;
    values.oh3 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol3 = list.ohl2.item(list.pickerhl.currentindex);
    values.p3 = list.phl.item(list.pickerhl.currentindex);

    values.g4 = list.pickerhl.nextindex;
    values.oh4 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol4 = list.ohl2.item(list.pickerhl.currentindex);
    values.p4 = list.phl.item(list.pickerhl.currentindex);

    values.g5 = list.pickerhl.nextindex;
    values.oh5 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol5 = list.ohl2.item(list.pickerhl.currentindex);
    values.p5 = list.phl.item(list.pickerhl.currentindex);

    values.g6 = list.pickerhl.nextindex;
    values.oh6 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol6 = list.ohl2.item(list.pickerhl.currentindex);
    values.p6 = list.phl.item(list.pickerhl.currentindex);

    values.g7 = list.pickerhl.nextindex;
    values.oh7 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol7 = list.ohl2.item(list.pickerhl.currentindex);
    values.p7 = list.phl.item(list.pickerhl.currentindex);

    values.g8 = list.pickerhl.nextindex;
    values.oh8 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol8 = list.ohl2.item(list.pickerhl.currentindex);
    values.p8 = list.phl.item(list.pickerhl.currentindex);
   
    values.g9 = list.pickerhl.nextindex;
    values.oh9 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol9 = list.ohl2.item(list.pickerhl.currentindex);
    values.p9 = list.phl.item(list.pickerhl.currentindex);

    values.g10 = list.pickerhl.nextindex;
    values.oh10 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol10 = list.ohl2.item(list.pickerhl.currentindex);
    values.p10 = list.phl.item(list.pickerhl.currentindex);

    values.g11 = list.pickerhl.nextindex;
    values.oh11 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol11 = list.ohl2.item(list.pickerhl.currentindex);
    values.p11 = list.phl.item(list.pickerhl.currentindex);

    values.g12 = list.pickerhl.nextindex;
    values.oh12 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol12 = list.ohl2.item(list.pickerhl.currentindex);
    values.p12 = list.phl.item(list.pickerhl.currentindex);

    values.g13 = list.pickerhl.nextindex;
    values.oh13 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol13 = list.ohl2.item(list.pickerhl.currentindex);
    values.p13 = list.phl.item(list.pickerhl.currentindex);

    values.g14 = list.pickerhl.nextindex;
    values.oh14 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol14 = list.ohl2.item(list.pickerhl.currentindex);
    values.p14 = list.phl.item(list.pickerhl.currentindex);

    values.g15 = list.pickerhl.nextindex;
    values.oh15 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol15 = list.ohl2.item(list.pickerhl.currentindex);
    values.p15 = list.phl.item(list.pickerhl.currentindex);

    values.g16 = list.pickerhl.nextindex;
    values.oh16 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol16 = list.ohl2.item(list.pickerhl.currentindex);
    values.p16 = list.phl.item(list.pickerhl.currentindex);

    values.g17 = list.pickerhl.nextindex;
    values.oh17 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol17 = list.ohl2.item(list.pickerhl.currentindex);
    values.p17 = list.phl.item(list.pickerhl.currentindex);

    values.g18 = list.pickerhl.nextindex;
    values.oh18 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol18 = list.ohl2.item(list.pickerhl.currentindex);
    values.p18 = list.phl.item(list.pickerhl.currentindex);

    values.g19 = list.pickerhl.nextindex;
    values.oh19 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol19 = list.ohl2.item(list.pickerhl.currentindex);
    values.p19 = list.phl.item(list.pickerhl.currentindex);

    values.g20 = list.pickerhl.nextindex;
    values.oh20 = list.ohl1.item(list.pickerhl.currentindex);
    values.ol20 = list.ohl2.item(list.pickerhl.currentindex);
    values.p20 = list.phl.item(list.pickerhl.currentindex);
    ]
By nashby - 2/2/2016

That didnt seem to fix it either. I have attached the file as its a lot of code.
By Dave - 2/2/2016

And here's something that does not make sense about your code:
- The way I read it, you are essentially selecting a random index number between 1 and 20 from list.pickerhl.

/ ontrialbegin = [values.g1 = list.pickerhl.nextvalue;
    values.oh1 = list.ohl1.item(list.pickerhl.currentvalue);
    values.ol1 = list.ohl2.item(list.pickerhl.currenvalue);
    values.p1 = list.phl.item(list.pickerhl.currentvalue);

and then try to pull the items *corresponding to that index number* from list.oh1, list.ohl2 and list.phl. You then move on to pick the next random index number from list.pickerhl and so forth.

The *problem* is that some of your <list>s *don't actually have any items corresponding to certain index numbers*. And that's where things will (and should) fail to evaluate.

<list ohl1>
/ items = (3.85, 3.85, 3.85, 3.85, 3.85, 2, 2, 2, 2, 2)
</list>

only has 10 items. Suppose the index drawn is 13. What should the list return? It has no 13th item. So the evaluation will fail for any index > 10. The same is true for

<list ohl2>
/ items = (.10, .10, .10, .10, .10, 1.60, 1.60, 1.60, 1.60, 1.60)
</list>

which also contains only 10 items (i.e., indices 1-10 will work, anything > 10 will not).

With 20 items

<list phl>
/ items = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1)
</list>

list.phl, however, is fine.
By nashby - 2/2/2016

Yup that was it stupid copy and paste error. Thanks for catching it :)