PDA

View Full Version : Expressions Syntax Problem


colkai
07-20-2003, 09:38 AM
Can anyone assist please?

I am trying to generate an expression, but keep getting a syntax error - which not very nicely, tends to preceed a LW crash :(

According to the "expression builder" I can specify the position / rotation of an item at a specific point in time as a frame. I can also use relative frame timing.

According to the blurb: [Camera.Position.X, Frame - 5] will give a relative posn, this syntax verifies ok and does indeed work.

[Camera.Position.X, Frame 5] is supposed to specify the value of the item at that given point in time expressed as a frame, (in other words Frame 5 for the scene).
This bombs if I try to enter it in the 'modifier' area, or just comes back with a faulty syntax if done in 'expressions' (thus: [Camera.Position.X,>>> Frame 5<<<] )

Is it broke - wrong or what??
Can it be done as frames, or do I have to express it as a function of Time?

Here is the full expression:
Value * (MasterNull.pos(Time).z) + B

Where 'B' ==
((1 - MasterNull.pos(Time).z) * [Box.Rotation.P, Frame 5])

..And for those NWLW UK guys reading ... yup . you *know what this is for ;)

cagey5
07-20-2003, 09:56 AM
Hmmm I can't imagine what it's for. Did you get my reply earlier btw?

As to your current problem. I have zilch experience with expression builder but I'm assuming that the -5 in the syntax that works is the reletive part and refers to 5 frames earlier. And therefore in the expression you are getting rejected it doesn't read it as 'Frame 5' but is expecting a qualifier either Frame + 5 or frame - 5.

Just a guess as I don't use them.


Later,

colkai
07-20-2003, 11:56 AM
Yup, got your reply,
Just been watching a film so bit of a gap :)

Gonna Take a look at your take now - got a few minutes before me next film starts. Busy don't ya know? (not!) :p

kevman3d
07-20-2003, 10:57 PM
Cagey is correct - As far as I am aware, the word 'Frame' actually returns the current frame. Its the same with 'Time' - it returns the current time.

colkai
07-21-2003, 03:58 AM
Aww Nuts!! :(

The text in the expression builder states that if no operator is provided then it just uses the value as the frame no. i.e. Frame 5 *should* be Frame 5 of the scene.

I guess I could try faking it - how about ((Frame * 0) + 5) - ya think? ;)

Let you know as I'll try this at lunch - unless someone would care to beat me to it :D

colkai
07-21-2003, 07:16 AM
Ok,
I'm *really* confused.

I can't get it to recognise Frame as a frame at all - it insists on seeing it as time.
((Frame * 0) + 5) is actually seen as Frame zero + 5 seconds.

If I do ((Frame * 0) + (5/30)) - then I get the value at frame 5.

Am I doing something wrong - or are the expressions "broken"?

richpr
07-21-2003, 01:11 PM
Multiplying the frame by 0 does not make sense...

Wouldn't you just put Frame, which returns the current frame position... (Frame + 5) is five frames later, (Frame - 5) is five frames earlier and finally (Frame) would be the current frame in the animation?

colkai
07-21-2003, 01:24 PM
Agreed, you would...normally.
However,
I am after a settign at a particular frame. By multiplying by Zero then adding a value, I was trying to set the value to what the controller would be at a given frame, rather than a relative frame.

Alas, it seems certain that 'Frame' is not what the builder text reckons it is.

I am close - but not close enough - Who knows - maybe LW8 has refined this! ;)

Am persevering with it - call me stubborn! :p

richpr
07-21-2003, 01:29 PM
Well, frame seems to be a user variable most of the time... Here's an Lscript from the manual...

"This example creates a Camera Object and displays some of its properties.

@version 2.2
@warnings
@name CameraObjectAgent
@script generic

//Set Globals
frame = 0;

generic
{
camera = Camera();

// Display some Data Members.
info("Name: ", camera.name);

// Display some Methods.
info("Position: ", camera.getPosition(frame));
info("Rotation: ", camera.getRotation(frame));
info("zoomFactor: ", camera.zoomFactor(frame));
info("focalDistance: ", camera.focalDistance(frame));
info("fStop: ", camera.fStop(frame));
}

colkai
07-22-2003, 03:28 AM
Indeed, but as you can see from the attachment, it does suggest 'Frame' (rather than 'frame') should be able to be used in either a relative or absolute capacity.

Don't know if it is the text that is wrong, or if the syntax parser is broken / not implemented for this usage.

Lightwolf
07-22-2003, 04:24 AM
colkai:
I'd assume the text is plain wrong. From a parsers point of view, the only syntax that would make sense imho is
Frame(5)
I doubt that it works though.
You could also try
5 * Scene.fps
Cheers,
Mike

colkai
07-22-2003, 06:02 AM
Originally posted by Lightwolf
I'd assume the text is plain wrong.
You could also try
5 * Scene.fps
Mike
Mike - almost - (5 / Scene.fps) did the trick! '5 *' put it at 5 seconds ;)
That gives me plenty of ideas to play with too.

Cheers! :)

Lightwolf
07-22-2003, 06:09 AM
Oops, sorry, you're right. 5 * fps would be the frame number of second 5 of course. *blush*
Cheers,
Mike

colkai
07-22-2003, 09:10 AM
No Worries Mike! ;)
Thanks for the help.

I just hope expressions documentation is better in LW8 - I'm sure we would benefit from a more in-depth look at what was capable.

They may not be as good as say Relativity, but I think more could be made of them if they had better docs. :)

Lightwolf
07-22-2003, 09:14 AM
Yep, agreed.
On the other hand, in 7.5b/c there have been some nice additions (writing re-useable function libraries for expressions in LScript ) that point in the right direction. But, as with LScript, documentation is the key, and is has to stay up to date as well.
Cheers,
Mike - he who loves expression.