Game Development Community

A question about calling the script

by Steven Chiu · in Torque Game Engine · 07/20/2004 (12:09 pm) · 5 replies

Say, I got a function defined in clint.cs script file as follows:

function AvatarCamPitchDown(%val)
{
if (%val)
commandToServer('MouseBounceDown');
}

What's the correct c++ syntax to call this function in engine code?

#1
07/20/2004 (1:26 pm)
I believe this should work:

Con::executef(2, "AvatarCamPitchDown", true); // or false
#2
07/20/2004 (7:37 pm)
No, It deosn't work! It crash the engine, any clue for this?
#3
07/21/2004 (7:50 am)
You have to pass strings to executef - "1" or "1" might work a bit better.
#4
07/21/2004 (8:37 am)
Forgot to check the type defined in console.h, sorry for that!

It works now,anyway thanks Ben.
#5
07/22/2004 (9:18 am)
Glad you got it working!