Game Development Community

Problem starting a cs script via trigger

by John E. Nelson · in Torque Game Engine Advanced · 02/08/2009 (11:17 am) · 3 replies

Having an issue launching an in-quiz script via a trigger.

Currently have the quiz in the game.cs file.
exec("./quiz.cs");

I tried to initialize my quiz script two different ways in the game.cs file.
Quiz_Initialize();

and also tried the following...

initQuiz();

Problem is that I get an error in the console "Unable to find function QuizStart"

Here is the trigger that should start Quiz.
datablock TriggerData(ComputerZoneTrigger)
{
	tickPeriodMS = 200;
};
$ZoneEntered_Computer = false;
function ComputerZoneTrigger::onEnterTrigger( %this, %trigger, %obj )
{
	if ((%obj.getClassName() $= "Player")) {
		$ZoneEntered_Computer = true;
		QuizStart();
	}

Any help here to point out what I am missing would be appreciated.

#1
02/08/2009 (12:42 pm)
Without seeing your quiz.cs script, I'm not sure what can be said except the following:

Make sure you have a function called "QuizStart" in quiz.cs.
#2
02/08/2009 (1:14 pm)
It's also possible that quiz.cs has an error, and is not loading. Look at your console.log and see if there are any error messages. If you are using Torsion, this is a lot easier, just select the redspot off to the right in the output window.
#3
02/08/2009 (6:23 pm)
Yes thanks for the help, I found where the function was not being defined correctly and was able to fix that. Now I have to clean up other function references. I am converting TGE code to TGEA, so there are a few changes I was not expecting.