POV-Ray : Newsgroups : povray.general : Macro problem : Re: Macro problem Server Time
29 Jul 2024 00:27:27 EDT (-0400)
  Re: Macro problem  
From: scott
Date: 11 Oct 2013 06:19:24
Message: <5257d0ac$1@news.povray.org>
> #macro randsign()
>   #if (rand(HPlanet_Seed_Value) > 0.5)
>    1
>   #else
>    -1
>   #end
> #end

It seems you can't do that (IDK why - maybe a bug, or more likely a 
"feature" of the parser). In fact you can't even do this:

#macro A()
#if(true)
1
#end
#end

It doesn't like having anything to return inside a #if within a #macro

A solution is to just use a temporary variable:

#macro randsign()
  #if (rand(HPlanet_Seed_Value) > 0.5)
   #local temp = 1;
  #else
   #local temp = -1;
  #end
  temp
#end


Post a reply to this message

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