Script not updating, help needed
by Mark Chapman · in Torque Game Builder · 12/27/2007 (4:56 pm) · 9 replies
Okay, two problems. The first is that I can't seem to access the console, I've tried pressing ~ and ctrl+~ at just about every screen in the program but it doesn't seem to be producing any effect. The second is that my script changes no longer seem to be having any effect at all on the way levels run, I've tried making changes to variables, switching keybindings and even just deleting chunks of code but the playthrough still always runs exactly the same. The only thing I've tried that actually seems to change anything is deleting the game.cs.dso file, which makes it crash, copying across the .DSO from a different project makes it run again but using the script from that project rather than my current one. It looks like TGB isn't compiling my script properly (or at all). I've tried restarting it, restarting the computer and reinstalling it but I keep getting the same problem. It seemed to be working fine up until this started and I can't think of anything that's changed that might have triggered it. Anybody got any ideas what might be going on and how I might be able to fix it?
#2
C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs Line: 110 - parse error
>>> Advanced script error report. Line 110.
>>> Some error context, with ## on sides of error halt:
12/27/2007 (6:20 pm)
Thanks for the tip, hadn't realised I could get all the information there. It says that there's a parse error on line 110, but I've already cut all my code back to line 67.C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs Line: 110 - parse error
>>> Advanced script error report. Line 110.
>>> Some error context, with ## on sides of error halt:
#3
12/27/2007 (6:35 pm)
Post the whole thing and we can fix it together. I need to go to the gym soon, so you may have to wait until tomorrow. From the sound of it, it's probably just some little syntax matter.
#4
//---------------------------------------------------------------------------------------------
// Torque Game Builder
// Copyright (C) GarageGames.com, Inc.
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
// startGame
// All game logic should be set up here. This will be called by the level builder when you
// select "Run Game" or by the startup process of your game to load the first level.
//---------------------------------------------------------------------------------------------
function startGame(%level)
{
exec("./player.cs");
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
new ActionMap(moveMap);
moveMap.push();
$enableDirectInput = true;
activateDirectInput();
enableJoystick();
sceneWindow2D.loadLevel(%level);
}
//---------------------------------------------------------------------------------------------
// endGame
// Game cleanup should be done here.
//---------------------------------------------------------------------------------------------
function endGame()
{
sceneWindow2D.endLevel();
moveMap.pop();
moveMap.delete();
}
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setSpeed();
%this.setLinearVelocityX(%this.speed);
}
function FishClass::onWorldLimit(%this, %mode, %limit)
{
%this.setSpeed();
switch$ (%limit)
{
case "left":
%this.setLinearVelocityX(500);
%this.setFlipX(false);
%this.setPositionY(getRandom(-35, 25));
case "right":
%this.setLinearVelocityX(500);
%this.setFlipX(true);
%this.setPositionY(getRandom(-35, 25));
}
}
function FishClass::setSpeed(%this)
{
%this.speed = getRandom(%this.minSpeed, %this.maxSpeed);
}
The error message I'm getting is
Torque Game Builder (v1.6) initialized...
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/resources/fishArt/resourceDatabase.cs.
% Game Resources : Loaded Resource fishArt
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/datablocks.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/persistent.cs.
Compiling C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/brushes.cs...
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/brushes.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/datablocks.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/guiProfiles.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gui/mainScreen.gui.
Compiling C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs...
C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs Line: 110 - parse error
>>> Advanced script error report. Line 110.
>>> Some error context, with ## on sides of error halt:
$FishPlayer.setLinearVelocityX( -$FishPlayer.hSpeed );
}
function fishPlayerRight()
{
$FishPlayer.setFlipX(false);
$FishPlayer.setLinearVelocityX( -$FishPlayer.hSpeed );
}
function fishPlayerUpStop()
$FishPlayer.setLinearVelocityX( -$FishPlayer.vSpeed );
##}##
function fishPlayerDownStop()
{
$FishPlayer.setLinearVelocityX( -$FishPlayer.vSpeed );
}
function fishPlayerLeftStop()
{
$FishPlayer.setLinearVelocityX( 0 );
}
function fishPlayerRightStop()
{
$FishPlayer.setLinearVelocityX( 0 );
>>> Error report complete.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs.
Activating DirectInput...
DirectInput joystick failed to enable!
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/data/levels/untitled.t2d.
DirectInput deactivated.
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...
As you can see, it refences sections of the code that no longer exist in the game.cs file. I've no idea where it's getting them from
12/27/2007 (6:45 pm)
This is the script I'm trying to run now, it's basically the fish tutorial with the speeds set to 500 so I can see whether it's updating, which so far it hasn't. This part of the code was working fine before, I was working on the movement part of the second fish tutorial when the problems started. //---------------------------------------------------------------------------------------------
// Torque Game Builder
// Copyright (C) GarageGames.com, Inc.
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
// startGame
// All game logic should be set up here. This will be called by the level builder when you
// select "Run Game" or by the startup process of your game to load the first level.
//---------------------------------------------------------------------------------------------
function startGame(%level)
{
exec("./player.cs");
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
new ActionMap(moveMap);
moveMap.push();
$enableDirectInput = true;
activateDirectInput();
enableJoystick();
sceneWindow2D.loadLevel(%level);
}
//---------------------------------------------------------------------------------------------
// endGame
// Game cleanup should be done here.
//---------------------------------------------------------------------------------------------
function endGame()
{
sceneWindow2D.endLevel();
moveMap.pop();
moveMap.delete();
}
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setSpeed();
%this.setLinearVelocityX(%this.speed);
}
function FishClass::onWorldLimit(%this, %mode, %limit)
{
%this.setSpeed();
switch$ (%limit)
{
case "left":
%this.setLinearVelocityX(500);
%this.setFlipX(false);
%this.setPositionY(getRandom(-35, 25));
case "right":
%this.setLinearVelocityX(500);
%this.setFlipX(true);
%this.setPositionY(getRandom(-35, 25));
}
}
function FishClass::setSpeed(%this)
{
%this.speed = getRandom(%this.minSpeed, %this.maxSpeed);
}
The error message I'm getting is
Torque Game Builder (v1.6) initialized...
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/resources/fishArt/resourceDatabase.cs.
% Game Resources : Loaded Resource fishArt
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/datablocks.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/persistent.cs.
Compiling C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/brushes.cs...
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/managed/brushes.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/datablocks.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/guiProfiles.cs.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gui/mainScreen.gui.
Compiling C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs...
C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs Line: 110 - parse error
>>> Advanced script error report. Line 110.
>>> Some error context, with ## on sides of error halt:
$FishPlayer.setLinearVelocityX( -$FishPlayer.hSpeed );
}
function fishPlayerRight()
{
$FishPlayer.setFlipX(false);
$FishPlayer.setLinearVelocityX( -$FishPlayer.hSpeed );
}
function fishPlayerUpStop()
$FishPlayer.setLinearVelocityX( -$FishPlayer.vSpeed );
##}##
function fishPlayerDownStop()
{
$FishPlayer.setLinearVelocityX( -$FishPlayer.vSpeed );
}
function fishPlayerLeftStop()
{
$FishPlayer.setLinearVelocityX( 0 );
}
function fishPlayerRightStop()
{
$FishPlayer.setLinearVelocityX( 0 );
>>> Error report complete.
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/gameScripts/game.cs.
Activating DirectInput...
DirectInput joystick failed to enable!
Loading compiled script C:/Documents and Settings/Mark/My Documents/MyGames/MyGame/game/data/levels/untitled.t2d.
DirectInput deactivated.
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...
As you can see, it refences sections of the code that no longer exist in the game.cs file. I've no idea where it's getting them from
#5
You are missing a { at the beginning of the function (after the name).
12/27/2007 (6:55 pm)
function fishPlayerUpStop() $FishPlayer.setLinearVelocityX( -$FishPlayer.vSpeed ); ##}##
You are missing a { at the beginning of the function (after the name).
#6
12/27/2007 (8:24 pm)
Right, trouble is that that part of my code isn't there anymore
#7
12/27/2007 (8:31 pm)
If it's not there, then it won't show up in the log file. Be absolutely sure that you're posting the right file and that you've saved the file since making changes and post it in here, please.
#8
12/27/2007 (8:50 pm)
You're right of course, I got it mixed up with another game.cs file. The code's been sorted now, it's compiling fine again and I'm quite rightfully feeling like a 24 carat plonker. Thanks for your help and speedy responses, sorry about making a big deal out of it all.
#9
12/27/2007 (9:00 pm)
It's no big deal. It happens to everybody.
Torque 3D Owner Jason Ravencroft