I'm relatively new to DarkBasic Professional, but I do have a bit of experience in C++, so learning this language is pretty easy. One thing I'm having trouble with, however, is making a user defined function that can use reference variables instead of local variables.
Here's the C++ version of what I'm trying to do (It's a little sloppy and may contain some sytanx errors since I've been focusing more on DBPro lately, but here's the gist of it):
void setpos(int n,double& x,double& y,double& z) {
x=object position x(n);
y=object position y(n);
z=object position z(n);
};
Here's what I have in DBPro
function setpos(n,x#,y#,z#)
x#=object position x(n)
y#=object position y(n)
z#=object position z(n)
endfunction
Basically, I'm going to position bullets to the end of a gun and have them come out like that. They used to work without the user defined function, but for the sake of practice and organization, I'm trying to cut down my code a bit and make a function that will set these 3 variables. When I tried the user defined function, it seemed to stop working properly. It's possible I accidentally changed something else, but I'm relatively sure this is the problem.
Is there any way to make this user defined function work in DBPro?