So I was able to assign a material slot to a selected mesh by a simple button press but now I want to be able to define the material slot number in the edit text field then be able to press the button and that material slot would be used.
I just cant seem to figure out how to mesh the information from the text box to the button click. Here is what i have so far
on btn4 pressed do
(selection.material = meditmaterials[1])
and my edit text box is called "edt4" can anyone tell me what I should write to make it so the number in my edit text box is used in place of the default map slot 1 right now?
I was experimenting with <edt4>.text but didnt know if that was the right direction or where to implement it. ( This is my first time diving in to max script in any fashion lol so please mind my complete lack of knowledge lol)
![Problem.jpg](http://dl.dropbox.com/u/14504518/Problem.jpg)
Replies
so say your text is '100'
x = "100" as integer
returns: 100
now say you slip up and add some text to the field, in this case a space
x="100 " as integer
returns: undefined
your script will now crash.
Use a spinner instead, and explicitly set it to integer.
spinner spn_myMatID "Material Assign" range:[1,100,1] type:#integer
then you say
or even better in this case the event looks for a variable, in this case 'arg' it uses this to store the current value of the spinner. its just a handy shortcut, arg can be any valid variable name