Getting a console variable through C++
by Bryce · in Torque Game Engine · 01/24/2009 (1:06 pm) · 4 replies
Hello Everyone, C++ noob question :-)
I have a variable set in script that looks like this:
I'm trying to hook this directly into a console method I've made, a version of ShapeBase::setImageTrigger specifically for AI Players. I want to retrieve the value of isFriendlyInLOS that was saved on the object. Would it be some kind of getField() function? Help would be awesome!
I have a variable set in script that looks like this:
%npc.isFriendlyInLOS = true;
I'm trying to hook this directly into a console method I've made, a version of ShapeBase::setImageTrigger specifically for AI Players. I want to retrieve the value of isFriendlyInLOS that was saved on the object. Would it be some kind of getField() function? Help would be awesome!
#2
01/24/2009 (1:59 pm)
Meh, just 404 errors...
#3
The function dAtob(fieldValue) will convert the string into a boolean:
01/24/2009 (2:16 pm)
If you have the object, you can do this:StringTableEntry fieldName = StringTable->insert("isFriendlyInLOS");
const char *fieldValue = myObj->getDataField(fieldName, 0);The function dAtob(fieldValue) will convert the string into a boolean:
const bool isFriendlyInLOS = dAtob(fieldValue);
#4
01/24/2009 (5:31 pm)
That works! I've finally learned what all those dAtob() and dAtof() functions mean...Thank you!
Torque Owner Shaderman
"Interfacing with the Engine"
http://www.garagegames.com/docs/tge/general/ch05s03.php
Maybe you can figure out how to reach that on the new site.