The return value is easy to understand, but confusing to explain.
Take a command like
OBJECT POSITION Z(obj)
We know that this is not the correct syntax, you must say that something is equal to OBJECT POSITION Z(obj)
CoolObjectZPos=OBJECT POSITION Z(obj)
Whatever value is stored into CoolObjectZPos is the return value. Here is an example of a function.
FUNCTION One_Plus_One()
answer=1+1
ENDFUNCTION answer
If we typed:
AdditionAnswer=One_Plus_One()
PRINT AdditionAnswer
The text "2" would appear on screen. Exitfunction works the same way, except it allows you to break out of a function early and include a return value. There are just a few rules of functions.
1. Anything that is not a GLOBAL variable or Array must be passed to the function.
2. Variables created within the function are deleted after the function is finished running.
3.The syntax:
FUNCTION Function_Name(any parameters to pass in here)
`commands
ENDFUNCTION ReturnAValueIfYouWant
4. All parameters you pass to the function must be the same as the ones you defined in the function declaration.
If you create
FUNCTION MyFunc(integer, string$, integer)
`stuf
ENDFUNCTION
Then you must always call it with
MyFunc(An_Integer, A_String$, Another_Integer)
You don't need those names, just the types need to be the same.
I doubt all of this is comprehendable, if you need clarification on any of it, just type a reply.
Crazy Donuts
Crazy Donut Productions
Current Project: KillZone