[Closed] Using variables in max script to control keyframes
I am about to start work on a project that contains a lot of text objects. I have written some simple scripts to animate my text (rotations etc). How do I write into the script a variable to control the beginning and end keyframes? As of now I have all animations beginning at frame 7 and ending at frame 10. But as the project moves ahead I don’t want every animation to start and end on frame 7 and 10. Can some key help with this? I am pretty new to scripting. Thanks.
Here is a Section of code I’m using to set my start and end frames maybe this will be of some help.
spinner s_Sf "Start Frame: " width:120 range:[1,100000,1] type:#integer across:2
spinner s_Ef "End Frame: " width:120 range:[2,100000,101] type:#integer align:#right
on s_Sf changed val do
(
--To change the start frame of the interval only:
animationRange = interval val s_Ef.value
)
on s_Ef changed val do
(
--To change the end frame of the interval only:
animationRange = interval s_Sf.value val
)
Thanks. Sorry, but I am not very good at this. Below is my time script (this is just a short chunk that will be added into my text scripts):
max tool animmode
set animate on
sliderTime = 7
max set key keys
sliderTime = 10f
max set key keys
max tool animmode
set animate off
where would I add what you have created?
Ok there is a lot of maxscript help available and
The following code was taken from http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help//files/GUID-22A56B6C-CB64-49BA-8C15-0354378EB575.htm it will animate the box at the time values you have in your example.
It is a part of the built in Maxscript help and a part of this series on maxscript
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help//files/GUID-4C1D639F-0A2C-402D-A078-56D8A8DB4964.htm
Some other really good tutorial can be found at:-
http://area.autodesk.com/blogs/chris/a-very-gentle-introduction-to-maxscript-for-artists
https://vimeo.com/album/1514565
http://angryarray.servegame.com/
mybox = box() --create a box and assign it to a variable
mybox.lengthsegs = 10 -- Now using the variable mybox, we change some of the boxes properties
mybox.widthsegs = 10
mybox.heightsegs = 10
mybox.mapCoords = true
animate on
(
at time 7 (mybox.pos = [-100, 0, 0]; mybox.scale = [1, 1, 0.25])
at time 10 (mybox.pos = [100, 0, 0]; mybox.scale = [1, 1, 3])
)