Script problem

A simple script to rattle through the material editor and copy the diffuse map to the bump map. Script with errors below. Any help would be appreciated.

for i = 1 to 24 do (
for t = 1 to meditMaterials[i].materialList.count do (
meditMaterials[i].materialList[t].bumpMap = meditMaterials[i].materialList[t].diffuseMap
)
)
-- Syntax error: at ), expected
-- In line: )

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
real08121985's picture

Cause the listener

Cause the listener interprets your code each time you hit return.

-- So this works:
 
for i=1 to 3 do ( print i )
 
-- But this not:
 
for i=1 to 3 do (
	do print i
)
real08121985's picture

Your code works for me, I

Your code works for me, I only added a check if the material is a multimaterial.

for i = 1 to 24 do (
	local MultiMatCount = undefined
	try MultiMatCount = meditMaterials[i].materialList.count catch()
	if MultiMatCount != undefined do (
		for t = 1 to MultiMatCount do (
			meditMaterials[i].materialList[t].bumpMap = meditMaterials[i].materialList[t].diffuseMap
		)
	)
)

Note that you should send your code within code-tags for better formatting (look at the lower end of http://scriptspot.com/filter/tips).

lunar1369's picture

Yoodaman! How come it throws

Yoodaman! How come it throws errors in the listner but not when you run the script through "Run Script"?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.