Notifications
Clear all

[Closed] simple dropdownlist help needed

Hey all

I’m just getting started with maxscript, and a lot of my knowledge comes from testing, experimenting, and looking at what works for other scripts. but now im totally stuck on how to get a dropdown to control a function.

im working in real simple terms here, so please bare with me!

i want a script that will create an object, depending on what is selected from the dropdown, when the button is pressed.

so far i have …

 

(
 
rollout test1 "Object Creator" width:162 height:300
(
 dropdownList objType "SelectViewType" pos:[20,68] width:119 height:40 items:#("box", "cylinder", "sphere") selection:1
 
 button btn1 "Create Object" pos:[28,157] width:109 height:45
 on btn1 pressed do
 (
  if objType = "box" do box()
  if objType = "sphere" do sphere()
  if objType = "cylinder" do cylinder()
  )
)
createdialog test1
)
 

I can see that it wont work, but just need a gentle nudge in the right direction. Can anyone shed some light please?

Thanks, Dean

2 Replies
  1. you’re using the assignment operator (a single equals sign, =) instead of the comparison operator (double equals sign, ==).
  2. use the ‘selection’ or ‘selected’ property of the dropdownlist to check which item is selected:
if (objType.selected == "box") do box();

thanks for your quick reply! that works! (not that I doubted you!)