Notifications
Clear all

[Closed] MAXSCRIPT: option box

whats the command/how-to to get that option box next to a command in a quadmenu. i.e.

im doin a little script for myself and this would be very helpful.

thanks for any assistance

14 Replies

You just have to write your macro with the <on altExecute type do> command

for exemple:

macroScript Mysupascript
buttonText:“supascript”
category:“Mine”
toolTip:“works fine”

(
on altExecute type do

                               ( rollout....
                               )

)

thank you

this is what i hav thus far:

–start script–

macroscript PolyCube
category:“Polygon Objects”

(
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:10 width:10 height:10 mapCoords:off pos:[0,0,0] isSelected:on

on altExecute type do
(print "hello"
	)

)
–end script–

the altExecute works and when i hit it, it prints hello. but if i just choose the polycube int the quad, it says max runtime error, no such handler #Execute.

i’ll research it on my own, but if anyone knows the prob off hand i would appriciate it.

thanks

ok, i fixed that part.
–start script–
macroscript PolyCube
category:“Polygon Objects”

(
on execute do
(
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:10 width:10 height:10 mapCoords:off pos:[0,0,0] isSelected:on
)

on altExecute type do
(rollout hello "hello"

editText hello "hello" pos:[15,28] width:113 height:46

gw = newRolloutFloater 300 200
addNewRollout hello gw
	)

)
–end script–

now i can get the popup box with the rollout in it. but i havent put anythin in the rollout. when i try to add an edittext thing, it says:

– Type error: Call needs function or class, got: undefined
– Syntax error: at ), expected <factor>
– In line: )

i hav no clue what its talkin bout. again i will research it on my own.

thanks again

No big troubles, just several little mistakes

the rollout command must be between ()

rollout …
(
edittext…
) — end of rollout

and… addrollout (I don’t think the addNewrollout command exist, got an error message)

so try something like this:


macroscript PolyCube
category:“Polygon Objects”

(
on execute do
(
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:10 width:10 height:10 mapCoords:off pos:[0,0,0] isSelected:on
)

on altExecute type do
(
rollout hello “hello”
(
editText Text “hello” pos:[15,28] width:113 height:46
)

gw = newRolloutFloater “Polycube” 300 200
addRollout hello gw

)
)

it should works

Hope it helps

thanks, it worked like a champ, ive run into another prob, but i will research a little more before buggin u guys

thanks for ur help

ok, i have an apply button in the option box:

–start script–

macroscript PolyCube
category:“Polygon Objects”

(
on execute do
(
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:10 width:10 height:10 mapCoords:off pos:[0,0,0] isSelected:on
)
–define altExecute rollout–
on altExecute type do
(
rollout hello “hello”
(
edittext length “Length” pos:[40,8] width:110 height:20
edittext width “Width” pos:[40,32] width:110 height:20
edittext height “Height” pos:[40,56] width:110 height:20
edittext lengthSegs “Length Segs” pos:[40,88] width:110 height:20
edittext widthSegs “Width Segs” pos:[40,112] width:110 height:20
edittext heightSegs “Height Segs” pos:[40,136] width:110 height:20
button apply “Apply”
)

gw = newRolloutFloater  "Polycube" 300 200
addRollout hello gw
)

--define event handlers for roolout--
on length entered newLenght do
(
length = newLength
)
on width entered newWidth do
(
width = newWidth
)
on apply pressed do
(
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:newLength width:newWidth height:10 mapCoords:off pos:[0,0,0] isSelected:on

)

)

–end script–

when i press the apply button, nothing happens, the recorder doesnt even respond. so i figure theres gotta be a problem in the script. is the event handler for when the user enters text correct? and am i referencing it properly in the apply button eventhandler?

im a newb at this, this is a pretty pointless script, more of a learning excercise than anything else.

thanks for any help

hi,

I think you need to create some locals. But I still only a learner so I’m not sure.

Anyway I’ve created a script a while back which does a simular thing, it works best if you use the quad menu in expert mode alot.

have a look.

Carl

Hi, here is a general layout to follow:

macroscript someName category:“Some Category”
(

on isVisible return someBooleanExpression –optional, return true when item should be visible!
on isChecked return someBooleanExpression –optional, return true when item should be checked!
on isEnabled return someBooleanExpression –optional, return false when item should be greyed out!

on execute do
(
–your main code here
)

on altExecute do
(

rollout someRollout “Rollout”
(

button someButton “Button”

–NOTE: The button handler IS PART OF THE ROLLOUT definition!
on someButton pressed do …

)–end rollout

–CreateDialog usually looks better than a Floater…
createDialog someRollout 200 200

)–end altExecute

)–end macroScript

Page 1 / 2