Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Error Handling
  RSS 2.0 ATOM  

Error Handling
Rate this thread
 
26599
 
Permlink of this thread  
avatar
  • Total Posts: 45
  • Joined: 17 July 2007 03:08 AM

what kind of error handling can I use in max script?

Suppose I am moving merrily slong exporting some material data, and I come to a where I get whether or not ambient is mapped, get a textureMap, check if it is a bitmap, and find out it isn’t. Well, my code doesn’t handle that case, so I’d like to alert the user and bail out.

I know there is a messagebox function. Is there some kind of exit function?

what about other kinds of error handling?
exceptions?



Replies: 0
avatar
  • SITT
  • Posted: 03 May 2009 11:34 PM

try () catch() ???



i am Chinese, my English is very poor,thank you for talk
MSN:sitt#live.cn

Replies: 0
avatar
  • Stokes
  • Posted: 04 May 2009 11:19 AM
  • Location: Boston Area, Massachusetts
  • Total Posts: 198
  • Joined: 22 August 2006 03:52 PM
  • Permlink of this post

SITT is correct. Try/catch is slow in MAXScript, however, so if you can try checking specifically for the property it will be faster: something like if isProperty foo #propname then ...



David “Stokes” Stokes
Senior Technical Artist, Blue Fang Games

Replies: 0
avatar
  • IonDave
  • Posted: 10 December 2009 04:26 PM

brekehan 04 May 2009 05:31 AM

… Is there some kind of exit function

My question is along these lines. Look at this code:

try (FinalString substring TempoString (intStartIndex 5) -1) catch 
 
(
    MessageBox 
"The file path must contain the \"Data\" folder." TitlemyTitle
           
--Stop executing the script now
 )

What command stops execution of the script in an expression, such as the END or EXIT SUB commands in VB?



~Dave

http://www.max-realms.com - 3ds Max models, tutorials and forums

Max3-2010

Replies: 0
avatar
  • Anubis
  • Posted: 10 December 2009 05:25 PM

IonDave 11 December 2009 12:26 AM

What command stops execution ?

exit


Max 9 through 2009, XP-Pro x64 SP2
ASUS EAH3450 Series (Driver 8.470).
Core 2 Duo E8400 3GHz, 4Gb Ram, DX9.0c.

Replies: 0
avatar
  • MaxRealms
  • Posted: 10 December 2009 06:17 PM

Anubis 11 December 2009 01:25 AM
IonDave 11 December 2009 12:26 AM
What command stops execution ?
exit

Exit only works in loops



Replies: 0
avatar
  • SITT
  • Posted: 11 December 2009 12:56 AM

Fn Test =
(
 
try (box class) catch 
  
(
     MessageBox 
"Functions Error" Title"Error"
    
return undefined
  )
  MessageBox 
"Test"
)

 Test()


i am Chinese, my English is very poor,thank you for talk
MSN:sitt#live.cn

Replies: 0
avatar
  • IonDave
  • Posted: 11 December 2009 04:45 AM

Thanks, SITT



~Dave

http://www.max-realms.com - 3ds Max models, tutorials and forums

Max3-2010

Replies: 0