Game Development Community

I'm embarrassed to ask this simple question, but please help

by Mark Draper · in Torque Game Engine · 09/02/2007 (12:26 pm) · 4 replies

Sorry to bother all you people on the right side of the IQ bellcurve, but this mouth breather needs help ...

was trying to output text on collision.
this works to keep score

clientGame.cs
------------------------------------------------------

function clientCmdSetScoreCounter(%score)
{
ScoreCounter.setText("Score:" SPC %score);
}

function clientCmdShowVictory(%score)
{
MessageBoxYesNo("You Win!",
"Would you like to restart the game ?",
"loadMyMission();",
"quit();");
}
--------------------------------------------------------


logoitem.cs
--------------------------------------------------------

...

function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.score++;
commandToClient(%client, 'SetScoreCounter', %client.score);
%obj.delete();
%logoCount = logos.getCount();

if(%logoCount > 0)
return;
// otherwise display victory screen
commandToClient(%client, 'ShowVictory', %client.score);
}
}
--------------------------------------------------------

that works fine. but then i try to add another text output with this

clientGame.cs
------------------------------------------------------

function clientCmdSetScoreCounter(%score)
{
ScoreCounter.setText("Score:" SPC %score);
}

function clientCmdSayOuch(%tstring) <---------------------------------
{
SayOuch.setText("OUCH %tstring");
}

function clientCmdShowVictory(%score)
{
MessageBoxYesNo("You Win!",
"Would you like to restart the game ?",
"loadMyMission();",
"quit();");
}--------------------------------------------------------


logoitem.cs
--------------------------------------------------------

...

function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.score++;
commandToClient(%client, 'SetScoreCounter', %client.score);
commandToClient(%client, 'SayOuch', %client.score); <---------------------------------------------
%obj.delete();
%logoCount = logos.getCount();

if(%logoCount > 0)
return;
// otherwise display victory screen
commandToClient(%client, 'ShowVictory', %client.score);
}
}
--------------------------------------------------------


and it doesn't work.
please, can someone tell me why?

#1
09/02/2007 (12:30 pm)
SayOuch.setText("OUCH %tstring"); for the first guess, anyway
#2
09/02/2007 (12:54 pm)
Assuming you have a GUI that is named SayOuch, it would be:

%text = "OUCH" SPC %tstring;
SayOuch.setText(%text);
#3
09/02/2007 (1:07 pm)
AHHH THAT'S IT!

I'don't have a GUI setup for SayOuch

THANKS Stephen!

now i can return to eating lead paint chips
#4
09/02/2007 (1:26 pm)
AHHH THAT'S IT!

I'don't have a GUI setup for SayOuch

THANKS Stephen!

now i can return to eating lead paint chips