Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Lil' code troubleshooting
show user profile  jpedleham
Hi, ive pieced together some code from online and in the listener to automate some simple stuff but its throwing an error;

'type error array index must be positive got: got: undefined'


Can anyone else see why it might be doing this?


newmod = uvwmap()
newmod.maptype = 4
for obj in $ do addmodifier obj (copy newmod)
$.modifiers[#UVW_Map].maptype = 4
$.modifiers[#UVW_Map].length = 600
$.modifiers[#UVW_Map].width = 600
$.modifiers[#UVW_Map].height = 600

--create material & assign bitmap

newmat = StandardMaterial()
mybmp = bitmaptexture filename:"X:\Projects\Categories\Graphics\PFS Tiling\JP_Bakery_Tiles.jpg"
newmat.name = ("MAT_" + i as string)
newmat.diffusemap = myBmp
selection[i].material = newmat





Thanks
Jack
read 801 times
9/9/2015 1:47:07 PM (last edit: 9/9/2015 1:49:35 PM)
show user profile  ScotlandDave
I don't know maxscript but it's probably referring to 'i' ( specifically where it says 'selection[i]' ), because 'i' isn't defined anywhere..


Website | Blog | Contact | Vimeo

read 791 times
9/9/2015 3:37:18 PM (last edit: 9/9/2015 3:37:18 PM)
show user profile  Garp
Looks like Dave nailed it :)

This should do what you want (I think):

myBmp = bitmapTexture filename:"X:/Projects/Categories/Graphics/PFS Tiling/JP_Bakery_Tiles.jpg"
for i = 1 to selection.count do (
addModifier selection[i] (uvwMap mapType:4 length:600 width:600 height:600)
selection[i].material = standardMaterial name:("MAT_" + i as string) diffuseMap:myBmp
)






read 786 times
9/9/2015 4:33:48 PM (last edit: 9/9/2015 4:33:48 PM)
show user profile  jpedleham
Thanks guys, i noticed that literally 30 seconds after posting this thread haha, that uvw snipped it great thanks garp obviously mine is straight from the listener :D
read 759 times
9/9/2015 11:02:26 PM (last edit: 9/9/2015 11:02:26 PM)
show user profile  ScotlandDave
I need to start getting familiar with Maxscript soon, i've had a quick look over Nik and a bit of Dubs tutorials, looking forward to getting started :)



Website | Blog | Contact | Vimeo

read 752 times
9/10/2015 1:07:30 AM (last edit: 9/10/2015 1:07:30 AM)
show user profile  Garp
This is the best place to start, imo.




read 738 times
9/10/2015 7:12:04 AM (last edit: 9/10/2015 7:12:04 AM)
show user profile  ScotlandDave
Thanks Garp. Damn i hate video tutorials though. What happened to good old fashioned text with diagrams and examples.. So much quicker and easier to scan through and pick out what you need.


Website | Blog | Contact | Vimeo

read 732 times
9/10/2015 10:27:05 AM (last edit: 9/10/2015 10:27:05 AM)
show user profile  Garp
That'd be the doc then ;)




read 730 times
9/10/2015 11:40:51 AM (last edit: 9/10/2015 11:40:51 AM)
show user profile  Dub.
My tutorials are a bit shit these days.

I didn't know a heck of a lot when I wrote them.


read 639 times
9/22/2015 5:22:31 AM (last edit: 9/22/2015 5:22:31 AM)
#Maxforums IRC
Open chat window


Support Maxforums.org