help please - creating a opacity map

Hi all,

I am new to max and I am trying to do a script to add transparency and reflection maps to a material. I have worked out the code to get the scene materials list , and go through it to find the materials by name , and I have the material and map references. If the map is undefined I cant work out how to create it .

I am not finding the maxscript help to be easy to read either :(

mats= for m in sceneMaterials collect m
for m in mats do
a = getNumSubMtls(m)
if a >0 do
mymatlist = m.materialList
This bit finds the material I want, only one in the scene

then I do

for b in mymatlist do
n =
if n == q[1] do
if q[2] == " t " do -- transparency map
map = b.opacityMap
if map == undefined do
myBmp = bitmaptexture filename:q[3] << added this
b.opacityMap = myBmp << and this
b.opacityMapEnable = true
b.opacityMapAmount = 0
map.filename = q[3] << removed this
print "Done"

q is an array of the material name , a code to say diffuse, reflection etc
and the file name of the image map

Can anyone help with creating the map ? greatly appreciated

Any suggestions on materials to learn maxscript quickly ?


UPDATE: I have a solution working with the changes indicated