PDA

View Full Version : Simple Sample Maxscript: Sometimes it works, sometimes it doesn't!


googlo
12-08-2002, 11:16 PM
Ok, this is frustrating. This simple utility sometimes works and sometimes doesn't. For some reason (most of the time) Max doesn't recognize "b" as being anything. I get an ">> MAXScript Rollout Handler Exception: -- Unknown property: "Taper" in undefined <<"

But then other times, with no intervention of my part other than re-evaluating the script using "evaluate all" with repeated tries, it does work! It's like a randomn thing, why@!@@@@$#@#$

Here is the script, does it do what I'm talking about to you?:

-- Game Box Script
-- Author: Alexander Esppeschit Bicalho

Utility gamebox "Game Box"
(
Button create "Create Object"
spinner amount "Taper Amount:" range:[-10,10,-0.2]

on create pressed do
(

b = box() -- this creates the box
b.height = 30 -- these commands define its properties
b.width = b.length = 40
b.mapcoords = on
b.heightsegs = 5

addmodifier b (taper()) -- adds the taper modifier and adjusts it
b.taper.amount = -0.2

) -- end on create pressed

on amount changed val do
(

b.taper.amount = val -- adjusts the taper amount through the spinner

) -- end on amount

) -- end gamebox utility

googlo
12-09-2002, 12:40 AM
I declared the variable once as global for one test and as local for another seperate time of testing within the main body of the script(outside of the invididual creation and spinner blocks) and now it has worked every time with each of those ways.. I guess the variable in question was being implicitly defined locally within the first block and the spinner block couldn't 'see' where b was coming from outside of it's own block, or that it came from anywhere beforehand at all.

CGTalk Moderation
01-13-2006, 11:00 PM
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.