POV-Ray : Newsgroups : povray.general : Error - missing semicolon when using macro : Re: Error - missing semicolon when using macro Server Time
5 Oct 2024 15:50:35 EDT (-0400)
  Re: Error - missing semicolon when using macro  
From: Cousin Ricky
Date: 21 Jan 2023 16:15:31
Message: <63cc55f3$1@news.povray.org>
On 2023-01-21 14:15 (-4), Tom A. wrote:
> 
> However, when I use it, I get
> 
> "C:\POVRay\scenes\ArtDecoShips\errortest.pov" line 11: 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.
> 
> Render failed
> -
> 
> Yet the actual line where the macro is invoked has a semicolon.
> 
> The code can be made to work by putting parentheses around the call:
> #local c2 = ( subclock2(.1,.2,cccc) );

If you put the parentheses around the body of the macro, you won't have
to babysit the macro with each call:

 #macro subclock2( start, complete, cnt)
   // converts time (in cnt) between start and complete into
   // a value between 0 and 1
 (
   #if (cnt< start)
  0
   #else
  #if (cnt>complete)
    1
  #else
    ((cnt - start) / (complete - start))
  #end
   #end
 )
 #end // subclock2


Post a reply to this message

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