POV-Ray : Newsgroups : povray.general : Strange behavior : Re: Strange behavior Server Time
22 Jun 2024 22:33:11 EDT (-0400)
  Re: Strange behavior  
From: eticre
Date: 16 Jan 2015 20:10:00
Message: <web.54b9b549ec0f5b601591f79b0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> On 16/01/2015 03:04, Anthony D. Baye wrote:
> > Say I have a macro that returns values:
> >
> > #macro someMacroReturningAValue(params)
> >      #local _RESULT = foo;
> >      // do stuff here...
> >      _RESULT
> > #end
> >
> > I can use this macro in a computation, thusly:
> >
> > object { bar translate someMacroReturningAValue(params)*x }
> >
> > but I cannot set the macro as the rValue of a declaration, like so:
> >
> > #declare blah = someMacroReturningAValue(params);
>
> The below code runs fine here, does it work ok on your installation?
> What are you doing differently (eg what is "params" defined as?). Can
> you produce just a few lines that others can run to reproduce the problem?
>
> #macro someMacroReturningAValue(params)
>      #local _RESULT = params * 2;
>      _RESULT
> #end
> #local p = 1;
> #declare blah = someMacroReturningAValue(p);

hallo

this fail

#declare rndx=seed(123);
#macro rnr(nrx,mii,mxx)
 #if(mii>=0)
   (rand(nrx)*(mxx-mii+1)) + mii
 #else
   mii+(mxx-mii)*rand(nrx) /////////  LINE 40
 #end
#end

#local d=0;
#local d=rnr(rndx,-20,20);

 line 40: 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.
Fatal error in parser: Cannot parse input.
Render failed

this work ok

#declare rndx=seed(123);
#macro rnr(nrx,mii,mxx)
 #if(mii>=0)
   (rand(nrx)*(mxx-mii+1)) + mii
 #else
   mii+(mxx-mii)*rand(nrx)
 #end
#end

#local d=<0,0,0>;
#local d=<rnr(rndx,-20,20),0,0>;


Post a reply to this message

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