Game Development Community

Error running TorqueScript Language tutorials

by Cesar Velazquez · in Torque Game Engine · 08/29/2004 (2:32 pm) · 4 replies

Hello,

I am a new user to the torque engine. I've downloaded the latest stable release,
compiled it and successfully ran the demo fps.


I am going through the scripting language tutorials covering packages and got an
error I don't know how to debug.

The script I'm trying to run is from the tutorial:

http://www.garagegames.com/docs/torque/general/ch05s02.php

near the bottom of the page covering packages.

I created the file:

example/test_scripts/package_test.cs

which contains:

//
// Define an initial function: demo()
//
function demo()
{
echo("Demo definition 0");
}
.
.
.
.



I then try the following command from the console:

exec(test_scripts/package_test.cs);

I get the following error:

invalide script file name

I've also tried:

exec("test_scripts/package_test.cs");

but got this error instead:
Missing file: package_test.cs!

any hints on what I am doing wrong?

thanks!


sorry if I posted to the wrong forum. I'm still trying to get comfortable navigating the
garage games website.

#1
08/29/2004 (2:41 pm)
Try these, chances are your directory setup is not correct...


exec("~/test_scripts/package_test.cs");

exec("./test_scripts/package_test.cs");

exec("./package_test.cs");


I'm betting one of those 3 will work.
#2
09/02/2004 (6:28 am)
Cesar, let me know if Gonzo's suggestion works. If not, Ed or I will look into this in more detail. Thanks.

Re: the forum to post in, it's understandable to make mistakes-- navigating this giant website is hard at first. :) This thread would fit the Documentation forum itself best, just to note for the future when you encounter probs of this nature.
#3
09/02/2004 (5:28 pm)
Cesar,

I'm sorry to hear you're having problems.

Let's do a quick walkthrough which I think should get you going.

First the assumptions:

- Your torque directory is --> C:\torque
- You have made the following directory --> C:\torque\example\starter.fps\test_scripts
- Your file is named --> package_test.cs
- You started the FPS kit after doing the above. If you start the kit before this, the engine may not see the files/directories as it builds a tree on startup.

Note: If any of the above assumptions is incorrect, please adjust the following examples to follow your drive/hierarchy. One thing to note. Please put the test_scripts directory under a mod directory, usually the one you'll be running when you start out is starter.fps.

OK. Now assuming (again) that everything is done as noted above, you should be able to exec() package_test.cs by:

1. Start the FPS Kit.
2. Open the console by typing ~
3. type: exec("starter.fps/test_scripts/package_test.cs");

Violla! That should work. If not, please let me know.

Oh, and by the way. If you originally had test_scripts in -> C:\torque\example\

Gonzo's first example -> exec("~/test_scripts/package_test.cs"); would have worked, except for one small problem. Typing ~ would close the console. :)


I'll watch this thread. So, please post if you still have issues.

[HOW]EdM|EGTGE
#4
09/02/2004 (8:25 pm)
Hello again,

Thanks for the suggestions... got it working (yea!)

I am using torque in linux, here is my diretory structure:

/home/cesar/development/garagegames/torque/
/home/cesar/development/garagegames/torque/example/torqueDemo_DEBUG.bin
/home/cesar/development/garagegames/torque/example/starter.fps

While following the torque scripting tutorial, it mentions to:

Save the code as a new file called "package_test.cs" and save it in the "test_scripts" sub-directory of the example directory we created previously *INSERT LINK*.

I think this is what threw me off. I assumed that the "example directory" was:

/home/cesar/development/garagegames/torque/example

so I created:

/home/cesar/development/garagegames/torque/example/test_scripts/package_test.cs

using the various suggestions by Gonzo to exec the script still didn't work.

exec("./test_scripts/package_test.cs");

returned:

Missing file: ./test_scripts/package_test.cs!

but when I moved test_scripts to starter.fps, exec worked. So I now have:

/home/cesar/development/garagegames/torque/example/starter.fps/test_scripts/package_test.cs

then when I run:

exec("starter.fps/test_scripts/package_test.cs");

I get:

Loading compiled script starter.fps/test_scripts/package_test.cs.

So i guess my problem was having the test_scripts directory in the wrong place. Are there
some restrictions on what directories are visible within torqueScript?

I don't know why I was able to run:
exec("starter.fps/test_scripts/package_test.cs");
and not:
exec("./test_scripts/package_test.cs");

maybe adding a line in the docs showing the correct directory structure will prevent future newbies like
myself from making the same mistake.

thanks for the help!

cesar