Engine output to console - how-to?
by Steven Peterson · in Torque Game Engine · 02/15/2006 (10:37 am) · 3 replies
I'm trying to figure out how to make an engine-function print output to the standard message-box included in the starter.fps mission.
From the script side I saw examples of two functions used: messageClient() and messageAll()
but I couldn't find where these functions are documented and i'm not sure how I can use them from the engine.
I'm still getting a handle on interfacing from C++ to script so this part is confusing me and I can't seem to find the documentation I need.
Thanks for the help,
Raven
From the script side I saw examples of two functions used: messageClient() and messageAll()
but I couldn't find where these functions are documented and i'm not sure how I can use them from the engine.
I'm still getting a handle on interfacing from C++ to script so this part is confusing me and I can't seem to find the documentation I need.
Thanks for the help,
Raven
#2
By the 'standard message-box' do you mean the chat window in the corner?
If so, there's a couple of ways to post messages to it. From script I'd look at example/common/server/message.cs in TGE 1.4. Down at the bottom are three chat functions that should get you started. These use the commandToClient system to pass messages to the client.
Now if you want to do this from C++ (which I think you're after) I do not believe there is anything set up directly to do this. If you want to do this in pure C++ and not call into script, then you could take a look in engine/game/net/net.cc and see how the console function commandToClient operates ie: calls into sendRemoteCommand. You could then write your own C++ chat function that calls sendRemoteCommand directly with the appropriate parameters.
The other method would be to use Con:: evaluatef() to call the script chat functions from C++. As an example (untested at my end, for entertainment purposes only :o)
Hope that helps!
- LightWave Dave
Edit: Oops, didn't read the title of your post completely. You wanted the console window. Doh! Yeah, do what Stephen says.
02/15/2006 (11:14 am)
Greetings!By the 'standard message-box' do you mean the chat window in the corner?
If so, there's a couple of ways to post messages to it. From script I'd look at example/common/server/message.cs in TGE 1.4. Down at the bottom are three chat functions that should get you started. These use the commandToClient system to pass messages to the client.
Now if you want to do this from C++ (which I think you're after) I do not believe there is anything set up directly to do this. If you want to do this in pure C++ and not call into script, then you could take a look in engine/game/net/net.cc and see how the console function commandToClient operates ie: calls into sendRemoteCommand. You could then write your own C++ chat function that calls sendRemoteCommand directly with the appropriate parameters.
The other method would be to use Con:: evaluatef() to call the script chat functions from C++. As an example (untested at my end, for entertainment purposes only :o)
Con::evaluatef("chatMessageClient(%d, %d, %d, %d, \"%s\");", client->getId(), sender->getId(), myvoicetag, myvoicepitch, msgStr);Hope that helps!
- LightWave Dave
Edit: Oops, didn't read the title of your post completely. You wanted the console window. Doh! Yeah, do what Stephen says.
#3
Thanks both!
Raven
02/15/2006 (11:25 am)
Oops, guess my title was ambigous; I'll actually need both but today i'm specifically after the chat window. I'll try evaluatef() first as that approach seems to involve the least reverse-engineering. :-)Thanks both!
Raven
Torque 3D Owner Stephen Zepp