Game Development Community

Odd scripting behaviour

by Keegan Gibson · in iTorque 2D · 09/28/2010 (12:29 am) · 1 replies

Hey all, I have a problem with my code.
When I call a function three times in a row, the first time works great, but
the other times %getsSetToNull is set to null(or ""). it ONLY happens with
%getsSetToNull, the other arguments are fine. Any reason why this is
happening?

Testing on WinXP.

function OtherFunction()
{
%e = GETSOMETHING()
SomeFunc(%e, 2, 4, true);
SomeFunc(%e, 3, 4, true);
SomeFunc(%e, 1, 2, false);
}

function SomeFunc(%e, %f, %getsSetToNull, %keepOn)
{
echo(%getsSetToNull);
//%getsSetToNull is null the second+ times
//Do stuff
}

Output:
%4
%
%

#1
09/29/2010 (11:33 pm)
Try adding the missing semi-colon after:

%e = GETSOMETHING(); // <-- semi-colon missing at end of statement

Right now, your code is setting %e to:

%e = GETSOMETHING()SomeFunc(%e, 2, 4, true);