Ricardo Eloy Posted November 5, 2012 Share Posted November 5, 2012 Hey, folks! I'm modifyng an existing script as an exercise for my students (that's why there's a lot of commented lines in portuguese) and, all of a sudden, the macroscript simply doesn't work. I get an error telling me I can't have nested macroscripts (which I don't). It seems to not recognize the name of the macro. Here's the full script (original script by Louis Marcoux). macroscript Queda category:"Perspectiva PRO" ( rollout VisibilityRotate "Montagem" ( spinner SPN_StartFrame "Início" range:[0,1000,0] type:#integer spinner SPN_EndFrame "Fim" range:[0,1000,100] type:#integer button BTN_CreateAnimation "Criar Animação" on BTN_CreateAnimation pressed do ( StartFrame = SPN_StartFrame EndFrame = PN_EndFrame -- Em seguida, inserimos outra variável para dar o tamanho da animação de cada elemento que forma o prédio em frames AnimaSegm = 5.0 -- A linha a seguir define a diferença entre o início de cada animação, de forma que cada elemento se mova separadamente no tempo, um após o outro OffsetAnimation = ((EndFrame-AnimaSegm) - StartFrame)/selection.count FrameAtual = StartFrame for a in selection do ( with animate on ( -- a linha a seguir garante que a posição final do objeto será a posição original dele, ou seja, com o prédio montado. A de baixo garante rotação zero at time (FrameAtual + 5.0) a.pos.z = a.pos.z at time (FrameAtual + 5.0) in coordsys local a.rotation.y = 0.0 -- a linha a seguir coloca os objetos muito altos (500 cm) de forma que eles caiam do céu rodando 20 graus at time FrameAtual a.pos.z = a.pos.z + 500.0 at time FrameAtual in coordsys local a.rotation.y = degtorad(-20.0) -- a linha a seguir elimina um keyframe defeituoso que seria o primeiro, assim a animação já começa com todo mundo a 5m do chão ao invés de o prédio começar montado at time 0 a.pos.z = a.pos.z + 500.0 ) ) ) -- animar o objeto selecionado FrameAtual = FrameAtual + OffsetAnimation ) ) Any ideas? Link to comment Share on other sites More sharing options...
Peter M. Gruhn Posted November 11, 2012 Share Posted November 11, 2012 Presume you've solved or moved on by now, but... OK, I get a different error than you. I'm getting "expected name" at the last line. And that looks to be a scope thing. FrameAtual is defined inside a couple of parens from here. Trying to understand what you are doing (I don't know maxscript very well at all). With that last line it looks like I'm supposed to be looking at a while loop but I can't find the "while FrameAtual And there's a rollout, but there's no "make the rollout". I think you need: EndFrame = PN_EndFrame.value to grab the value off the controls. Yay, infinite loop! Wait, what, I have to kill the max process? Weak. AND I lost my edits. Thanks python for luring me into a false sense of security. OK, this does something. I don't know if it does what you want... but it doesn't break. macroscript Queda category:"Perspectiva PRO" ( dlgMain = newRolloutFloater "Main Dialog" 150 200 rollout VisibilityRotate "Montagem" ( spinner SPN_StartFrame "Início" range:[0,1000,0] type:#integer spinner SPN_EndFrame "Fim" range:[0,1000,100] type:#integer button BTN_CreateAnimation "Criar Animação" on BTN_CreateAnimation pressed do ( StartFrame = SPN_StartFrame.value EndFrame = SPN_EndFrame.value -- Em seguida, inserimos outra variável para dar o tamanho da animação de cada elemento que forma o prédio em frames AnimaSegm = 5.0 -- A linha a seguir define a diferença entre o início de cada animação, de forma que cada elemento se mova separadamente no tempo, um após o outro OffsetAnimation = ((EndFrame-AnimaSegm) - StartFrame)/selection.count print OffsetAnimation FrameAtual = StartFrame i = 0 for a in selection do ( while (FrameAtual with animate on ( -- a linha a seguir garante que a posição final do objeto será a posição original dele, ou seja, com o prédio montado. A de baixo garante rotação zero at time (FrameAtual + 5.0) a.pos.z = a.pos.z at time (FrameAtual + 5.0) in coordsys local a.rotation.y = 0.0 -- a linha a seguir coloca os objetos muito altos (500 cm) de forma que eles caiam do céu rodando 20 graus at time FrameAtual a.pos.z = a.pos.z + 500.0 at time FrameAtual in coordsys local a.rotation.y = degtorad(-20.0) -- a linha a seguir elimina um keyframe defeituoso que seria o primeiro, assim a animação já começa com todo mundo a 5m do chão ao invés de o prédio começar montado at time 0 a.pos.z = a.pos.z + 500.0 -- animar o objeto selecionado FrameAtual = FrameAtual + OffsetAnimation i = i + 1 ) ) ) ) addrollout VisibilityRotate dlgMain ) Link to comment Share on other sites More sharing options...
Peter M. Gruhn Posted November 11, 2012 Share Posted November 11, 2012 Oh yeah, the i Link to comment Share on other sites More sharing options...
Ricardo Eloy Posted November 12, 2012 Author Share Posted November 12, 2012 Thanks for taking the time, Peter! The funny thing here is that the script actually works fine WITHOUT the macroscript instruction. If you comment the macroscript lines (and the rollout ones aswell) it runs without a problem. One other thing that seems recurrent is that I often get an error saying that it does not recognize anything on line one AFTER the first letter of the script's name (i.e., it reads macroscript Q and stops). I'm guessing there might be some differences between MaxScript 2008 and 2012, but I can't find any. Once again, thank you for taking the time. ;-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now