POV-Ray : Newsgroups : povray.general : arrays.inc - Rand_Array_Item() trouble : Re: arrays.inc - Rand_Array_Item() trouble Server Time
1 Aug 2024 04:12:56 EDT (-0400)
  Re: arrays.inc - Rand_Array_Item() trouble  
From: Chris B
Date: 12 Apr 2006 15:59:08
Message: <443d5c0c$1@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote in message 
news:web.443d560fde047fad6c4803960@news.povray.org...
> Hmm, the problem seems to be as follows:
> declares of floats need to be followed by ';'
>
>  #declare A=1;
>
> 1) placing the ';' outside an #if block doesn't work, the #else or #end is
> encountered before the semicolon is found
>  #declare B= #if(A=1) 12 #else 13 #end; ---> doesn't work
>
> 2) placing the ';' inside an #if block does work
>  #declare B= #if(A=1) 12; #else 13; #end ---> works
>
> essentially what is happening is event 1), the macro contents replace the
> macro call, thus the semicolon gets placed outside the #if block and
> generates an error.  When placing this inside the str() or concat()
> functions, the semicolon is not required insdie the function and it parses
> fine.

Hi Trevor,

Prompted by your findings I tried just putting the macro call inside 
brackets and that seems to work too:

#declare Test = (Rand_Array_Item(MyArray,RS));
#debug concat("Test2: ", str(Test,0,0), "\n")

Regards,
Chris B.


Post a reply to this message

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