[LON-CAPA-users] multiple random-label images?

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Thu, 20 Mar 2003 13:13:58 -0500 (EST)

Hi John,

> Can I make a random label image map problem that randomizes a selection 
> of images, in addition to randomizing the labels? What I'm thinking is 
> to have, say, 4 or 5 variants of an image. I would need to be able to 
> specify label locations for each variant independently. I've played a 
> little in construction space on this, but can't figure it out.

There are two ways one might do this, I like the first one best.

Using the xml constructs:
  <script type="loncapa/perl">$whichimage=&random(1,2,1);</script>
  <block condition="$whichimage == 1">
     <randomlabel bgimg="/res/msu/bio/EnzymeEnergy/graphics/ADP_P_symb.gif">
        <labelgroup type="text" name="rlimage">
           <location x="1" y="50"></location>
           <location x="1" y="100"></location>
  <block condition="$whichimage == 2">
    <randomlabel bgimg="/res/msu/bio/EnzymeEnergy/graphics/ATP_symbol.gif">
       <labelgroup type="text" name="rlimage">
          <location x="100" y="100"></location>
          <location x="100" y="50"></location>

Using <script> to do everything,

  <script type="loncapa/perl">
  <randomlabel bgimg="/res/msu/bio/EnzymeEnergy/graphics/$image">
    <labelgroup type="text" name="rlimage">
      <location x="$$location[0]" y="$$location[1]"></location>
      <location x="$$location[2]" y="$$location[3]"></location>
guy@albertelli.com  LON-CAPA Developer  0-7-7-1-