FishDemo problem
by Mike Wright · in Torque Game Builder · 05/19/2006 (9:44 pm) · 10 replies
Hi, I just started with the FishDemo and I have a problem. When I add....
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocityX(40);
}
to the game.cs file, it does not reflect the changes in the Level Builer when I press PLAY. I have saved the game.cs file and I have saved the MyFishDemo in the Level Builder. If I close down the Level Builder and then restart it, the changes made in the game.cs file take affect. However, if I make any new changes, such as increase the velocity to 60, I have to quit the Level Builder and restart for changes to take affect. Any ideas on what I am doing wrong? This is the first toturial I have tried.
Thx
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocityX(40);
}
to the game.cs file, it does not reflect the changes in the Level Builer when I press PLAY. I have saved the game.cs file and I have saved the MyFishDemo in the Level Builder. If I close down the Level Builder and then restart it, the changes made in the game.cs file take affect. However, if I make any new changes, such as increase the velocity to 60, I have to quit the Level Builder and restart for changes to take affect. Any ideas on what I am doing wrong? This is the first toturial I have tried.
Thx
#2
05/22/2006 (6:21 am)
OK . Thx for the help. Atleast I know I'm not going insane now.
#3
05/28/2006 (1:36 pm)
Is there a fix planned for future releases so that restarting the level editor every time a script changes won't be required?
#4
There was a thread about this in the suggestions forum not too long ago. The answer there was:
05/28/2006 (2:24 pm)
Greg,There was a thread about this in the suggestions forum not too long ago. The answer there was:
Quote:I wouldn't take that as an absolute yes either, but something they will look into. In the meantime, if you really want to: putting exec() statements to custom script files inside the startGame function will recompile them when you press the play button. But as usual, do it at your own risk.
However, we won't be able to get all of these issues cleared out before release. For example, reloading scripts at run-time in a guaranteed safe and well-behaved manner is a deep architectural issue with the Torque application core itself, and we won't have time to do a pass on this before our official release. Likewise for some of the platform issues you brought up.
#5
It's no fun being confused on the first tutorial, especially when adding 2 lines of script to a file you know is being run.
06/12/2006 (5:44 pm)
There really should be a change to the tutorial until this is fixed. The FishDemo tutorial (the very first one!) makes it seem as though the change should be visible immediately in TGB. Later scripting examples (like getting the fish to swim back and forth) note that you have to restart TGB.It's no fun being confused on the first tutorial, especially when adding 2 lines of script to a file you know is being run.
#6
06/12/2006 (5:55 pm)
I assume you mean part 4, since part 1-3 you don't script... but the tutorials have been updated with multiple fixes... also the engine now should recompile your game scripts (at least all those exec'd in the startGame() function) when you press play :)
#7
Or perhaps I'm still confused. Should I be exec'ing the game.cs file in the startGame function? That seems kinda loopy (in an infinite sort of way). I'm only referring to the FishDemo (so I don't have any other script files to exec).
Thanks for the insta-help.
06/12/2006 (6:25 pm)
I remember reading a .plan about that and so restarting TGB was the last thing I tried when my poor little fish wouldn't swim to the right after following Part 4. It didn't move until I restarted though. I bought and downloaded TGB last night - so I should have the latest goods.Or perhaps I'm still confused. Should I be exec'ing the game.cs file in the startGame function? That seems kinda loopy (in an infinite sort of way). I'm only referring to the FishDemo (so I don't have any other script files to exec).
Thanks for the insta-help.
#8
06/12/2006 (8:28 pm)
Same problem here.. with RC2 I'm still not getting scripts recompiled when hitting play from within TGB. Maybe that feature didn't make it into the release?
#9
06/13/2006 (9:34 am)
I always give it a shot by hitting play, it only takes my changes into account 80% of the time. Those odd times it's not working, I check the console for errors - if none are found, restart TGB and it usually works fine.
#10
06/13/2006 (10:19 am)
In our upcoming release there should be a solution to that problem :) Where it will always re-compile any scripts exec'd in your game.cs (including the startGame() function)
Torque 3D Owner Matthew Langley
Torque