Thanks for your help sky, I managed to get around it now.
I'll now tell what solved the problem, because this may be useful for someone else, too.
So, I had two different scripts in global code, and they both called functions from each other, like this:
(This is very simplified example)
- Code: Select all
SCRIPT 1
void myFunction()
{
otherFunction();
}
- Code: Select all
SCRIPT 2
void otherFunction()
{
myFunction();
}
And GE had problems with that how one script calls function from other scirpt that again calls function from the first script.
The problems didn't show up in GE's Game Mode, but when exported, the code did nothing.
So here's how to fix it.
Combine the two scripts as one.
BUT here you will run into this problem:
GE doesn't let you call a function in other function if the one calling it is on top of the function to call.So, this doesn't work:
- Code: Select all
void myFunction()
{
otherFunction();
}
void otherFunction()
{
//do something
}
It doesn't work because the function otherFunction() doesn't exist when function myFunction() is defined.
Ok, what you can do is swap the functions places, like this:
- Code: Select all
void otherFunction()
{
//do something
}
void myFunction()
{
otherFunction();
}
And this works, because now the function otherFunction() is already defined when defining the function myFunction().
That's logical.
BUT when the both functions refer to each other, you can't do this because always other one is before other one and can't call the other because of that.
Happily, I found a fix for that!
What you have to do is to write the name of the second function to the top of the script, after variable declarations.
Like this:
- Code: Select all
void otherFunction(); //you don't need to put the input variables there, only the type of the function and it's name are enough
void myFunction()
{
otherFunction(3);
}
void otherFunction(int myInt)
{
myFunction();
}
And now GE knows that there is function called otherFunction() in the script and myFunction() can call it! =D
I hope this was understandable and helpful!