Game Development Community

Wrong Path searching?

by Kiyaku · in Torque Game Engine · 06/10/2007 (5:51 am) · 2 replies

Hi everyone,

sorry if there is allready an answer to my question, but i couldn't find it.

I'm doing some tutorials where i have to include files.
The problem is, when i use "./splash" for example, it can't find the file. When i use "splash" it's possible to find the file.

But when i use the exec function, none of this works at all, it can't find my canvas.cs at all.

It's in the same folder and there is no .dso file.


My main.cs script:

[...]

function showMenuScreen() {
   canvas.setContent(menuScreen);
   canvas.setCursor("defaultCursor");
   canvas.cursorOn();
}

function splashScreenInputCtrl::onInputEvent(%this, %dev, %evt, %make) {
   if (%make) showMenuScreen();
}

enableWinConsole(true);
setLogMode(2);
trace(true);

setModPaths(".");
exec("./canvas.cs");   // PROBLEM HERE!
initClient();



canvas.cs file:

// canvas.cs - 12 APR 2005
function initCanvas(%windowName) {
   new guiCursor(defaultCursor) {
      hotSpot = "1 1";
      bitmapName = "./CUR_3darrow";
   };
   
   if (!createCanvas(%windowName)) quit();
      
   if(!isObject(guiDefaultProfile)) new guiControlProfile(guiDefaultProfile) {
      tab = false;
      canKeyFocus = false;
      hasBitmapArray = false;
      mouseOverSelected = false;
      
      // fill color
      opaque = false;
      fillColor =  "192 192 192";
      fillColorHL =  "220 220 220";
      fillColorNA =  "220 220 220";
      
      // border color
      border = false;
      borderColor   = "0 0 0";
      borderColorHL = "128 128 128";
      borderColorNA = "64 64 64";
      
      // font
      fontType = "Arial";
      fontSize = 14;
      fontColor = "0 0 0";
      fontColorHL = "32 100 100";
      fontColorNA = "0 0 0";
      fontColorSEL= "200 200 200";
      
      // bitmap information
      bitmap = "./demoWindow";
      bitmapBase = "";
      textOffset = "0 0";

      // used by guiTextControl
      modal = true;
      justify = "left";
      autoSizeWidth = false;
      autoSizeHeight = false;
      returnTab = false;
      numbersOnly = false;
      cursorColor = "0 0 0 255";
   };

   if(!isObject(guiInputCtrlProfile)) new guiControlProfile(guiInputCtrlProfile) {
      tab = true;
      canKeyFocus = true;
   };
   
   if(!isObject(guiContentProfile)) new guiControlProfile(guiContentProfile) {
      opaque = true;
      fillColor = "255 255 255";
   };
   
   if(!isObject(guiButtonProfile)) new guiControlProfile(guiButtonProfile) {
      opaque = true;
      border = true;
      fontColor = "0 0 0";
      fontColorHL = "32 100 100";
      fixedExtent = true;
      justify = "center";
      canKeyFocus = false;
   };

   if(!isObject(guiTextProfile)) new guiControlProfile(guiTextProfile) {
      fontColor = "0 0 0";
      fontColorLink = "255 96 96";
      fontColorLinkHL = "0 0 255";
      autoSizeWidth = true;
      autoSizeHeight = true;
   };
}



My folder structure looks like this:

...
Torque Game Engine 1.5.2 Demo
---\TestApp1
------\canvas.cs
------\console.log
------\CUR_3darrow.png
------\demo.exe
------\demoWindow.png
------\main.cs
------\splash.jpg



As you can see i even used modPath.


So my questions:
- How can i use the "./splash" instead of "splash"
- Why can't it find the canvas file, wether i write "./canvas.cs" or "~/canvas.cs" or "canvas.cs"


Thanks in advance!

#1
06/10/2007 (12:30 pm)
Torque can't load files from the same directory as the executable except for main.cs.
#2
06/10/2007 (1:20 pm)
Ahh okay. thanks for that.
when i put them into a nother folder, it really works :) Thanks alot!