POV-Ray : Newsgroups : povray.general : Automatically named identifiers : Re: Automatically named identifiers Server Time
2 Dec 2024 19:03:44 EST (-0500)
  Re: Automatically named identifiers  
From: Leroy
Date: 5 Nov 2024 16:20:00
Message: <web.672a8b41523ee184a196c5bf712fc00@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> >
> > You're going to have to use parse_string to make the variable name in each
> > iteration.
> > Concat "SplineX" with the char corresponding to the letter you want.
> >
>
> My own initial (naive) approach to this would be to try and use the Parse_String
> macro to the *left* of the = sign, in a #declare. (The macro -- in "strings.inc"
> -- takes a string like "MY_VALUE" or "1.5", writes it to an external .tmp file
> but without the double quotes, then immediately returns it to the scene.)
>
> So a *simple* example of such a construct would seem to be...
>
> #include "strings.inc"
> #declare Parse_String("MY_VALUE")= 27;
>
> I would naively expect this to be the equivalent of...
> #declare MY_VALUE = 27;
>
> but it doesn't work: ""Expected 'undeclared identifier', macro identifier found
> instead."
>
> I tried other iterations of this and they all fail.
>
> Maybe there are other (more complex?) ways of using Parse_String to accomplish
> what the OP wants-- *as* the #declared variable names-- but I don't have a clue
> as to how.

#include "strings.inc"
Parse_String("#declare I")=4;
#debug concat("I =",str(I,0,0),"\n")

works fine  on win3.7 version

Parse_String("#declare I=4;") also works ok
Have Fun!


Post a reply to this message

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