Functions

Blitz3D Forums/Blitz3D Beginners Area/Functions

Hey, don't think this really belongs anywhere else. See when i'm calling a function, is there anyway i can only provide say the first 3 parameters?

eg.

create_emittor( 10,10,10, 1, 3, 5, 0, 0, 0, 6, 10, 100, 400

Function create_emittor( x, y, z, part_type, rotx, roty, rotz, speed, par_rot, life, distance)

...
...

End Function


But just do:

create_emittor(10,10,10,1)


without having to type all the extra zero's in? It would make my code soooo much cleaner and easier to read for the guy i'm working with.

Function create_emittor( x, y, z, part_type, rotx=0, roty=0, rotz=0, speed=0, par_rot=0, life=0, distance=0)

...
...

End Function


Means i'll need to use a different function for that. Ok, thanks!

i don't think you need to use a different function ....
if you declare your function like Perturbatio said then
that means that if you don't supply the parameter
then it will default to 0. If you do supply the parameter
it will override the default value.
(the default value doesn't have to be zero btw !)

Oh right, i get it now :D Cool, thanks, will do me brilliant, yeah!!