PDA

View Full Version : Why doesn't this work?


FatAssasin
12-24-2003, 01:09 AM
I'm brand new to MaxScript and I'm trying to create a simple little utility to advance or move back a certain number of frames in an animation. Here's the script...

utility vcrpanel "VCR Panel"
(
spinner frames "Frames" range:[0,100,1.0]
button forward "Advance Frames"
button rewind "Rewind Frames"
on forward pressed do
(
sliderTime += frames
)
on rewind pressed do
(
sliderTime -= frames
)
)

The way understand it, the variable "frames" should get the number from the spinner and then be used in the "sliderTime" command. If I put an actual number in the argument it works, but when I use the variable it gives me an error saying "Incompatible types: 40f, and SpinnerControl:frames".

What am I doing wrong? :hmm:

Baldrick
12-24-2003, 09:43 AM
You're almost there. You need to use frames.value to get the value property from the frames control and the moment you're trying to add/subtract a GUI control from the sliderTime (which, of course, doesn't make sense and gives you the error you're getting).

So you're script should read


utility vcrpanel "VCR Panel"
(
spinner frames "Frames" range:[0,100,1.0]
button forward "Advance Frames"
button rewind "Rewind Frames"
on forward pressed do
(
sliderTime += frames.value
)
on rewind pressed do
(
sliderTime -= frames.value
)
)

FatAssasin
12-26-2003, 03:50 PM
Thank a bunch. It works like a charm! So would I have to use the ".value" at the end of any numeric variable to get the number from it?

I still have a long way to go with this, but I appreciate the help.

magicm
12-26-2003, 07:40 PM
Originally posted by FatAssasin
So would I have to use the ".value" at the end of any numeric variable to get the number from it?

No.. ".value" is a property of the spinner control. Lookup "spinner" in the online maxscript reference to see the other properties.. The ".value" property of the spinner (obviously) holds the current value of the spinner control, whereas eg. ".range" holds the value range of the spinner etc..

My explanation might sound a bit stange, but this is the best I can come up with right now ;). Hope it helps

Martijn

FatAssasin
12-26-2003, 07:59 PM
No, that makes sense. So "frames" isn't actually a variable as I understand it, but the internal name of the spinner. And it holds all the different types of data that a spinner can use, right? And if I want to extract a certain type of that data, in this case the spinner value, then I use the parameter for that type of data after the name of the variable, "frames".

I think I've got it. That helps, thanks.

CGTalk Moderation
01-17-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.