ScriptSpot

Forum topic · General Scripting

Question with 2 choice

By Kasimashi · 2013-05-01

Description

Hi !
I need to create a question with 2 choice for example :

"What do you want ?"

- Do (choice 1)
- I don't want (choice 2)
- Cancel

when choice 1 is pressed do ...

when choice 2 is pressed do ...

when cancel is pressed do ...
Stop the script

How translate that in Maxscript ?

Comments (8)

:)

Kasimashi · 2013-05-01

Can we create a answer without " yesNoCancelBox " ?

barigazy · 2013-05-01


answer = yesNoCancelBox "Yes - to delete all children\nNo - to delete all parents" title:"" beep:off
case answer of
(
	(#yes): delete (for o in objects where matchPattern o.name pattern:"*2_*" collect o)
	(#no): delete (for o in objects where matchPattern o.name pattern:"*2_*" and o.parent != undefined collect o.parent)
	(default): print "Canceled!"
)

without YesNoCancelBox

barigazy · 2013-05-01


try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "• • •"
(
edittext sufix "Sufix Pattern:" text:"2_"
button btn_delchilds "Delete childrens" pos:[5,25] width:100 height:20
button btn_delparents "Delete parents" pos:[110,25] width:100 height:20
on btn_delchilds pressed do
(
delete (for o in objects where matchPattern o.name pattern:("*"+sufix.text+"*") collect o)
)

on btn_delparents pressed do
(
delete (for o in objects where matchPattern o.name pattern:("*"+sufix.text+"*") and o.parent != undefined collect o.parent)
)
)
createDialog bgaRoll 220 50 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

Thanks You !!!

Kasimashi · 2013-05-01

Thanks you veru mush barigazy :D

I'll to learn Max script because I'm bad at it today , I know do a little script with step but never a complete script :(

Have a nice day ! :)

Regards

Kasimashi

barigazy · 2013-05-01

Just start with basic stuff, see this training if you already not http://vimeo.com/album/1514565 , read mxs help and ask forum if you have problem with you code. Is that simple or not? :)
Cheers!
Branko

:) funny answer

barigazy · 2013-05-01


if queryBox "Do you want to create a box" beep:false then Box() else print "No Box for you :)"

:p

Kasimashi · 2013-05-01

Thanks but In fact I need :

A question say :

"Do you want a destroy or standart batiment?"

- Standard (choice 1)
- Destroy (choice 2)
- Cancel

if choice 1 is pressed do :

select (for o in objects where matchPattern o.name pattern:"*2_*" collect o) delete $

if choice 2 is pressed do :

select Parent of the children are exist and delete them.

like this : http://img15.hostingpics.net/pics/142816parentofchildren.png

if cancel is pressed :

stop the script