Creating automatic keyboard and mouse events
by Joao Ranhel · in Technical Issues · 07/01/2008 (4:13 pm) · 2 replies
I'm involved in an AI scientific research.
I intend to use the player character as a robot that has vision. So I intend to move the PC by creating an automatic program that sends events of keyboard pressing and mouse moving to the TGE.
Can I do that (create such events) by using TorqueScript?
In other words, how can I simulate that the player has pressed a key on the keyboard?
And how can I simulate that the mouse has moved left, right or front/back? (I couldn't find anything on docs).
If I write an external program (say in C++), does anybody know how (or if) a program can send such events to TGE?
Thanks for any help.
I intend to use the player character as a robot that has vision. So I intend to move the PC by creating an automatic program that sends events of keyboard pressing and mouse moving to the TGE.
Can I do that (create such events) by using TorqueScript?
In other words, how can I simulate that the player has pressed a key on the keyboard?
And how can I simulate that the mouse has moved left, right or front/back? (I couldn't find anything on docs).
If I write an external program (say in C++), does anybody know how (or if) a program can send such events to TGE?
Thanks for any help.
#2
I've used moveforward(), yaw() etc. they work fine if we control the player/robot from scripts inside Torque.
But my colleagues and I want to create the "player mind" (the control program) from outside the Torque world - using other languages like Python.
Torsion uses the debugger function dbgSetParameters(); that uses TelNet. So, the idea of using Telnet is good. We will try this... It sounds nice.
There is another solution that is to create (in our control program) a link to the Windows "user32.dll", and to use the Inputs.sendInputs() to the Torque client window.
We will try both solutions... if someone knows a better way, please let us know...
Thanks again.
07/03/2008 (1:41 pm)
Thanks Gabriel...I've used moveforward(), yaw() etc. they work fine if we control the player/robot from scripts inside Torque.
But my colleagues and I want to create the "player mind" (the control program) from outside the Torque world - using other languages like Python.
Torsion uses the debugger function dbgSetParameters(); that uses TelNet. So, the idea of using Telnet is good. We will try this... It sounds nice.
There is another solution that is to create (in our control program) a link to the Windows "user32.dll", and to use the Inputs.sendInputs() to the Torque client window.
We will try both solutions... if someone knows a better way, please let us know...
Thanks again.
Torque Owner Gabriel Notman
Have a look at client/scripts/default.bind.cs in starter.fps.
There are lines with:
Which bind the event to the function listed as the last parameter.
Most of these functions modify a set of global variables which begin with $mv*****. These effect the player (or the control object of that client) directly.
I'm not sure how you would interface from another program, but Torsion the script editor connects to the console so I'm sure its possible.
Gabriel