|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm attempting to write a macro that looks up a value in a table, as follows
#macro __get_table_element1( tbl, e, n )
// Macro to calculate interpolated value from table.
#local tick = clock * 1399;
#local ftick = floor( tick );
#local i0 = ( ftick * n ) + e;
#local i1 = i0 + n;
#if ( 1399 - ftick )
( tbl[i1] )
#else
( tbl[i0] )
#end
#end
When I invoke the macro, as here
#local q10 = __get_table_element1( clip_array, 0, 6 )
for example, I get the folloiwng error:
File: fnord Line: 141
Possible Parse Error: All #version and #declares of float, vector, and color
require semi-colon ';' at end.
In order to get the script to work, I have to run in version 3.1 mode.
If I add a semicolon, either after the return value or at the end of the
local declaration, I get a syntax error.
I believe I've R'd TFM, but I may have missed something.
Thanx.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Steve who wrote:
>I'm attempting to write a macro that looks up a value in a table
Why not just add the ";"s that it's asking for. This works:
#macro __get_table_element1( tbl, e, n )
// Macro to calculate interpolated value from table.
#local tick = clock * 1399;
#local ftick = floor( tick );
#local i0 = ( ftick * n ) + e;
#local i1 = i0 + n;
#if ( 1399 - ftick )
( tbl[i1] );
#else
( tbl[i0] );
#end
#end
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Why not just add the ";"s that it's asking for.
Because you might want to use the macro somewhere where you shouldn't
use a ";".
The proper way is:
#macro Whatever(...)
#if(something)
#local Result = foo;
#else
#local Result = bar;
#end
Result
#end
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Why not just add the ";"s that it's asking for. This works:
>
> #macro __get_table_element1( tbl, e, n )
>
> // Macro to calculate interpolated value from table.
>
> #local tick = clock * 1399;
> #local ftick = floor( tick );
> #local i0 = ( ftick * n ) + e;
> #local i1 = i0 + n;
>
> #if ( 1399 - ftick )
>
> ( tbl[i1] );
>
> #else
>
> ( tbl[i0] );
>
> #end
>
> #end
Adding the ";" to the end of the declaration, as in
#local q10 = __get_table_element1( clip_array, 0, 6 );
would be even better, because it does not break things like
#local q10 = __get_table_element1( clip_array, 0, 6 )*100;
HTH,
Florian
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Florian Brucker who wrote:
>
>Adding the ";" to the end of the declaration, as in
>
> #local q10 = __get_table_element1( clip_array, 0, 6 );
>
>would be even better
An excellent solution apart from the fact that it still throws the
error.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Florian Brucker <tor### [at] torfboldcom> wrote:
> > Why not just add the ";"s that it's asking for. This works:
Thanx. For some reason it didn't work the first time I tried it. I
probably had something else hosed that was masking the real solution.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> An excellent solution apart from the fact that it still throws the
> error.
Ah, shame on me, I didn't test it :(
It felt right, but now I see that it needs Warp's addition to work.
Sorry for the confusion!
Florian
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |