How can i write this program with torque script
by Mehdips3 · in Technical Issues · 11/03/2008 (4:08 am) · 4 replies
How can i write this program with torque script
if ( press F from the keayboard )
{
openDoor ( %obj); or another function whith N arg
}
if ( press F from the keayboard )
{
openDoor ( %obj); or another function whith N arg
}
#2
11/03/2008 (11:36 am)
Function openDoor(%val)
{
if ( %val )
door.open(); // comment
}
moveMap.bind(keyboard, f, openDoor);
#3
for a networked game it would be more like:
(very rough outline)
11/03/2008 (11:57 am)
Note novack's code is correct, but only for single-player games.for a networked game it would be more like:
(very rough outline)
on client:
---------------------------------------------
Function tryToOpenDoor(%val)
{
if ( !%val )
return;
commandToServer('tryToOpenDoor');
}
moveMap.bind(keyboard, f, tryToOpenDoor);
---------------------------------------------
on server:
---------------------------------------------
function serverCmdTryToOpenDoor(%client)
{
door.open(%client.player); // door.open() might want to know who is trying to open the door..
}
---------------------------------------------
#4
11/03/2008 (12:17 pm)
Purist :P
Torque 3D Owner mb