Notifications
Clear all

[Closed] Undo contexts

I’m trying to get max 2008 to display a proper undo entry in the list for some scripted stuff, but for some reason it always puts ‘MAXScript’ even though I’m using the optional string in the undo context… For example:


(
	undo "Create Boxes" on ( for x = 1 to 10 do box pos:[random -100 100,random -100 100,random -100 100] )
)

refuses to put ‘Create Boxes’ in the list and just defaults to ‘MAXScript’. Any ideas what I’m doing wrong?

3 Replies

hi simon,

im not using 2008 yet, but in the past I have had the same issue. I found if I defined the string as a local variable, and passed that variable instead of the string in the undo code, it would display correctly.

Still not having much luck with the name, even using a variable as suggested 🙁

hi simon,

i had tried the same thing and was confused as to why it worked on my scripts, and not with your example. The reason was that in my scripts the undo context was contained within an “on pressed” handler in the code. if you put it in a rollout and call it when a UI element is pressed, it will update the undo list with the correct text. outside of that, i guess max just sees the fact that some ‘general’ maxscript has been run.

rollout test"" width:162 height:56
 (
 	button btn1 "If i could turn back time...." pos:[16,11] width:133 height:31
 	on btn1 pressed do undo "Create Boxes" on ( for x = 1 to 10 do box pos:[random -100 100,random -100 100,random -100 100] )
 )
 createdialog test