Game Development Community

Mac User - Can't get maccmdline.txt to work for HellowWorld.cs

by Steve Howson · in Torque Game Engine · 07/09/2005 (12:27 am) · 10 replies

Hi all,
I'm a Mac (tiger) user who's VERY new to Torque (as in today).
I just got the book and I have the Torque Demo.
I loaded up Virtual PC, ran the setup to install Torque then copied the CH2 directory to the Torque directory on the Mac.
I created the HelloWorld.cs file exactly as in the book and saved it to the CH2 directory.

I then created a maccmdline.txt file and put it in the Torque directory.
In the txt file is:
-CH2 HelloWorld.cs

When I run Torque, it still goes in to the demo.
I tried putting the text file in the demo directory and same deal.
I can't get it to load the HelloWorld.cs file.

Do I need to make some change to the main.cs or something?
I can't figure out what's going on..

Thanks!
Steve

#1
07/09/2005 (1:27 am)
Are you running the torque engine as a windows exe under VPC, or are you running a mac app ?
#2
07/09/2005 (9:09 am)
I'm running it on a mac.
I copied the CH2 directory from the Virtual PC after I installed it from the CD as there was only a Setup.exe to install the files.

Steve
#3
07/09/2005 (9:28 am)
Steve,

I had troubles with maccmdline.txt too, and nobody on the mac forum knew the answer (or if they did know, didn't answer me). Apparently the executable -- Torque Mac OS X -- looks for main.cs in its folder, and executes that. So, for each project, I've been moving Torque Mac OS X into that folder, and then it executes the main.cs file (supplied by Finney). It's a pain, but it works.

But since in CH2 you don't have a fully-blown project yet, just a bunch of .cs files, here's a cook book approach.

1. Create a subfolder in starter.fps called scripts
2. Copy scripts you wish to execute (e.g., HelloWorld.cs from CH2) into that folder
3. Double click on Torque Mac OS X
4. Type command tilda (~) to open up the console
5. Type: exec("starter.fps/scripts/HelloWorld.cs");

Your script will execute!

Hope this helps.

Michael
#4
07/09/2005 (9:41 am)
Thanks Michael, I tried this but I don't have a starter.fps folder.
I have the demo so I tried making a folder in demo called scripts and copied the helloworld.cs (changed it to all lower case) to that folder.
Loaded up the Torque Demo OSX, hit the ' key, typed exec("demo/scripts/helloworld.cs");
It says something like file not found..

Does this not work with the Torque Demo OSX?

If not, where can I get the one with starter.fps?
I've found it online for the WIndows version, but not OSX.

Thanks.
Steve
#5
07/09/2005 (10:07 am)
I bought the indie license (for $100), so let me just download the demo ...

I got it to work. I launched Torque Demo OSX, clicked on the FPS multiplayer button, then typed command~ and exec("demo/scripts/helloworld.cs");

Try clicking on the FPS multiplayer button, before bringing up the console, maybe that'll help.

Michael
#6
07/09/2005 (10:53 am)
Ok.. looks like I'm one step closer.
I did the above and it says it loaded the script, but I never see a hello world or anything.

Is there something I have to do to execute it once it's loaded?

Does the sound work in Tiger for the indie license version? I know it doesn't for the demo..

Thanks for the help!
Steve
#7
07/09/2005 (1:21 pm)
Yes. You have to write

main();

in the console line. Statements in a .cs file are executed in the order in which they appear, with the exception that functions are *not* executed unless they are explicitly called. You could call them in the .cs file, too. For instance,

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

main();

would execute the main() function, since it is explicitly called.

Assuming that the demo is the same as the indie version that I've bought, then, as far as sound is concerned, yes, it does work, but it's a can of worms. The most recent OpenAL driver doesn't work, you need to get an older version. There's a discussion of this in the forums, and I believe that the correct version is here: ftp.iasi.rdsnet.ro/pub/mirrors/opensource.creative.com/sdk/OpenAL%20Installer.bi....

Michael
#8
07/09/2005 (2:09 pm)
Thanks again Michael!
Now when I execute the command it says 'function print not found'.
I tried copying Torque Demo OSX into the CH2 directory and using that main.cs, but Torque just hangs and I have to force quit it.

Thanks for the link to the old OpenAL installer, I saw a link to the forum thread but didn't have rights to view it.
I downloaded the installer and installed it and still no sound in the demo.

I was hoping to be able to evaluate Torque before I plunk down the $100.. but doesn't look like I'm going to be able to.
Works on the PC.. but can get it to work on the Mac... which is a bummer.

Steve
#9
07/09/2005 (2:30 pm)
I get the same error message. Apparently print() must be defined somewhere else. Just replace print() with the function echo(), which will display things in the console.

Cheers,

Michael
#10
07/10/2005 (12:54 am)
Steve,
Let me say, sorry I didnt get back to you yet, been getting ready to move here..

Let me also say that I have never read the Ken Finney book, so I'm not sure what's going on here, but:
As far as I can tell from other posts about the helloworld.cs thing, you're not alone in the confusion.
The "-CH2" thing is not a normal torque command line option, that means that it's something that the book's main.cs file is reading & acting on. That means I have no idea what it's really doing with that.

Normally, to get your Hello World script to run, you could do the following:
in maccmdline.txt, put:
-mod CH2
Then create a folder called "CH2" in the same folder as the torque app. Inside that folder put a file called main.cs, containing:
function helloworld() {
   echo("Hello World!");
}

helloworld();

That should put the words "hello world!" into the console log, but since they go in when the CH2 folder is run as a mod, they'll be hard to find.
If you add a row of dashes or something, or turn it red by substituting the error() func for the echo() func, or do something else to make it more easily visible, it, um, will be more easily visible.

Ok, its 3am, and I'm obviously out of steam.
Just remember that the book's scripts and .exe file are slightly different from the normal torque demo & indie license build, and remember to search the forums, good stuff out there.

Share and Enjoy,

/Paul