ScriptSpot

Forum topic · General Scripting

SetSelectFilter shortcut or script

By mr_mook · 2013-01-04

Description

Hi i'm new in max scripting, and i need help

i trying to make a shortcut to set selected filter,
so i decided to create a dropdown menu to choose from so i wrote

rollout FilterSelect "Select" width:99 height:54
(
dropdownList FilterSelect "Filter Select"
items:#("All","Geometry","Shapes","Light","Camera","Helpers","Warps","Bones")
on FilterSelect selected i do
(
local f = FilterSelect.count[i]
SetSelectFilter f
)
)
createdialog FilterSelect

i know its totally wrong alla i want to do is to make a variable from the index number of the array ...and choose the filter number from it

is there a better way to do it.. or if its wright can some please help me with the syntax

Comments (2)

is this?

Anubis · 2013-01-04

rollout roFilterSelect "Select"
(
	dropdownList ddlFilterSelect "Filter Select" \
	items:#("All", "Geometry", "Shapes", "Light", \
	"Camera", "Helpers", "Warps", "Bones")
	
	on ddlFilterSelect selected i do
	(SetSelectFilter i)
)
createDialog roFilterSelect 99 54

Note - I see you use the same name (FilterSelect) for the Rollout name and for the DropdownList, and I rename them to roFilterSelect for the rollout and ddlFilterSelect for the DropdownList.

thanks alot :)

mr_mook · 2013-01-06

thanks a lot for replying i thought no one will :)
I've changed it to

rollout FilterSelect "Select"
(
dropdownList FilterSelect "Filter Select" items:#("All","Geometry","Shapes","Light","Camera","Helpers","Warps","Bones")
on FilterSelect selected i do
(
format "You selected '%'!\n" FilterSelect.items[i]
SetSelectFilter i
)
)
createdialog FilterSelect

and it worked :)
i will compare the 2 scripts so i can understand how maxscript thinks
i know what you mean about naming the variables as its function... i will change this bad habit :)
thanks again man ;)