Functions can actually have 255 variables passed to them.
Function MyFunction(a1,a2,a3,a4,...,a255)
b1=a1+a2
b2=a2+a3
b3=a3+a4+a5+a6+a7+a8
returnvalue=b1*b2*b3/a254
EndFunction returnvalue
Of course why you need 255 variables passed to the function is beyond me.
As far as what kind of variables a function can manipulate, functions can utilize: passed variables (non-global), global variables and local variables.
Global toon_x
Global toon_y
DO
movetoon(toon_x,toon_y) `assume this a function not listed below
monster_x=object position x(mob1)
monster_y=object position y(mob2)
distance=myFunction(monster_x,monster_y)
Sync
Loop
Function myFunction(x,y)
` x and y are the passed variables monster_x and monster_y
` toon_x and toon_y are global variables
` distance_x, distance_y and distance_from are local variables
` distance_from is returned by the function
distance_x=toon_x-x
distance_y=toon_y-y
distance_from=distance_x+distance_y
EndFunction distance_from
Functions can have parameters passed to them or not. Depends on your needs.
I usually write functions for things that I can see I will need/can use in more than one project and then #Include that as my FUNCTIONS_LIB. I can call any, all or none of my custom functions as needed and I dont have to worry about have I written that yet.
Normally I have two function libraries in each project. A Generic one that I add to over time as I use the functions in more and more projects and a project specific one that is used only in that project and I did not want to use GoSubs or needed parameters passed.
Hope this helps your understanding.
Slyvnr
Slyvnr