Notifications
Clear all

[Closed] querybox message disabling second time

i’ve been playing around with querybox but now stuck with a problem. In this rollout enabling the checkbox will popup a message. if i click yes it will change the render to MR. but the problem is if i click it again it will pop up the same message. How can i avoid the message second time?

try destroydialog test catch ()
rollout test ""
(
	checkbox chk "Mental-Ray"
	
	on chk changed state do
	(
		if querybox "Do you really want to change to MR" beep: true then
		(
			renderers.current = mental_ray_renderer()
		)
		else
		(
			chk.tristate = 0
			renderers.current = Default_Scanline_Renderer()
		)
	)
)

createdialog test
4 Replies

You mean when you uncheck it? If the only thing you want to achieve is to avoid the dialog when unchecking it and have it pop up again after checking it, just add “if state then…”. Your else statement changes the current renderer too, though, which might confuse the user. It would be better to first get the current one and store it to be assigned back upon unchecking the box.

try destroydialog test catch ()
rollout test ""
(
	checkbox chk "Mental-Ray"
	
	on chk changed state do
	(
		if state then
		(
			if querybox "Do you really want to change to MR" beep: true then
			(
				renderers.current = mental_ray_renderer()
			)
		   else
			(
				chk.tristate = 0
				renderers.current = Default_Scanline_Renderer()
			)
		)
	    else renderers.current = Default_Scanline_Renderer() -- if you really want to have it hardcoded
	)
)
createdialog test
1 Reply
(@patriculus)
Joined: 11 months ago

Posts: 0

Thanks swordslayer…this is what i’ve been looking for…i referred to MXS Reference but didnt cover this…

Thanks again mate

Glad to be of assistance. One of the best ways to find out stuff that’s hard to find in help is by reading scripts written by others and following the logic. There are some example scripts on the max install CD or you can just search the forums for Bobo’s replies to older posts, all nicely commented. Most of the time it’s not so much abot knowing everything about scripting, rather setting up the logic first.

In your case it’s quite easy logic with just if-then-else expressions which is covered very well in the helpfile. Pseudocode:

on changing the state of the checkbox do
	if it's checked after the change (state == true or simply state, both return true in that case)
		ask if the user really wants to commit the changes
	        if so, make the changes   
	        otherwise uncheck the button
	if it isn't checked (i.e. the user unchecked it)
		do something else

Thanks for the info swordslayer. your infos are very helpful