Game Development Community

Chapter 2: Hello World - missing files

by Jay Arrera · in Torque Game Engine · 07/21/2007 (3:23 pm) · 6 replies

Okay, I feel like a noob now. I checked out all the forum postings put couldn't find a solution to this problem.

I can't get HelloWorld to execute.

Setup:
I have the key files located here:
c://3DGPAi1/demo/helloworld.cs
c://3DGPAi1/tge.exe

1) I launch tge.exe
2) In the console I enter the following command:
exec("demo/helloworld.cs");

Result: Missing file: demo/helloworld.cs!

I tried moving files in various combination and checked for typos a dozen times.

Thanks,


#1
07/21/2007 (6:21 pm)
Depending on the dir structure, "demo/" might be considered your game root. Did you try just exec("helloworld.cs"); "

I went into a clean Torque install, and added a test script into c:/torque/example/starter.fps/server/ -

exec("starter.fps/server/helloworld.cs"); worked fine.


Don't give up! Torque has a really high learning curve, especially with little things like that. But, once you get up to speed, you can do some really amazing things with it. I've been programming fro 12 years, and it still trips me up on alot of things. The 3DGPAi1 books are the best currently available for Torque, just a little out of date. There's a new one coming out soon, but I still recommend that everyone read them all!
#2
07/21/2007 (9:55 pm)
Well, I'm making some progress. I did a clean install, and for simplicity moved the helloworld.cs file in the root directory.

When I try and exec in the console, it compiles but no output occurs.

==>exec("helloworld.cs");
Compiling helloworld.cs...
keyboard0 input device created.
mouse0 input device created.

I've tried both echo and print functions:
//=================
// helloworld.cs
//
// This module is a program that prints a simple greeting on the screen.
//
// ================

function main()
//-----------------
//  Entry point for the program
//-----------------
{
  print ("Hello World");
}

Thanks,

Jay
#3
07/22/2007 (3:35 pm)
This just worked for me:

function HelloWorld() {
echo("Hello World!");
}
#4
07/22/2007 (9:53 pm)
Still no joy. I copy/pasted your script, and got the same results. Nada.

==>exec("helloworld.cs");
Compiling helloworld.cs...
   keyboard0 input device created.
   mouse0 input device created.
   keyboard0 input device created.
   mouse0 input device created.

It appears to be going into lah lah land when compiling...

I was able to go through the Torque 1.5.2 tutorial and create and modify the scripts as necessary with no issues...

Jay
#5
07/24/2007 (1:03 pm)
I figured it out.

1) For some reason, when I exec out of demo/helloworld.cs, it works. If I have the file in the same directory as the TGE.exe, it compiles, but does not load.
2) I didn't realize that I needed to actually call the function (in my case helloworld() ) after exec. I assumed [incorrectly] that exec would call the function.

Note: A key realization was that it was compiling, but not loading.

Thanks for your help,

Jay
#6
08/02/2007 (1:12 am)
How you call a function(in this case helloworld) from the console(TorqueGameEngineSDK-1-4-2)

coz i can not exec helloworld but i compile it

how to load it

what load cs file mean in torque


another thing is the ouput will be like the book said or what

From your Windows Start menu select the Start, Run.
2. Type command in the edit box offered. This will open a Command window or
MS-DOS Prompt window.
3. In the new window at the command prompt (the blinking cursor), type
cd C:\3DGPAi1 and then press Enter.
4. Next, type tge -ch2 HelloWorld.cs. A Torque window will open up, and you
should see something like Figure 2.10, with "Hello World" in yellow at the upper
left of the screen. Cool, huh?


plz help coz i am a beginner in this issue & i confused about appling the book with no result from the begin

thanx