How to pass a variable to function that requires string input?
by Eric Preston · in Torque Game Builder · 09/04/2005 (7:15 am) · 2 replies
This is driving me nuts. I'm sure there must be a simple way to do this.
I'm trying to move the camera to center on the action in my window. So, I compute the center of mass (%com) of my sprites and try to pass this to dynamically change the target camera position. Ideally, the call might look like this:
sceneWindow2D.setTargetCameraPosition(%com 200 150 );
But, sceneWindow2D.setTargetCameraPosition() requires a string input like this: "0 0 200 150" (x/y/width/height). So, how can I get the %com variable to pass to the sceneWindow2D.setTargetCameraPosition()? I've tried getWord(%x,0) to pass x and y separately. That doesn't work.
Anybody know how to do this?
Many thanks, in advance.
Eric
I'm trying to move the camera to center on the action in my window. So, I compute the center of mass (%com) of my sprites and try to pass this to dynamically change the target camera position. Ideally, the call might look like this:
sceneWindow2D.setTargetCameraPosition(%com 200 150 );
But, sceneWindow2D.setTargetCameraPosition() requires a string input like this: "0 0 200 150" (x/y/width/height). So, how can I get the %com variable to pass to the sceneWindow2D.setTargetCameraPosition()? I've tried getWord(%x,0) to pass x and y separately. That doesn't work.
Anybody know how to do this?
Many thanks, in advance.
Eric
Torque Owner Gary Preston
for example if
would return "72 40 50 60" and the second echo using @ would return "72 4050 60"