POV-Ray : Newsgroups : povray.newusers : arrays Server Time
5 Sep 2024 04:19:38 EDT (-0400)
  arrays (Message 1 to 4 of 4)  
From: jimbobjim
Subject: arrays
Date: 18 Feb 2002 19:53:39
Message: <3c71a213@news.povray.org>
Hi

Am I right in thinking that to set a float value equal to the nth element of
an array I would do something like:

#declare my_array = array[3] {10,11,12}

#declare my_value = array[2];

hence my_value would take its value from the 2nd array element, ie  = 11.
The only problem is, I get a
"Parse Error: All #declares of float, vector, and color require semi-colon
';' at end if the
language version is set to 3.5 or higher.
Either add the semi-colon or set the language version to 3.1 or lower."
error - even though the semi-colon is present.

Thanks
jim


Post a reply to this message

From: Warp
Subject: Re: arrays
Date: 18 Feb 2002 20:42:32
Message: <3c71ad88@news.povray.org>
jimbobjim <jim### [at] blueyondercouk> wrote:
: #declare my_array = array[3] {10,11,12}

: #declare my_value = array[2];

: hence my_value would take its value from the 2nd array element, ie  = 11.

  Firstly, it has to be:

#declare my_value = my_array[2];

  Secondly, the indexing starts from 0, which means that '12' is assigned
to 'my_value'.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: jimbobjim
Subject: Re: arrays
Date: 19 Feb 2002 04:56:12
Message: <3c72213c@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3c71ad88@news.povray.org...
> jimbobjim <jim### [at] blueyondercouk> wrote:
> : #declare my_array = array[3] {10,11,12}
>
> : #declare my_value = array[2];
>
> : hence my_value would take its value from the 2nd array element, ie  =
11.
>
>   Firstly, it has to be:
>
> #declare my_value = my_array[2];

oops, this is what is have in the pov code, but I had a little finger
trouble in typing the email...but I still get the missing semi-colon error.

Jim


Post a reply to this message

From: Warp
Subject: Re: arrays
Date: 19 Feb 2002 06:27:12
Message: <3c72368f@news.povray.org>
jimbobjim <jim### [at] blueyondercouk> wrote:
: but I still get the missing semi-colon error.

  I don't.

  Are you sure it's not issued for an error in another line (perhaps a previous
line)?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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