|
|
Sven Littkowski <I### [at] SvenLittkowskiname> wrote:
I'm gonna go with Christoph's sharp eye and programming kung-fu.
> >> The value "AmountLines" allows me to set the amount of oar lines above
> >> each other, but strangely, I always get just one line. I am very sure,
> >> the fault is with me: "I am not seeing the forest because of all the
> >> trees in my eyesight". Means, I am looking at the scene code, and just
> >> can't discover the error in thinking/writing. Can you help?
> >
> > [...]
> >> #declare MyNumber = 0;
This line only ever gets parsed once.
> >> #macro MyOarLine(AmountOarsInLine,MyHeightMoreThis)
> >> union
> >> {
> >> #while(MyNumber<AmountOarsInLine)
{stuff}
> >> #declare MyNumber = MyNumber+1;
> >> #end
Now MyNumber = AmountOarsInLine.
Since you don't ever do #declare MyNumber = 0; to reset that, it STAYS this way.
The next time you run the macro, the #while directive just goes, "I'm already
maxxed out", and exits.
> >> }
> >> #end
> >
> > You need to set `MyNumber = 0` each time you're running the macro (i.e.
> > the `#declare` should be inside the macro. Also, I'd suggest using
> > `#local` instead; it's good practice for macros, unless you want to pass
> > values out of the macro via global variables.)
So the question is: Did you move #declare MyNumber = 0; to inside the macro and
run it?
Right after
#while(MyNumber<AmountOarsInLine)
put
#debug "creating row of oars \n"
or something, and see what happens.
The more you try to head off bugs, you'll find the less you have to debug...
Post a reply to this message
|
|