ScriptSpot

Forum topic · General Scripting

help: "at time 1000 <controller> =value" changes value at time 0 aswell

By Ralf · 2008-12-10

Description

Hello,

I'm working on my 1st serious script, and it's comming along great sofar. It's suppost to get data out of an array [Plt=#()], and build a solarsystem.
Building it stationairy works fine with an 'for'-loop [for i=1 to Plt.count do], but now that i'm starting to set keys i bump into something unexpected:

(for readabilaty, i simplified a bit. here Plt[i][1] is a startvalue and Plt[i][2] is a period in frames. globe is a sphere and orbit an ellips, both created earlier)


1       globe.pos.controller = Path_Constraint()
2	globe.pos.controller.path = orbit
3	at time 0 globe.pos.controller.percent = (Plt[i][1])
4	at time 1000 globe.pos.controller.percent = /
                    100*((1000)/(Plt[i][2]))+ Plt[i][1]

in line 2, 2 keys are created [0%@0f and 100%@1000f].
These i expected, but are not correct,so:
in line 3 i assign a start-value to the 1st key. if i do not run line 4, this works fine.

The value of the endframe should be:
100%*(times rotationperiod fits in animationlength)+ startvalue.

if i run line 4 aswell, it indeed sets this key to that value, but it changes my startkey 0f aswell (into this same value-100 )

i tried to figure it out what's wrong with F1 and the Maxscript Essentials book from autodesk, but i'm stuck. so my question: What am i doing wrong?

Comments (3)

Ralf · 2008-12-12

Yes, that did the trick, tnx a lot.
I knew it would be something simple like syntax or so.. like i said, i just started in MaxScript.

On to the next problem :)

Ralf · 2008-12-11

realy? no one? i didnt think this was a hard problem, just some syntax thingy.... or is it my explanation that is unclear?

Anton Berg · 2008-12-11

I am not sure if you are missing the with animate on ()
clause did not see it in your script.

globe = $Sphere01 --mytest obj
orbit = $Circle01 --testPath

globe.pos.controller = Path_Constraint()
globe.pos.controller.path = orbit
with animate on --I wonder if you are missing this part
(
at time 0 globe.pos.controller.percent = 50
at time 1000 globe.pos.controller.percent = 1000
)

At can be anyoing to set keys in 3dsmax, since it has a tendency to always put a keyframe in frame 0. If the object isn´t animated at all. Which in some cases can be very disturbing.

I hope this solves it else just keep posting.
Happy scripting!