Cant get console method to set variable right
by Bryan Stroebel · in Torque Game Engine · 05/17/2006 (2:25 pm) · 3 replies
Ok. I know this may be simple but I can't seem to figure it out.
I have a public variable in a class that i set to NULL in the constructor for the class.
I have a console method that just sets the value of that variable to the string I pass in as argv[2]
However, when I print out the value of myvar after the console method is run, it comes out as a "y".
when I change the consolemethod to the following it works:
Is there somekind of conversion that I need to do to get the passed argv[2] into myvar properly? I've tried casts and conversions and nothing works.
I have a public variable in a class that i set to NULL in the constructor for the class.
const char* myvar;
I have a console method that just sets the value of that variable to the string I pass in as argv[2]
ConsoleMethod(myclass,mymethod,void,3,3,"cm(myvar)")
{
object->myvar = argv[2];
}However, when I print out the value of myvar after the console method is run, it comes out as a "y".
when I change the consolemethod to the following it works:
ConsoleMethod(myclass,mymethod,void,3,3,"cm(myvar)")
{
object->myvar = "hello world";
}Is there somekind of conversion that I need to do to get the passed argv[2] into myvar properly? I've tried casts and conversions and nothing works.
Associate Ian Omroth Hardingham
Ian