All messed out...please help me.
by Miguel Angel Cortes Sosa · in Torque Game Engine · 05/24/2003 (10:35 am) · 3 replies
Hi,
I bought the SDK 4 weeks ago, and I still haven't been able to do something usefull, I have many questions whose answer ain't in the fourums (or does not apears in the searches I have made).
-I do have the Tribal IDE, however I do not know how to debug with it. I mean, how do I contect Tribal IDE to the example demo
or Realm Wars?
-How do I set the debug port when running the demo example or realm wars?
-How do I set the port for a dedicated app. on the demo example or realm wars?
-How/Where in the SDK do I look for script functions that are not explained in the scripting language reference document?
-Where is the "Main()" in the scripts, or in other words where is the entry point after you hit return to run the example demo or realm wars?
I bought the SDK 4 weeks ago, and I still haven't been able to do something usefull, I have many questions whose answer ain't in the fourums (or does not apears in the searches I have made).
-I do have the Tribal IDE, however I do not know how to debug with it. I mean, how do I contect Tribal IDE to the example demo
or Realm Wars?
-How do I set the debug port when running the demo example or realm wars?
-How do I set the port for a dedicated app. on the demo example or realm wars?
-How/Where in the SDK do I look for script functions that are not explained in the scripting language reference document?
-Where is the "Main()" in the scripts, or in other words where is the entry point after you hit return to run the example demo or realm wars?
About the author
#2
Thank you very much for your help,
That will really help me to get to understand better how Torque works.
It's nice to be on a forum where you actually get good answers for newbies like me.
Thank you.
05/26/2003 (4:40 pm)
Jared:Thank you very much for your help,
That will really help me to get to understand better how Torque works.
It's nice to be on a forum where you actually get good answers for newbies like me.
Thank you.
#3
05/28/2003 (8:29 pm)
You're welcome, let us know if you need any more help.
Torque Owner Jared Schnelle
Debugging
---------
There is a console command called dbgsetparameters, which sets up the game so that it is ready for debugging.
Do the following:
-Open fps/server/scripts/game.cs
-Below the exec("./file.cs"); stuff, put dbgsetparameters("4500", "miguel");
-Save the file.
-In Tribal IDE, click Edit -> Preferences
-Click Debugger
-The address should be 127.0.0.1 if you are running the game on this computer
-The port is 4500
-The password is miguel in all lowercase
Now, once the game is running you can connect to the game using debugger by hitting the green play button.
Ports
----------
If you have all your files loaded up into a project, click Search->Find In Files
and search for ::Port (include the two colons).
Script Functions
----------------
The best way to do this is to open the C++ code in your program, whatever it is, like Visual Studio, and search for ConsoleCommand, ConsoleMethod, and Con::addCommand
An example would be:
Con::addCommand("ShapeBase", "getCameraFov", cGetCameraFov, "obj.getCameraFov()", 2, 2);This is a script function called getCameraFov(), that can be called on any shapebase, such as a vehicle, a player, or a rifle that's on the ground. So, in the script you'd use it just like it says at the end "obj.getCameraFov()". When you call a script function, such as:function serverCmdTestMyFov(%client) { %player = %client.getControlObject(); if(%player){ %fov = %player.getCameraFov(); echo("Field of view is" SPC %fov); } }It will go into the C++ code, and actually call the C++ function cGetCameraFov. Hopefully you can understand the syntax of the Con::addCommand now.
Main()
------
Lastly, when you run the demo app, it executes C++ code first, that starts the engine then this block of code located in main.cc loads the main.cs file, which in turn loads the rest of the scripting files
FileStream str; const char* mainCS = "main.cs"; if(!str.open(mainCS, FileStream::Read)) { char msg[1024]; dSprintf(msg, sizeof(msg), "Failed to open \"%s\".", mainCS); Platform::AlertOK("Error", msg); return false; } U32 size = str.getStreamSize(); char *script = new char[size + 1]; str.read(size, script); str.close(); script[size] = 0; Con::executef(2, "eval", script); delete[] script; return true;Hope this helps.