Display the volume of an object

Hey, I found a volume calculation script on this forum, and Im trying to use it with my Rollout, by having a button activate it, and display the result somewhere. First problem, what should I use to display the volume? An edit box or a label, or something else, but I don't want to be able to touch whatever is displayed so edit box seems like the wrong choice.
And also, how do I actually display whats stored in that 'volume' variable after its been calculated?? I cant seem to find a way to do it :/ Iv checked on google, but cant find anything about "displaying variables". I hope someone can help.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Why you serch in Google then

Why you serch in Google then Max has excellent script reference? While Listener or maxScript Editor is open and selected, just press F1 to open it. But however, let helps you a little bit to start. If you already decide to display result using Label UI control, then as you can see, it used string value, so if your function or variable keeps string - you can assign it directly, or if not - need to convert it to a string. There is some simple example:

rollout test "Test"
(
	local a = "10" -- string var.
	local b = 12 -- integer var.
 
	label lb_result "" -- Label
	button bt_A "Show A"
	button bt_B "Show B"
 
	on bt_A pressed do
		lb_result.text = a -- assign directly
 
	on bt_B pressed do
		lb_result.text = b as string
)
createDialog test

my recent MAXScripts RSS (archive here)

gordon13's picture

Thanks. I was wondering why

Thanks. I was wondering why mine wasn't working, and I automatically assumed I wasn't using the code correctly, when in fact I wasn't even calling the volume calculation function... It was just sitting there.. so that was my problem :P I got it displaying in an edit box now, thanks anyway.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.