Trouble passing values
by DMT · in Torque 3D Beginner · 04/09/2010 (1:11 pm) · 2 replies
Hi, I am having trouble passing values from a GUI button to a function.
So the button has a line like this :
Command = "blahblah.Function(1);";
The function it self is just something like :
function blahblah::Function(%val){
echo(%val);
}
The trouble is that the output for this in the console will be :
blahblah
instead of :
1
So, what I am doing wrong?
So the button has a line like this :
Command = "blahblah.Function(1);";
The function it self is just something like :
function blahblah::Function(%val){
echo(%val);
}
The trouble is that the output for this in the console will be :
blahblah
instead of :
1
So, what I am doing wrong?
About the author
#2
04/15/2010 (1:13 pm)
Hey, thank a lot! That really helps. I completely missed the object aspect of it. This is really going to help me.
Rex Hiebert
3Dmotif LLC
function blahblah::Function(%this, %val){
echo(%val);
}
And your test should work. What this does is allow you to reference the object and its parameters. If blahblah had something added to it like:
blahblah.myVar = "bleep";
You can then reference this value in the function as
if (%this.myVar $= "bleep")
return;