POV-Ray : Newsgroups : povray.newusers : Calling 'procedures' with variables? : Re: Calling 'procedures' with variables? Server Time
5 Nov 2024 05:24:47 EST (-0500)
  Re: Calling 'procedures' with variables?  
From: Chris Huff
Date: 30 Aug 2000 09:38:35
Message: <chrishuff-8621C7.08400930082000@news.povray.org>
In article <39AC60D1.D4A0E968@istar.ca>, sde### [at] istarca wrote:

> However, Pov still complains when it gets to the first line of the 
> code which contains the n variable, saying "numeric expression 
> expected but undeclared identifier 'n' found instead."

This sounds like a typo somewhere. Make sure you use an upper-case 
letter in all variables to avoid conflicts with keywords, and make sure 
you use the same variable name in the pigment as you used in the macro 
parameter list.


> Am I missing something fundamental here?

Try something more like this:

#macro PigmentFunc (n)
pigment { bla bla n bla bla }
#end

...

texture {PigmentFunc(0.5)}


You can also use the macro to declare a pigment, like this:

#declare MyPigment = PigmentFunc(0.35)


> Would there be any benifit in my posing the code?

It would help us to find what exactly is wrong with it, but you seem to 
be doing it in a round-about way, you might want to completely change 
the way you are doing it.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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