View Full Version : loop problem
06-17-2003, 02:33 PM
Ok I've finally put my toe in the water of max script.. all was eventually sinking in sort of till I got to the section on loops. I know I'm probably making an obvious error but I can't find a way of understanding why this is failing.. it is straight from the help file.
Going from the 'learning maxscript'
deleted everthing done so far and entered
mybox = box()
which of course made a default box at 0,0,0
this was merely to try and fully understand the command:
for i = 1 to 5 do
box_copy = copy mybox
box_copy.pos = [i * 50, 0, 0]
which in theory creates 4 copies of the box.. but the listener returns:
-- Syntax error: at ), expected <factor>
-- In line: )
Help in clearing this mental block greatly appreciated. :)
06-17-2003, 02:43 PM
If you are evaluating more than one line in the listener, you cannot push enter. Enter only evaluates the current line. You have to highlight the code block and then push SHIFT+ENTER.
06-17-2003, 03:10 PM
Hey xynaria, glad to see you're finally jumping into the fray! I don't see what was causing the error in your code, but here's a condensed way to do the same thing:
my_box = box()
for i = 1 to 5 do copy my_box pos:[i * 50,0,0]
06-17-2003, 03:31 PM
Reality 3D .. thanks that was it...once you said that my mind triggered back to an earlier segment... I'd forgotten shift cos I'd already tried highlight and enter and the code seemed feasible. :)
LF SHade.. LOL It's something I'd always meant to do but time is hard to find. I realised that getting any further with certain rigging ideas wouldn't be harmed if I had a go. I'll be honest I'm not finding it easy because the way most TY code/script are written appears more to be understandable to people who either know some scripting/ coding rather than dimmies like me who tend to only be able to find a way in by getting a grasp of the syntax.. if that makes sense.. I even struggled with HTML at first then as soon as undertood the 'grammar' of tag.... I couldn't see any difficulty at all.. so I'm hoping that once the basic concepts start to gel it'll become workable for me. Thanks for the example. :)
01-15-2006, 11:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.