Code causes program to crash
by Jonathan R Hopkins · in Technical Issues · 06/06/2009 (7:34 pm) · 4 replies
Update: June 14th, 2009
----------------------------------------------
Well this has just gotten more interesting. I've contacted Garage Games about this, but I've found out a bit more about the issue. Somehow, and I'm not sure what the cause is, I believe that the .t2dproj file will corrupt itself - it happens after a the game itself runs into an error and crashes, or, the Torque Game Builder editor crashes. After that it steadily deteriorates until it can no longer go into that same section of code. Which, obnoxiously, is my "new game" functionality.
However, I've found a work-around that seems to solve the problem 99% of the time. I've been consistently saving backup versions of my game as I've been developing it, separating it into "stable" and "unstable" builds. Wherein the stable builds are the ones that don't crash at the new game function (as described below). I've discovered that when I do reach the "crash point" that if I copy .t2dproj from an older stable version to the new version, the crash will cease and the build becomes healthy.
I'm posting this for two reasons. 1) To let everyone know in case someone eventually encounters a similar problem. 2) To open the topic for discussion in case someone else finds/has found additional solutions.
----------------------------------------------
So here's a tough one. The code I am using here will cause the program to crash... sometimes. But not every time. It took me awhile to sniff it out but I finally found it and I'm not sure why its doing it. Any ideas? Even an alternative to what I'm doing would be helpful.
I am using Torque Game Builder on Windows Vista/Windows 7 (The crash happens in the same place on both)
Here's how this works. I've built a scene in Torque Game Builder which contains a bunch of scene objects which don't actually have a graphic, but are click-able. Just for reference, I've included the code here below in main.t2d. The code works by changing scenes, and then moving the t2dSceneObjects that are already there to new positions. When the player clicks a region on the screen (via mousedown) the region references an array that tells it what action to take from there. For example, the player might click where there is a door, and then move onto a new screen. When the game doesn't crash, this works just fine.
There are two types of "click regions" four of them are embedded on the sides of the screen and never move. These usually are used for moving between "camera positions" which are not literally different camera position in Torque, but just changing the picture in the background. The other 5 are set up in real time by regionSetup, which moves the region and changes the size (this way I can recycle the same objects instead of making new ones).
The click regions all also have the "mouse enter" and "mouse leave" functionalities.
So in Summary, this is how loading a level works in my game.
New Game Clicked >> Main Menu Scene Closed down >> Starting variables setup >> Functions for level objects created >> Click regions functions created >> Level starts
The way this works, is the player clicks "new game" on the main menu - which is its own level/scene and this one is loaded.
This code here is the code that is executed when the player clicks "new game".
This is "levelSetup.cs". The crash happens here I've commented out everything that causes the crash, and now it doesn't happen, but I'm not really sure what needs to be done differently. What I have realized, however, is that something to do with the click region objects and their functionality cause the crash, because all of the functionality has to be commented out for the game not to crash. I'm just not sure what rule I've broken...
And finally, here is the code that actually gives the majority of the click regions functionality:
I realize that's a lot of code - but perhaps someone is familiar with the problem? The code only crashes when the user tries to load the level. The window fades and "does not respond" then I have to close it. Strangely enough it does make it to the echo lines in levelSetup: Camera position = ... and SceneStructure[1,0] = ... but stops there when it does stop. I have tried commenting out parts of it, but all clickRegion.cs and the dependent functionality have to be completely out for it to function.
Thank you for your time.
----------------------------------------------
Well this has just gotten more interesting. I've contacted Garage Games about this, but I've found out a bit more about the issue. Somehow, and I'm not sure what the cause is, I believe that the .t2dproj file will corrupt itself - it happens after a the game itself runs into an error and crashes, or, the Torque Game Builder editor crashes. After that it steadily deteriorates until it can no longer go into that same section of code. Which, obnoxiously, is my "new game" functionality.
However, I've found a work-around that seems to solve the problem 99% of the time. I've been consistently saving backup versions of my game as I've been developing it, separating it into "stable" and "unstable" builds. Wherein the stable builds are the ones that don't crash at the new game function (as described below). I've discovered that when I do reach the "crash point" that if I copy .t2dproj from an older stable version to the new version, the crash will cease and the build becomes healthy.
I'm posting this for two reasons. 1) To let everyone know in case someone eventually encounters a similar problem. 2) To open the topic for discussion in case someone else finds/has found additional solutions.
----------------------------------------------
So here's a tough one. The code I am using here will cause the program to crash... sometimes. But not every time. It took me awhile to sniff it out but I finally found it and I'm not sure why its doing it. Any ideas? Even an alternative to what I'm doing would be helpful.
I am using Torque Game Builder on Windows Vista/Windows 7 (The crash happens in the same place on both)
Here's how this works. I've built a scene in Torque Game Builder which contains a bunch of scene objects which don't actually have a graphic, but are click-able. Just for reference, I've included the code here below in main.t2d. The code works by changing scenes, and then moving the t2dSceneObjects that are already there to new positions. When the player clicks a region on the screen (via mousedown) the region references an array that tells it what action to take from there. For example, the player might click where there is a door, and then move onto a new screen. When the game doesn't crash, this works just fine.
There are two types of "click regions" four of them are embedded on the sides of the screen and never move. These usually are used for moving between "camera positions" which are not literally different camera position in Torque, but just changing the picture in the background. The other 5 are set up in real time by regionSetup, which moves the region and changes the size (this way I can recycle the same objects instead of making new ones).
The click regions all also have the "mouse enter" and "mouse leave" functionalities.
So in Summary, this is how loading a level works in my game.
New Game Clicked >> Main Menu Scene Closed down >> Starting variables setup >> Functions for level objects created >> Click regions functions created >> Level starts
main.t2d
%levelContent = new t2dSceneGraph() {
canSaveDynamicFields = "1";
UseLayerSorting = "1";
layerSortMode0 = "Normal";
layerSortMode1 = "Normal";
layerSortMode2 = "Normal";
layerSortMode3 = "Normal";
layerSortMode4 = "Normal";
layerSortMode5 = "Normal";
layerSortMode6 = "Normal";
layerSortMode7 = "Normal";
layerSortMode8 = "Normal";
layerSortMode9 = "Normal";
layerSortMode10 = "Normal";
layerSortMode11 = "Normal";
layerSortMode12 = "Normal";
layerSortMode13 = "Normal";
layerSortMode14 = "Normal";
layerSortMode15 = "Normal";
layerSortMode16 = "Normal";
layerSortMode17 = "Normal";
layerSortMode18 = "Normal";
layerSortMode19 = "Normal";
layerSortMode20 = "Normal";
layerSortMode21 = "Normal";
layerSortMode22 = "Normal";
layerSortMode23 = "Normal";
layerSortMode24 = "Normal";
layerSortMode25 = "Normal";
layerSortMode26 = "Normal";
layerSortMode27 = "Normal";
layerSortMode28 = "Normal";
layerSortMode29 = "Normal";
layerSortMode30 = "Normal";
layerSortMode31 = "Normal";
DebugRendering = "0";
cameraPosition = "0 0";
cameraSize = "100 75";
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegionLeft";
useMouseEvents = "1";
Position = "-45.000 0.228";
size = "10.000 50.000";
WorldLimitMin = "-261.383 -560.340";
WorldLimitMax = "199.832 565.314";
CollisionCallback = "1";
mountID = "2";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegionRight";
useMouseEvents = "1";
Position = "45.000 0.000";
size = "10.000 50.000";
Layer = "1";
WorldLimitMin = "-261.383 -560.340";
WorldLimitMax = "199.832 565.314";
CollisionCallback = "1";
mountID = "3";
};
new t2dAnimatedSprite() {
animationName = "linkImageAnimation";
canSaveDynamicFields = "1";
class = "sceneImage";
size = "100.000 60.000";
mountID = "4";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegionTop";
useMouseEvents = "1";
Position = "0.000 -26.250";
size = "80.000 7.500";
Layer = "1";
WorldLimitMin = "-261.383 -560.340";
WorldLimitMax = "199.832 565.314";
CollisionCallback = "1";
mountID = "5";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegionBottom";
useMouseEvents = "1";
Position = "0.000 26.528";
size = "80.000 6.944";
Layer = "1";
WorldLimitMin = "-261.383 -560.340";
WorldLimitMax = "199.832 565.314";
CollisionCallback = "1";
mountID = "6";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegionCenter";
useMouseEvents = "1";
Position = "-0.976 0.144";
size = "21.953 15.328";
Layer = "1";
WorldLimitMin = "-261.383 -560.340";
WorldLimitMax = "199.832 565.314";
CollisionCallback = "1";
mountID = "7";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegion1";
useMouseEvents = "1";
Position = "-50.324 63.548";
size = "16.000 16.000";
mountID = "8";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegion2";
useMouseEvents = "1";
Position = "-24.751 63.731";
size = "16.000 16.000";
mountID = "9";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegion3";
useMouseEvents = "1";
Position = "-0.457 63.000";
size = "16.000 16.000";
mountID = "10";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegion4";
useMouseEvents = "1";
Position = "22.316 63.254";
size = "16.000 16.000";
mountID = "11";
};
new t2dSceneObject() {
canSaveDynamicFields = "1";
class = "clickRegion5";
useMouseEvents = "1";
Position = "44.917 63.254";
size = "16.220 16.000";
mountID = "12";
};
new t2dTextObject() {
canSaveDynamicFields = "1";
Position = "4.122 -30.875";
size = "41.756 1.750";
text = "INTERNAL USE ONLY - Use without permission is forbidden";
font = "Arial";
wordWrap = "0";
hideOverflow = "1";
textAlign = "Left";
lineHeight = "1.74988";
aspectRatio = "0.999996";
lineSpacing = "0";
characterSpacing = "0";
autoSize = "1";
fontSizes = "80";
textColor = "1 1 1 1";
hideOverlap = "0";
mountID = "13";
};
new t2dTextObject() {
canSaveDynamicFields = "1";
Position = "-0.728 -33.426";
size = "36.355 2.149";
text = "Copyright 2009 J.R. Creative Studios, LLC";
font = "Arial";
wordWrap = "0";
hideOverflow = "1";
textAlign = "Left";
lineHeight = "2.14959";
aspectRatio = "0.999995";
lineSpacing = "0";
characterSpacing = "0";
autoSize = "1";
fontSizes = "80";
textColor = "1 1 1 1";
hideOverlap = "0";
mountID = "14";
};
new t2dTextObject() {
canSaveDynamicFields = "1";
Position = "-3.476 -35.851";
size = "33.047 2.295";
text = "Lincoln V Engine - Version 0.6 Alpha";
font = "Arial";
wordWrap = "0";
hideOverflow = "1";
textAlign = "Left";
lineHeight = "2.29493";
aspectRatio = "0.999996";
lineSpacing = "0";
characterSpacing = "0";
autoSize = "1";
fontSizes = "80";
textColor = "1 1 1 1";
hideOverlap = "0";
mountID = "15";
};
};The way this works, is the player clicks "new game" on the main menu - which is its own level/scene and this one is loaded.
This code here is the code that is executed when the player clicks "new game".
Excerpt from mainMenu.cs
echo("Starting a new game for the first time in this instance of the program");
$newLevel = expandFileName("~/data/levels/main.t2d");
//exec("~/gameScripts/mainSetup.cs");
echo("Start game clicked");
// Sets up the main functions and objects
alxStopAll();
sceneWindow2D.endLevel();
$enableDirectInput = false;
exec("~/gameScripts/newGame.cs");
exec("~/gameScripts/levelSetup.cs");
sceneWindow2D.loadLevel($newLevel);
$enableDirectInput = true;
finishSetup();
echo("Camera position: " @ $controller.camPosition);
echo("Scene structure[1,0] = " @ $sceneStructure[1,0]);
%loading = false;
$newGameLoaded = true;This is "levelSetup.cs". The crash happens here I've commented out everything that causes the crash, and now it doesn't happen, but I'm not really sure what needs to be done differently. What I have realized, however, is that something to do with the click region objects and their functionality cause the crash, because all of the functionality has to be commented out for the game not to crash. I'm just not sure what rule I've broken...
levelSetup.cs
//-----------------------------------------------------
//Lincoln V, Level setup
//-----------------------------------------------------
//Sets up level based on the global settings used.
$suspendUserAccess = true; //Deactivates user control to ensure sound setup.
$transitioning = false; //This indicates whether a transition is occuring
$fieldClicked = 0; //This is used to store what field was clicked
/*function sceneImage::onLevelLoaded(%this, %scenegraph)
{
$mainImage = %this;
echo("$mainImage set");
}
function sceneImage::onAnimationEnd(%this)
{
if ($transitioning == true)
{
positionChange($controller.camPosition, $fieldClicked);
$transitioning = false;
}
}
function mouseLeave()
{
if ($mouseInteraction $= "mouseLeave")
{
Canvas.setCursor(DefaultCursor);
$mouseInteraction = "none";
}
}
//Sets up a quick way to do the mouse entering script
function mouseEnter()
{
if ($mouseInteraction $= "mouseEnter")
{
Canvas.setCursor(handCursor);
$mouseInteraction = "none";
}
}
//Streamlines position changes
function positionChange(%currentScene, %field)
{
echo("Current position: " @ $controller.camPosition NL "Camera name: " @ $sceneStructure[$controller.camPosition,6]);
%newCamPosition = $sceneStructure[%currentScene,%field];
//Checks whether the scene change actually exists
if (%newCamPosition > 0)
{
//Changes the animation
%newPositionAnimation = $sceneStructure[%newCamPosition,0];
$mainImage.setAnimation(%newPositionAnimation);
//Checks if a music change is neccessary
bgmSwitch($sceneStructure[%newCamPosition,12]);
//Sets up the click regions
regionSetup($controller.camPosition);
//OLD CODE: $mainImage.setImageMap(%newPositionAnimation,%frame);
$controller.camPosition = %newCamPosition;
echo("New Camera Position: " @ %newPos NL "New Camera name: " @ $sceneStructure[%newPos,6]);
return %newCamPosition;
}
else
{
return -1;
}
}
//Checks whether is a transition is valid
function checkTransition(%currentScene, %field)
{
%indice = %field + 6;
%transition = $sceneStructure[%currentScene,%indice];
echo("Checking transition Camera Position: " @ %currentScene @ " index: " @ %indice);
echo("Transition value: " @ %transition);
//%transition = "" @ %transition;
//if (%transition !$= "")
if (checkDatablock(%transition) == true)
{
$mainImage.setAnimation(%transition);
$transitioning = true;
}
else
{
echo("No transition found");
positionChange($controller.camPosition, %field);
}
}*/
echo("NOTICE sent by levelSetup.cs! clickRegions.cs and all dependent code not executed to stop crashing.");
//Set up Click Regions
//exec("~/gameScripts/clickRegions.cs");
//Finishes the game setup
function finishSetup()
{
//Sets up the regions
echo("Setting up regions for current camera " @ $controller.camPosition);
regionSetup($controller.camPosition);
//Sets the animation
echo("Setting animation " @ $sceneStructure[$controller.camPosition,0]);
$mainImage.setAnimation($sceneStructure[$controller.camPosition,0]);
//Starts the music
echo("Switching to track: " @ $sceneStructure[$controller.camPosition,12]);
bgmSwitch($sceneStructure[$controller.camPosition,12]);
//Lets the game know it has been loaded.
$loaded = true;
$inGameMenuDisabled = false;
$suspendUserAccess = false; //Returns user control
echo("Game fully loaded.");
}And finally, here is the code that actually gives the majority of the click regions functionality:
clickRegions.cs
//-----------------------------------------------------
//Lincoln V, Click Regions
//-----------------------------------------------------
//Sets up the funcationality of the clickable regions
$mouseInteraction = "none"; //This allows regions to be run out of one script
/*$mouseInteraction Description
clickLeft
clickRight
mouseEnter
mouseLeave
holdLeft
releaseLeft
none
initialize
*/
//Establishes the click region positions in the scene
function regionSetup(%camPosition)
{
if ($clickRegion[%camPosition,0] <= 0)
{
echo("No regions found. Region set up not neccessary.");
return false;
}
if ($clickRegion[%camPosition,0] >= 1)
{
$field1.setPosition($clickRegion[%camPosition,1],$clickRegion[%camPosition,2]);
$field1.setSize($clickRegion[%camPosition,3],$clickRegion[%camPosition,4]);
echo("Field 1 set up at position:" @ $field1.getPosition() @ " dimensions: " @ $field1.getSize());
}
if ($clickRegion[%camPosition,0] >= 2)
{
$field2.setPosition($clickRegion[%camPosition,11],$clickRegion[%camPosition,12]);
$field2.setSize($clickRegion[%camPosition,13],$clickRegion[%camPosition,14]);
echo("Field 2 set up at position:" @ $field2.getPosition() @ " dimensions: " @ $field2.getSize());
}
if ($clickRegion[%camPosition,0] >= 3)
{
$field3.setPosition($clickRegion[%camPosition,21],$clickRegion[%camPosition,22]);
$field3.setSize($clickRegion[%camPosition,23],$clickRegion[%camPosition,24]);
echo("Field 3 set up at position:" @ $field3.getPosition() @ " dimensions: " @ $field3.getSize());
}
if ($clickRegion[%camPosition,0] >= 4)
{
$field4.setPosition($clickRegion[%camPosition,31],$clickRegion[%camPosition,32]);
$field4.setSize($clickRegion[%camPosition,33],$clickRegion[%camPosition,34]);
echo("Field 4 set up at position:" @ $field4.getPosition() @ " dimensions: " @ $field4.getSize());
}
if ($clickRegion[%camPosition,0] == 5)
{
$field5.setPosition($clickRegion[%camPosition,41],$clickRegion[%camPosition,42]);
$field5.setSize($clickRegion[%camPosition,43],$clickRegion[%camPosition,44]);
echo("Field 5 set up at position:" @ $field5.getPosition() @ " dimensions: " @ $field5.getSize());
}
}
//Checks whether the script exists, then executes it.
function regionScript(%scriptName)
{
echo("Checking whether regionScript <" @ %scriptName @ "> exists...");
if (checkDatablock(%scriptName) == true)
{
echo("Script found. Executing: " @ "./gameScripts/regions/" @ %scriptName @ ".cs");
exec("~/gameScripts/regions/" @ %scriptName @ ".cs");
}
else
{
echo("Script does not exist. No execution will occur");
return(false);
}
}
//CLASS: Clickable Region
//First we initialize the objects
function clickRegion1::onLevelLoaded(%this, %scenegraph)
{
$field1 = %this;
}
function clickRegion2::onLevelLoaded(%this, %scenegraph)
{
$field2 = %this;
}
function clickRegion3::onLevelLoaded(%this, %scenegraph)
{
$field3 = %this;
}
function clickRegion4::onLevelLoaded(%this, %scenegraph)
{
$field4 = %this;
}
function clickRegion5::onLevelLoaded(%this, %scenegraph)
{
$field5 = %this;
}
//Embedded fields
function clickRegionTop::onLevelLoaded(%this, %scenegraph)
{
$topField = %this;
}
function clickRegionLeft::onLevelLoaded(%this, %scenegraph)
{
$leftField = %this;
}
function clickRegionBottom::onLevelLoaded(%this, %scenegraph)
{
$bottomField = %this;
}
function clickRegionRight::onLevelLoaded(%this, %scenegraph)
{
$rightField = %this;
}
function clickRegionCenter::onLevelLoaded(%this, %scenegraph)
{
$centerField = %this;
}
//--------------------------
//ON MOUSE DOWN
//--------------------------
//Now we enable the regions clicking capacities
function clickRegion1::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 1 clicked");
$mouseInteraction = "clickLeft";
regionScript($clickRegion[$controller.camPosition,5]);
}
}
function clickRegion2::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 2 clicked");
$mouseInteraction = "clickLeft";
regionScript($clickRegion[$controller.camPosition,15]);
}
}
function clickRegion3::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 3 clicked");
$mouseInteraction = "clickLeft";
regionScript($clickRegion[$controller.camPosition,25]);
}
}
function clickRegion4::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 4 clicked");
$mouseInteraction = "clickLeft";
regionScript($clickRegion[$controller.camPosition,35]);
}
}
function clickRegion5::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 5 clicked");
$mouseInteraction = "clickLeft";
regionScript($clickRegion[$controller.camPosition,45]);
}
}
function clickRegionTop::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Top field Object clicked");
$fieldClicked = 1;
if (checkDatablock($controller.camPosition,$fieldClicked) == true)
{
checkTransition($controller.camPosition,$fieldClicked);
}
}
}
//-------------------------------
//ON MOUSE LEAVE
//-------------------------------
//Now we enable the regions clicking capacities
function clickRegion1::onMouseLeave(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 1 clicked");
$mouseInteraction = "mouseLeave";
regionScript($clickRegion[$controller.camPosition,5]);
}
}
function clickRegion2::onMouseLeave(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 2 clicked");
$mouseInteraction = "mouseLeave";
regionScript($clickRegion[$controller.camPosition,15]);
}
}
function clickRegion3::onMouseLeave(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 3 clicked");
$mouseInteraction = "mouseLeave";
regionScript($clickRegion[$controller.camPosition,25]);
}
}
function clickRegion4::onMouseLeave(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 4 clicked");
$mouseInteraction = "mouseLeave";
regionScript($clickRegion[$controller.camPosition,35]);
}
}
function clickRegion5::onMouseLeave(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 5 clicked");
$mouseInteraction = "mouseLeave";
regionScript($clickRegion[$controller.camPosition,45]);
}
}
//-------------------------------
//ON MOUSE Enter
//-------------------------------
//Now we enable the regions entering capacities
function clickRegion1::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 1 clicked");
$mouseInteraction = "mouseEnter";
regionScript($clickRegion[$controller.camPosition,5]);
}
}
function clickRegion2::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 2 clicked");
$mouseInteraction = "mouseEnter";
regionScript($clickRegion[$controller.camPosition,15]);
}
}
function clickRegion3::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 3 clicked");
$mouseInteraction = "mouseEnter";
regionScript($clickRegion[$controller.camPosition,25]);
}
}
function clickRegion4::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 4 clicked");
$mouseInteraction = "mouseEnter";
regionScript($clickRegion[$controller.camPosition,35]);
}
}
function clickRegion5::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Region 5 clicked");
$mouseInteraction = "mouseEnter";
regionScript($clickRegion[$controller.camPosition,45]);
}
}
function clickRegionLeft::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Left field Object clicked");
$fieldClicked = 2;
if (checkDatablock($controller.camPosition,$fieldClicked) == true)
{
checkTransition($controller.camPosition,$fieldClicked);
}
}
}
function clickRegionBottom::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Bottom field Object clicked");
$fieldClicked = 3;
if (checkDatablock($controller.camPosition,$fieldClicked) == true)
{
checkTransition($controller.camPosition,$fieldClicked);
}
}
}
function clickRegionRight::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Right field Object clicked");
$fieldClicked = 4;
if (checkDatablock($controller.camPosition,$fieldClicked) == true)
{
checkTransition($controller.camPosition,$fieldClicked);
}
}
}
function clickRegionCenter::onMouseDown(%this, %modifier, %worldPosition, %clicks)
{
if ($suspendUserAccess == false)
{
echo("Center field Object clicked");
$fieldClicked = 5;
if (checkDatablock($controller.camPosition,$fieldClicked) == true)
{
checkTransition($controller.camPosition,$fieldClicked);
}
}
}I realize that's a lot of code - but perhaps someone is familiar with the problem? The code only crashes when the user tries to load the level. The window fades and "does not respond" then I have to close it. Strangely enough it does make it to the echo lines in levelSetup: Camera position = ... and SceneStructure[1,0] = ... but stops there when it does stop. I have tried commenting out parts of it, but all clickRegion.cs and the dependent functionality have to be completely out for it to function.
Thank you for your time.
#2
06/08/2009 (7:47 am)
Thanks for the tip! I haven't quite found the issue yet, but I managed to work around it in the Vista build.
#3
06/08/2009 (12:23 pm)
oh well thats good to know. i hope you finde the error, i know hunting gets to be a very troublesome task :)
#4
06/14/2009 (9:58 pm)
UPDATE! See the first post for more info.
Torque 3D Owner Scooby Brown
I think it will help you pinpoint the problem quicker