Game Development Community

Client to Engine variable

by Jonathan Champagne · in Torque Game Engine · 04/03/2004 (10:35 am) · 7 replies

How could I set a variable in the game scripts and be able to read that variable within the engine, like within the ResManager class?

#1
04/03/2004 (2:20 pm)
Is it not possible?
#2
04/03/2004 (3:54 pm)
What you are asking is too vague to really answer. What variable do you want to set? You write C++ code that interacts with scripts. There is a resource that shows how to create C++ functions and call them via script.
#3
04/03/2004 (4:17 pm)
Didn't seem vague to me, sorry... I'm asking how I could set a variable in the scripts that the c++ can access. Not any specific variable, just one that I can create to put a string or a variable or anything in it which the c++ engine itself can access, and I supplied a sample class which I might want to read the variable from.

Heres a simple example:

In the scripts;
$isActive = true;
In the engine;
if(isActive){...}
#4
04/03/2004 (4:34 pm)
Jonathan Champagne

Your second question; Yes, it's possible and it's not difficult.
#5
04/03/2004 (4:39 pm)
Well after wondering around the engine for a few hours, I found it =)

Con::getBoolVariable("$myVariable")
#6
04/04/2004 (9:41 am)
That is one way to do it.

The other way is to use Con::addVariable().

Congrats on finding a solution on your own, btw. :)
#7
04/04/2004 (11:23 am)
Thanks :)