//=======================================================================================
// Demo messages - by Mental Trousers as part of the Tribes scripting documents at
// http://planetstarsiege.com/mt/
//=======================================================================================
//
// I quite often make demos of particular things, tricks, strategies etc to send to my
// clanmates and I got sick of stopping to type something in to explain what was going on
// so I wrote this script. It's very simple. There is a list of messages, the last of
// which is empty ie "". Each time you press the zoom key, it "says" the message, cycling
// through all of them until it gets to the empty one, at which point it rebinds the
// zoom key to zoom again. The doNothing() function was necessary because I was getting
// errors when I released the key, wierd but it is probably fine using later versions of
// Tribes.
//
// I've found that I needed alot of practise run throughs of whatever it was I was
// demoing, to get the timing of the messages correct with the action.
//
//=======================================================================================

//bind the zoom to do the talking
EditActionMap("playMap.sae");
bindCommand(mouse0, make, button1, TO, "DemoTalk::SaySomething ();");
bindCommand(mouse0, break, button1, TO, "doNothing();");

//keeps track of which message we're up to
$index=0;

//the list of messages. Can be as long as you like.
$saying[0]="Heres a new trick that I found while messing around";
$saying[1]="It means you can get Heavies to places they dont normally go";
$saying[2]="First you need an Inventory station";
$saying[3]="Then you set it up and grab a camera";
$saying[4]="Jet up a wall for a bit";
$saying[5]="Plant the camera";
$saying[6]="And now you have a step to use to get up the wall";
$saying[7]="You can use beacons etc, but it's heaps harder";
$saying[8]="Hee hee, have fun guys :) Bye bye";
$saying[9]=".... boy do I have too much time on my hands ....";
$saying[10]="";

//says the message when the key is pressed
function DemoTalk::SaySomething ()
{
	say (1, $saying[$index]);
	$index++;

	//check to see if it's the last message, if so, clean up
	if ($saying[$index]=="")
		DemoTalk::Cleanup ();
	return;
}

//rebinds the zoom key back to zoom again
function DemoTalk::Cleanup ()
{
	EditActionMap("playMap.sae");
	bindAction(mouse0, make, button1, TO, IDACTION_SNIPER_FOV, 1.000000);
	bindAction(mouse0, break, button1, TO, IDACTION_SNIPER_FOV, 0.000000);
	return;
}

//here to stop a stupid little error that was occurring
function doNothing()
{
	return;
}