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


Featured Threads
  Speedmodeling 2011 - Holidays Edition
(117 replies)
  Maxforums Kiva Group
(57 replies)
  The Life of a Sea Turtle - Tutorial by mrgrotey
(121 replies)
  So what are you working on? =)
(2627 replies)
  Want free webspace?
(20 replies)
  spam alert!!!
(3920 replies)
  Maxforums member photo gallery index
(113 replies)
  Maxforums Member Tutorials
(86 replies)
  three cheers to maxforums...
(185 replies)
  The Grotorial Index Page
(57 replies)
  101 Things you didnt know in Max...
(185 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Free textures thread
(77 replies)
  Maxforums.org Members Gallery
(486 replies)
  SON OF POST YOURSELF
(626 replies)
  Dub's Maxscript Tutorial Index
(119 replies)
  The Best Art of Maxforums [56k warning]
(109 replies)


 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
Very introductory Maxscript tutorial 5
show user profile  dracayr
hi,
I get that error too.
I even get it if I try this script:
MacroScript Random_Rotate category:"Rhys Tools" buttonText:"Random Rotate" tooltip:"Random Rotate"
(
for obj in $ do
(
if(selection.count >0)then
(
messagebox "objects are selected"
)
else
(
messagebox "no objects are selected"
)
)
)
read 2051 times
1/6/2008 12:14:58 PM (last edit: 1/6/2008 12:14:58 PM)
show user profile  Dub.
that script works fine for me...

what seems to be the problem?


read 2038 times
1/6/2008 2:38:27 PM (last edit: 1/6/2008 2:38:27 PM)
show user profile  SgtSKU
first, great tut dub! i really learned alot here...
but the last script wouldnt work...
if i executed it from maxscript it worked fine...
but when i executed it from the menu (the Rhys Tools) it didnt... no "map" function for undefined..
it may be some things i have messed up i dont no...
thanks for the tut anyway :p

read 2000 times
1/13/2008 11:48:34 AM (last edit: 1/13/2008 11:48:34 AM)
show user profile  Dub.
Oops! Many apologies, I put you wrong there.

There was actually a logic error in the code.
If you look at your code carefully, you'll notice that you are launching into the loop which loops though the objects selected BEFORE you check if any are actually selected. so if there are none selected, the program tries to loop through the selection which doesn't exist and thus crashes.

Here is the correct way to do it.

MacroScript Random_Rotate category:"Rhys Tools" buttonText:"Random Rotate" tooltip:"Random Rotate"
(
if(selection.count >0)then
(
for obj in selection do
(
messagebox "objects are selected"
)
)
else
(
messagebox "no objects are selected"
)
)

Rhys.


read 1986 times
1/13/2008 1:34:35 PM (last edit: 1/13/2008 1:34:35 PM)
show user profile  SgtSKU
em... so the full kode will be? :p
read 1982 times
1/13/2008 1:47:54 PM (last edit: 1/13/2008 1:47:54 PM)
show user profile  Dub.
rollout RandomRotateRollout "Random Rotate" width:162 height:149
(
groupBox grp1 "Random Rotation Range" pos:[10,12] width:142 height:99
button btn1 "Exicute Rotate!" pos:[19,81] width:125 height:22
spinner spn1 "Minimum " pos:[22,34] width:122 height:16 range:[-360.0,360.0,0.0]
spinner spn2 "Maximum" pos:[22,56] width:122 height:16 range:[-360.0,360.0,0.0]

on btn1 pressed do
(
if(selection.count > 0)then
(
for obj in selection do
(
randXrot = random spn1.value spn2.value
randYrot = random spn1.value spn2.value
randZrot = random spn1.value spn2.value
rot_obj = eulerangles randXrot randYrot randZrot
rotate obj rot_obj
)
)
else
(
messagebox "You must have at least one object selected!"
)
)
)
createDialog RandomRotateRollout 162 166


read 1975 times
1/13/2008 2:10:34 PM (last edit: 1/13/2008 2:10:34 PM)
show user profile  urgaffel
"Exicute"? :P


All I remember was shaving... then *BLAM*

Environment art/gamesindustry blog thing
read 1957 times
1/14/2008 3:02:35 AM (last edit: 1/14/2008 3:02:35 AM)
show user profile  Dub.
Technical term....

you wouldn't understand Urg....


read 1953 times
1/14/2008 3:28:12 AM (last edit: 1/14/2008 3:28:12 AM)
 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
#Maxforums IRC
Open chat window


Support Maxforums.org