POV-Ray : Newsgroups : povray.programming : Random and array : Random and array Server Time
13 Jul 2024 09:57:21 EDT (-0400)
  Random and array  
From: Jimi aka James
Date: 22 May 2009 10:20:01
Message: <web.4a16b372ce522aaafb1f3ffe0@news.povray.org>
Hi :-),
I need help, I am making a stadium and I want to do people on it, I made it,
everything was good but, all of them had the same t-shirt, so I wanted to use
randomize function (this is my code):


#include "colors.inc"
#include "textures.inc"
#include "arrays.inc"

#declare lors = array[5] {Black,White,Red,Green,Blue}
#declare RS = seed(1215);

// camera ---------------------------------
camera {location <0.0 , 20 ,-34>
        look_at  <0.0 , 0.0 , 0.0>}
// sun ------------------------------------
light_source{<150,2500,150> color White}

// sky -----------------------------------
sky_sphere {
    pigment {
        gradient <0,1,0>
        color_map { [0.00 rgb <0.6,0.7,1.0>]
                    [0.35 rgb <0.0,0.1,0.8>]
                    [0.65 rgb <0.0,0.1,0.8>]
                    [1.00 rgb <0.6,0.7,1.0>]
                  }
                scale 2
            } // end of pigment
           } //end of skysphere -----------
// ground ---------------------------------
plane{ <0,0.0001,0>, 0
       texture{
          pigment {color White}
               } // end of texture
     } // end of plane
//------------------------------------------
#declare kolorek = str((Rand_Array_Item(lors,RS))

#declare chopek = union{
difference {
  sphere { <0, 0, 0>, 0.2  scale <0,4,0>}
  box {<0,0,0>, <1,0,1> }
          pigment {color Red}
          }

  sphere { <0, 0.7, 0>, 0.1  pigment {color Yellow} scale <0,1.3,0>}
                   }

   #local Index1 = 1;
#local Index3 = 0;
#while(Index1 <= 20)

   #local Index2 = 0;
   #while(Index2 <= 280)

      object {chopek translate <Index3, Index1*0.5, Index2*0.5> pigment { color
kolorek }
        #if (Index2= 20 | Index2=65 | Index2 = 110 | Index2 = 155 | Index2 = 200
| Index2 = 245)
          #local Index2 = Index2 + 5;


        #else
      #local Index2 = Index2 + 1;
      #end
   #end

   #local Index1 = Index1 + 1;
   #local Index3 = Index3 +1;
#end



Any ideas, solutions to my problem? I have error  in the line:
--object {chopek translate <Index3, Index1*0.5, Index2*0.5> pigment { color
kolorek }--
I tried declared "kolorek" with object and brackets and without it but it still
does'nt work. Please help friends.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.