Problems assigning default values to variables in a function
This is my first post, so I honestly apologize if I'm doing something wrong...
I'm new at MAXscript and I've got a little problem trying to assign default values to variables in a user function. Let's just take the example MAXscript help provides:
function sign val:0 = ( if val == 0 then messagebox ("Equal to 0") else if val > 0 then messagebox ("Greater than 0") else messagebox ("Less than 0") )
Simple enough... opening a New Script window, copying/pasting it there, evaluating it and checking for the results at the listener is says "sign()... OK"
But if I try to use this function typing, for instance
the answer is:
-- Argument count error: sign wanted 0, got 1
if I remove the syntax for the suposedly default value on the first line, like that:
function sign val = ( if val == 0 then messagebox ("Equal to 0") else if val > 0 then messagebox ("Greater than 0") else messagebox ("Less than 0") )
it now works fine if I say "sign(-5)", but inputing a value is now mandatory and if I type only the function without providing values for the parameters, it gives an error message like
sign() -- Argument count error: sign wanted 1, got 0
It seems that if I do provide a "default" value to the function variable doesn't get it anymore. I suspect that my mistake is evident but it scapes me.
And, by the way, I also strongly suspect that this question is faaar too "newb" to be here, is there a more appropriate place for people who's just starting on MAXscript?
Thank you very much!