Ah! Works perfectly now.<br><br>Thanks so much for your help!<br><br>-Adam<br><br><div class="gmail_quote">On Mon, May 18, 2009 at 3:46 PM, David McFarlane <span dir="ltr"><<a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
D'oh!  Of course, why didn't I see that!  "Picture:drawno" is treated<br>
as a literal string, it does not evaluate the variable.  To do that<br>
you need to construct a string containing the value of the<br>
variable.  So please try something like the following:<br>
<div class="im"><br>
TestList.setAttrib counter, "Item", c.GetAttrib("Picture:" & drawno)<br>
<br>
</div><font color="#888888">-- David McFarlane, Professional Faultfinder<br>
</font><div class="im"><br>
<br>
At 5/18/2009 03:27 PM Monday, you wrote:<br>
>Ah, I had never thought of that.<br>
><br>
>However, I just tested it with fixed defined numbers (ie:<br>
>c.GetAttrib("Picture:3")) and it seems to index the correct files<br>
>just fine. It's only when I use a variable in the colon notation<br>
>that it has problems (ie: c.GetAttrib("Picture:y")) and defaults to zero.<br>
><br>
>Are there other ways of doing this randomization procedure? It's a<br>
>little bit sophisticated, which is why I'm using inline code. The<br>
>program needs to randomly select one picture from 8 pictures in a<br>
>list that are all presented in random sequence, store that filename<br>
>and write it to another list for later presentation.<br>
><br>
>Adam<br>
><br>
>On Mon, May 18, 2009 at 3:17 PM, David McFarlane<br>
</div><div class="im">><<mailto:<a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>><a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>> wrote:<br>
><br>
>Adam,<br>
><br>
>Wow, I don't know offhand if that syntax works.  It looks like you<br>
>are trying to use "colon syntax", and I don't know if you can use<br>
>that with the Context.GetAttrib() method, that may work only with the<br>
>List.GetAttrrib() method (e.g., colon syntax has to know which List<br>
>has the attribute "Picture").  I would have to make some demo<br>
>programs and look at the generated code to explore this further, but<br>
>I will leave that to you.<br>
><br>
>-- David McFarlane, Professional Faultfinder<br>
><br>
><br>
> >I just realized when you sent this that it might be due to how the<br>
> >random number is applied.<br>
> ><br>
> >I have the randomization code to select a picture for presentation,<br>
> >so I did this:<br>
> >TestList.setAttrib counter, "Item", c.GetAttrib("Picture:drawno")<br>
> ><br>
> >...in which one of the 8 files in the attribute "Picture" on another<br>
> >list is randomly selected.<br>
> ><br>
> >Is it defaulting to zero because this isn't syntactically valid?<br>
> ><br>
> >Adam<br>
> ><br>
> >On Mon, May 18, 2009 at 2:59 PM, David McFarlane<br>
</div><div><div></div><div class="h5">> ><<mailto:<a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>><mailto:<a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>><a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>> wrote:<br>

> ><br>
> >Adam,<br>
> ><br>
> >Hmm, that bit of code works perfectly for me.  I suspect the problem<br>
> >lies somewhere else in the script.  Just to be clear, try the<br>
> >following and see what happens:<br>
> ><br>
> >Dim drawno As Integer<br>
> >Dim i as Integer<br>
> >For i = 1 to 8<br>
> >     drawno = Random(0, 7)<br>
> >     MsgBox drawno<br>
> >Next i<br>
> ><br>
> >-- David McFarlane, Professional Faultfinder<br>
> ><br>
> ><br>
> > >I'm having a little problem with randomization code in Ebasic. I<br>
> > >have this code:<br>
> > ><br>
> > >Dim drawno As Integer<br>
> > >drawno = Random(0, 7)<br>
> > ><br>
> > >...and yet, drawno is initialized to '0' every time. This code is<br>
> > >used for 8 repetitions in the program, and each time "0" comes up.<br>
> > >Even with "Randomize" in front, the same thing happens.<br>
> > ><br>
> > >Is there something I'm doing wrong?<br>
> > ><br>
> > >Adam<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
><br>
><br>
><br>
><br>
><br>
<br>
<br>
</div></div></blockquote></div><br>
<br>
--~--~---------~--~----~------------~-------~--~----~<br>
You received this message because you are subscribed to the Google Groups "E-Prime" group. <br> To post to this group, send email to e-prime@googlegroups.com <br> To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com <br> For more options, visit this group at http://groups.google.com/group/e-prime?hl=en<br>
-~----------~----~----~----~------~----~------~--~---<br>
<br>