Game Development Community

i am freaking out of this engine !!!

by ken · in iTorque 2D · 05/15/2012 (4:31 am) · 5 replies

i write this function
function resetvariable()
{
echo("aaaaaaaaaaaaaahhhhH");
$game::timeX = 1;
}
and run my app on xcode ios simulator and take the result
then i change it to
function resetvariable()
{
echo("BBBBBaaaaaaaahhhhH");
$game::timeX = 0.1;
}
then "BBBBBaaaaaaaahhhhH" print in output but $game::timeX didn't change,
until i run iTorque2DGame app out of xcode,

WHAT IS THIS !?

#1
05/15/2012 (6:59 am)
The problem is due to an old DSO. When you write a script (.cs), then run the game on a desktop, it is compiled down to a .dso file. When you run the game a second time, the DSO with the old code will be loaded instead of the .cs. If you make a change to the code, you need to delete the DSO file.
#2
05/15/2012 (8:46 am)
as you see,
1- i said the output of echo has been change, but the variable remain unchanged, if it is related to dso files this never happen
2- i do delete dso files !!!!
#3
05/15/2012 (9:25 am)
OH! I see it now. It's because you are using the $game:: namespace. If you open scripts/system/properties.cs, then scroll down to _saveGameConfigurationData, you will see that all variables stored in $Game:: are exported:

export("$Game::*", "./prefs.cs", true, false);

So whatever you had for $game::timeX is saved out to prefs.cs, which is executed every time you run the game. Change $game:: to something like $myGame::.
#4
05/15/2012 (10:27 am)
oh, yeah,
thanks Michael !
#5
05/15/2012 (1:35 pm)
You're welcome.