pft toggle when switching weapons

rtcll

Veteran X
would someone be able to make it so that when I switch between disc and cg my pft changes to a set #?

let me know if this is possible thanks friends :)
 
I would also like this! Is there a way to also include a change in interpolate? I prefer to disc with a 64, but my cg sucks, and would like it to change to 32 or 0 when i start firing.

Thanks!
 
Doesn't pft=0 mean you would be playing at whatever your ping is? I ping 124, so if pft=124, my "ping" would be a 0, but i pft=0, that would mean I am playing with a 124 ping, making my predictions 124 ms ahead or behind?
 
I made this script 3 years ago for morningstar. This is essentially what I gave him, plus a few updates for ease of use. Have fun with it.

Edit: this requires advanced fire.

Code:
//Terp script that changes based on current weapon. Made by {TXM}-Eliminator-

//Set up our defaults
//$net::predictforwardtimemethod = 2;
//$net::interpolatetime = 64;

//Set up our terp
$HM::interpNormal=64;
$HM::interpChain=0;
$HM::interpDisk=64;
$HM::interpNade=64;
$HM::interpLaser=64;
$HM::interpMortar=64;
$HM::interpPlasma=64;
$HM::interpBlaster=64;

//Set up our pft
$HM::pftNormal=0;
$HM::pftChain=0;
$HM::pftDisk=0;
$HM::pftNade=0;
$HM::pftLaser=0;
$HM::pftMortar=0;
$HM::pftPlasma=0;
$HM::pftBlaster=0;


function terp::next() after nextWeapon {
    HM::update();
}

function terp::next() after prevWeapon {
    HM::update();
}


//Update interpolate setting
function HM::update()
{
	%curwep = GetMountedItem(0);
	
	if ( %curwep == GetItemType("Chaingun"))
	{
		$net::interpolatetime = $HM::interpChain;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftChain;
	}
	else if ( %curwep == GetItemType("disc launcher"))
	{
		$net::interpolatetime = $HM::interpDisk;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftDisk;
	}
	else if ( %curwep == GetItemType("grenade launcher"))
	{
		$net::interpolatetime = $HM::interpNade;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftNade;
	}
	else if ( %curwep == GetItemType("laser rifle"))
	{
		$net::interpolatetime = $HM::interpLaser;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftLaser;
	}
	else if ( %curwep == GetItemType("mortar"))
	{
		$net::interpolatetime = $HM::interpMortar;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftMortar=0;
	}
	else if ( %curwep == GetItemType("plasma gun"))
	{
		$net::interpolatetime = $HM::interpPlasma;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftPlasma;

	}
	else if ( %curwep == GetItemType("blaster"))
	{
		$net::interpolatetime = $HM::interpBlaster;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftBlaster;

	}
	else
	{
		$net::interpolatetime = $HM::interpNormal;
		$net::predictforwardtimemethod = 1;
		$net::predictforwardtime = $HM::pftNormal=0;

	}
}

event::Attach(EventYouFired, HM::update);
event::Attach(EventYouReleased, HM::update);
 
Last edited:
It is the script which allows you to detect when you have fired a weapon (or respawned.) It's not the greatest, and can sometimes fail, but there isn't anyway around this i don't believe. Be sure to set it instead of the default fire.
This:

Code:
////////////////////////////////////////////////////////////
// Boots 1.4 Pack
// File:	AdvancedFire.acs.cs
// Version:	1.0
// Author:	Zlex(Boots) w/ credit to Poop
// Credits:	This is basically just a modification of 
//		Poops Advanced Fire Script
// Info:	Provides event on fire needed for chainzoom
//		and SmartAmmo
//
////////////////////////////////////////////////////////////
function AF::GameBinds::Init()
  after GameBinds::Init
{
	$GameBinds::CurrentMapHandle = GameBinds::GetActionMap2( "playMap.sae");
	$GameBinds::CurrentMap = "playMap.sae";
	GameBinds::addBindCommand( "Advanced Fire", "AF::On();", "AF::Off();");
}

function AF::On() {
	%wep = GetMountedItem(0);
	if(%wep == -1) { 
		$AF::NoWeapon = "TRUE";
		Event::Trigger(EventNoWeapon);
		NextWeapon();
	}
	else if(%wep != -1 && $AF::NoWeapon == "TRUE") {
		$AF::NoWeapon = "";
		Event::Trigger(EventNewWeapon, %wep);
	}
	postAction(2048, IDACTION_FIRE1, 1);
	$AF::Firing = "TRUE";
	Event::Trigger(EventYouFired, %wep);
}

function AF::Off() {
	%wep = GetMountedItem(0);
	postAction(2048, IDACTION_BREAK1, 1);
	$AF::Firing = "";
	Event::Trigger(EventYouReleased, %wep);
}
 
Last edited:
elim i took ur script and slimmed it down a little bit. place in config/modules. (set bottomprint to false if you don't want it to bottomprint)
https://dl.dropboxusercontent.com/u/3172732/autonet.acs.cs
Code:
// bottom prints pft changes
$autonet::bottomprint = true;

Event::Attach(eventConnected, autonet::init);
Event::Attach(eventNextWeapon, autonet::update);
Event::Attach(eventPrevWeapon, autonet::update);
Event::Attach(eventUsedItem, autonet::update);
Event::Attach(eventItemReceived, autonet::update);

function autonet::init()
{
  // set defaults
  for (%i = 0; %i < 64; %i++) // how many item types are there anyway?
  {
    $autonet::terp[%i] = 64;
    $autonet::pft[%i] = 128;
    $autonet::pftMethod[%i] = 1;
  }

  // weapons: chaingun, disc launcher, grenade launcher, laser rifle, mortar, plasma gun, blaster
  $autonet::terp[GetItemType("chaingun")] = 0;
  $autonet::terp[GetItemType("disc launcher")] = 64;
  $autonet::terp[GetItemType("grenade launcher")] = 64;
  $autonet::pft[GetItemType("chaingun")] = 128;
  $autonet::pft[GetItemType("disc launcher")] = 128;
  $autonet::pft[GetItemType("grenade launcher")] = 128;
  $autonet::pftMethod[GetItemType("chaingun")] = 1;
  $autonet::pftMethod[GetItemType("disc launcher")] = 1;
  $autonet::pftMethod[GetItemType("grenade launcher")] = 1;
}

function autonet::update()
{
  %weapon = GetMountedItem(0);
  $net::interpolatetime = $autonet::terp[%weapon];
  $net::predictforwardtimemethod = $autonet::pftMethod[%weapon];
  $net::predictforwardtime = $autonet::pft[%weapon];

  if ($autonet::bottomprint)
    remoteBP(2048, "<JC>Terp: <F2>" ~ $net::interpolatetime ~ " <F1>PFT: <F2>" ~ $net::predictforwardtime, 1);
}

i also accidentally found that eventUsedItem and eventDropItem in misc.cs weren't passing the %type correctly. use this below if you use scripts which depend on those events. place in config/core:
https://dl.dropboxusercontent.com/u/3172732/Misc.cs
Code:
//----------------------------------------------------------------------------
// Client side convience scripts
//
function buy(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		remoteEval(2048,buyItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function markFavorites()
{
	// Currently done by the shell
}

function remoteSetInfoLine(%mgr, %lineNum, %text)
{
   if(%mgr != 2048)
      return;

	if (%lineNum == 1)
	{
		if (%text == "") Control::setVisible(InfoCtrlBox, FALSE);
		else Control::setVisible(InfoCtrlBox, TRUE);
	}

   Control::setText("InfoCtrlLine" @ %lineNum, %text);
}


function buyFavorites()
{
	// This function is invoked by the shell.
	for (%i = 0; %i < 20; %i = %i + 1) {
		if ($pref::itemFavorite[%i] != "") {
			%type = getItemType($pref::itemFavorite[%i]);
			if (%type != -1) {
				%list = %list @ "," @ %type;
			}
		}
	}
	if (%list != "") {
		eval("remoteEval(2048,buyFavorites" @ %list @ ");");
	}
}	

function sell(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		remoteEval(2048,sellItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function use(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
    echo("use: " @ %type);
		// The client useItem function will make sure the use is
		// sequenced correctly with trigger events.  The remoteEval
		// works fine but may be delivered out of order.
		// remoteEval(2048,useItem,%type);
		schedule("Event::Trigger(\"eventUsedItem\"," @ %type @ ");",1);
		useItem(%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}

}

function drop(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		schedule("Event::Trigger(\"eventDropItem\"," @ %type @ ");",1);
		remoteEval(2048,dropItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function throwStart()
{
	$throwStartTime = getSimTime();
}

function throwRelease(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		%delta = getSimTime() - $throwStartTime;
		if (%delta > 1)
			%delta = 100;
		else
			%delta = floor(%delta * 100);
		remoteEval(2048,throwItem,%type,%delta);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function deploy(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		remoteEval(2048,deployItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function nextWeapon()
{
	// Up to the server right now
	schedule("checkWeapon(\"Next\", "@$CheckWepNum++ @");", 1);
	remoteEval(2048,nextWeapon);
}	

function prevWeapon()
{
	// Up to the server right now
	schedule("checkWeapon(\"Prev\", "@$CheckWepNum++ @");", 1);
	remoteEval(2048,prevWeapon);
}

function checkWeapon(%type, %num) {
	if(%num == $CheckWepNum) {
		Event::Trigger("event"@ %type @"Weapon", GetMountedItem(0));
	}
}

function commandAck()
{
	// Placed here to avoid binding problems with gui.
	remoteEval(2048,CStatus,1,"Command Acknowledged~wacknow");
}

function commandDeclined()
{
	// Placed here to avoid binding problems with gui.
	remoteEval(2048,CStatus,0,"Unable to complete objective~wobjxcmp");
}

function CommandCompleted()
{
	// Placed here to avoid binding problems with gui.
	remoteEval(2048,CStatus,0,"Objective Completed~wobjcomp");
}

function targetClient()
{
   if($lastClientMessage)
   {
      if(Client::getTeam(getManagerId()) == Client::getTeam($lastClientMessage))
         %cmd = "Escort " @ Client::getName($lastClientMessage) @ ".~wescfr";
      else
         %cmd = "Attack " @ Client::getName($lastClientMessage) @ ".~wattway";
      remoteEval(2048, "IssueTargCommand", 0, %cmd, $lastClientMessage - 2048, getManagerId());
   }
}


function clearCenterPrint(%id)
{
   if(%id == $centerPrintId)
      Client::centerPrint("", 0);
}

function remoteITXT(%manager, %msg)
{
   if(%manager == 2048)
      Control::setValue(EnergyDisplayText, %msg);
}

function remoteCP(%manager, %msg, %timeout)
{
   if(%manager == 2048)
   {
      $centerPrintId++;
      if(%timeout)
         schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
      Client::centerPrint(%msg, 0);
   }
}

function remoteBP(%manager, %msg, %timeout)
{
   if(%manager == 2048)
   {
      $centerPrintId++;
      if(%timeout)
         schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
      Client::centerPrint(%msg, 1);
   }
}

function remoteTP(%manager, %msg, %timeout)
{
   if(%manager == 2048)
   {
      $centerPrintId++;
      if(%timeout)
         schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
      Client::centerPrint(%msg, 2);
   }
}

function kill()
{
	remoteEval(2048,kill);
}	

function giveall()
{
	remoteEval(2048,giveall);
}

// Fear aliases
function setTeam(%team)
{
   remoteEval(2048, setTeam, %team);
}

function say(%channel, %message)
{
   remoteEval(2048, say, %channel, %message);
}

function mute(%playerName)
{
   remoteEval(2048, mute, 1, getClientByName(%playerName));
}

function unmute(%playerName)
{
   remoteEval(2048, mute, 0, getClientByName(%playerName));
}

function show()
{
   // redefine end frame script
   function Game::EndFrame()
   {
   }
   $Console::LastLineTimeout = 0;
   $Console::updateMetrics = false;
}
show();

function showTime()
{
   function Game::EndFrame()
   {
      echo("C: " @ getIntegerTime(false) @ "   S: " @ getIntegerTime(true));
   }
   $Console::LastLineTimeout = 1000;
   $Console::updateMetrics = false;
}

function showFPS()
{
   function Game::EndFrame()
   {
	   echo($ConsoleWorld::FrameRate);
   }
   $Console::LastLineTimeout = 1000;
   $Console::updateMetrics = false;
}

function changeLevel(%newLevel)
{
   remoteEval(2048, changeLevel, %newLevel);
}

function setArmor(%armorType)
{
   remoteEval(2048, setArmor, %armorType);
}

function voteYes()
{
   remoteEval(2048, VoteYes);
}

function voteNo()
{
   remoteEval(2048, VoteNo);
}

//editing functions

function winMouse()
{
   inputDeactivate(mouse0);
   windowsMouseEnable(MainWindow);
}

function dirMouse()
{
   inputActivate(mouse0);
   windowsMouseDisable(MainWindow);
}

function editGui() {
	winMouse();
	GuiInspect(MainWindow);
	//GuiToolbar(MainWindow);
	GuiEditMode(MainWindow);
	cursorOn(MainWindow);
	tree();
}

function tree()
{
	simTreeCreate(tree, MainWindow);
	simTreeAddSet(tree, manager);
}

function toggleMouse()
{
   if($flagMouseDirect = !$flagMouseDirect)
   {
      dirMouse();
   }
   else
   {
      winMouse();
   }
}

function remoteSetTime(%server, %time)
{
   if(%server == 2048)
      setHudTimer(%time);
}

function SADSetPassword(%password)
{
   remoteEval(2048, SetPassword, %password);
}

function ADSetTimeLimit(%time)
{
   remoteEval(2048, SetTimeLimit, %time);
}

function ADSetTeamInfo(%team, %teamName, %skinBase)
{
   remoteEval(2048, SetTeamInfo, %team, %teamName, %skinBase);
}

function remoteMODInfo(%server, %modString)
{
   if(%server == 2048)
   {
      $ServerModInfo = %modString;
      // if it is not "", 
      // show it on the loading gui
      if($ServerModInfo != "")
      {
         Control::setValue(ModTextString, "<jc><f1>NOTICE: This server has been modified\n<f0>" @ %modString);
      }
   }
}

function remoteFileURL(%server, %url)
{
   if(%server == 2048)
   {
      $ServerFileURL = %url;
      // if a disconnect occurs, pop this string up instead of error message
   }
}

function remoteMInfo(%server, %missionName)
{
   if(%server == 2048)
   {
      %file = "missions\\" @ %missionName @ ".dsc";
      $MDESC::Type = "";
      $MDESC::Text = "";
      if(File::findFirst(%file) != "")
         exec(%file);
      $ServerMission = %missionName;
      $ServerText = $MDESC::Text;
      $ServerMissionType = $MDESC::Type;
		if(isObject(LobbyGui))
			LobbyGui::onOpen();  // update lobby screen text.
   }
}

function remoteMissionChangeNotify(%serverManagerId, %nextMission)
{
   if(%serverManagerId == 2048)
   {
      cls();
      echo("Server mission complete - changing to mission: ", %nextMission);
      echo("Flushing Texture Cache");
      flushTextureCache();
      schedule("purgeResources(true);", 3);
   }
}

function dataGotBlock(%blockName, %pctDone)
{
   if(%pctDone < 0.1)
      %text = "Initializing Personal Digital Assistant...";
   else if(%pctDone < 0.2)
      %text = "Establishing uplink with satellite network...";
   else if(%pctDone < 0.3)
      %text = "Downloading navigational and topographical data...";
   else if(%pctDone < 0.4)
      %text = "Charging armor energy cell...";
   else if(%pctDone < 0.5)
      %text = "Pingback satellite uplink check...";
   else if(%pctDone < 0.6)
      %text = "Beginning primary weapons system check...";
   else if(%pctDone < 0.7)
      %text = "Beginning secondary weapons system check...";
   else if(%pctDone < 0.8)
      %text = "Downloading tactical information from tribal database...";
   else
      %text = "Starting armor power-up sequence...";

   //Control::setText(ProgressText, "Loading " @ %blockName @ " data...");
   Control::setValue(ProgressText, "<jc><f1>" @ %text);
   Control::setValue(ProgressSlider, %pctDone * 0.75);
}

function dataFinished()
{
   // called on client when all the dynamic data has
   // finished transfer.

   Control::setValue(ProgressText, "<jc><f0>Get ready to rock n' roll!");
   Control::setValue(ProgressSlider, 1);

   $dataFinished = true;
   remoteEval(2048, dataFinished);

   echo("Flushing Texture Cache");
   flushTextureCache();
}

function onClientGhostAlwaysDone()
{
   // preload the commander gui if it's not already loaded
   if(!isObject("CommandGui")) {
      exec("gui/command.gui.cs");
   }

   %temp = $pref::terrainTextureDetail;
   $pref::terrainTextureDetail = 1;
   echo( "rebuildCommandMap" );
   rebuildCommandMap();
   $pref::terrainTextureDetail = %temp;
   flushTextureCache();
   purgeResources(true);
   remoteEval(2048, "CGADone");

//   echo("Registering Static Textures");
//   RegisterStaticTextures(MainWindow);
}

function remoteSetMusic (%player, %track, %mode)
{
}

function setupRecorderFile(%fileName)
{
	if(%fileName != "" && %fileName != "False") {
		if(isFile("recordings/" @ %fileName)) 
			echo("Warning- " @ %fileName @ " File Already Exists");
		$recorderFileName = "recordings/" @ %fileName;
		if($recorderFileName != "False") {
			echo("File is named: ",%fileName);
			return "True";
		}	
 	}
	else {
		for(%i = 0; %i < 500; %i++) {
			if(!isFile("recordings/recording" @ %i @ ".rec")) {
			  $recorderFileName = "recordings/recording" @ %i @ ".rec";
				if($recorderFileName != "False") {
					echo("File is named: recording",%i,".rec");
					return "True";
				}	
			}		
		}
	}
	echo("Couldn't setup File");
	return "False";	
}

function EnterLobbyMode()
{
   schedule("ELM();", 0);
}

function ELM()
{
   if($playingDemo)
   {
   	  Event::Trigger( eventPlaybackOver );
      setCursor(MainWindow, "Cur_Arrow.bmp");
      disconnect();
      startMainMenuScreen();
      GuiLoadContentCtrl(MainWindow, "gui/Recordings.gui");
   }
   else
   {
	   $InLobbyMode = true;
      GuiLoadContentCtrl(MainWindow, "gui/Lobby.gui");
      CursorOn(MainWindow);
   }
}

i also noticed that tribes will auto-equip the cg and gl on pickup, but not the disc. anyone know why?
 
elim i took ur script and slimmed it down a little bit. place in config/modules. (set bottomprint to false if you don't want it to bottomprint)
https://dl.dropboxusercontent.com/u/3172732/autonet.acs.cs
Code:
// bottom prints pft changes
$autonet::bottomprint = true;

Event::Attach(eventConnected, autonet::init);
Event::Attach(eventNextWeapon, autonet::update);
Event::Attach(eventPrevWeapon, autonet::update);
Event::Attach(eventUsedItem, autonet::update);
Event::Attach(eventItemReceived, autonet::update);

function autonet::init()
{
  // set defaults
  for (%i = 0; %i < 64; %i++) // how many item types are there anyway?
  {
    $autonet::terp[%i] = 64;
    $autonet::pft[%i] = 128;
    $autonet::pftMethod[%i] = 1;
  }

  // weapons: chaingun, disc launcher, grenade launcher, laser rifle, mortar, plasma gun, blaster
  $autonet::terp[GetItemType("chaingun")] = 0;
  $autonet::terp[GetItemType("disc launcher")] = 64;
  $autonet::terp[GetItemType("grenade launcher")] = 64;
  $autonet::pft[GetItemType("chaingun")] = 128;
  $autonet::pft[GetItemType("disc launcher")] = 128;
  $autonet::pft[GetItemType("grenade launcher")] = 128;
  $autonet::pftMethod[GetItemType("chaingun")] = 1;
  $autonet::pftMethod[GetItemType("disc launcher")] = 1;
  $autonet::pftMethod[GetItemType("grenade launcher")] = 1;
}

function autonet::update()
{
  %weapon = GetMountedItem(0);
  $net::interpolatetime = $autonet::terp[%weapon];
  $net::predictforwardtimemethod = $autonet::pftMethod[%weapon];
  $net::predictforwardtime = $autonet::pft[%weapon];

  if ($autonet::bottomprint)
    remoteBP(2048, "<JC>Terp: <F2>" ~ $net::interpolatetime ~ " <F1>PFT: <F2>" ~ $net::predictforwardtime, 1);
}

i also accidentally found that eventUsedItem and eventDropItem in misc.cs weren't passing the %type correctly. use this below if you use scripts which depend on those events. place in config/core:
https://dl.dropboxusercontent.com/u/3172732/Misc.cs
Code:
//----------------------------------------------------------------------------
// Client side convience scripts
//
function buy(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		remoteEval(2048,buyItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function markFavorites()
{
	// Currently done by the shell
}

function remoteSetInfoLine(%mgr, %lineNum, %text)
{
   if(%mgr != 2048)
      return;

	if (%lineNum == 1)
	{
		if (%text == "") Control::setVisible(InfoCtrlBox, FALSE);
		else Control::setVisible(InfoCtrlBox, TRUE);
	}

   Control::setText("InfoCtrlLine" @ %lineNum, %text);
}


function buyFavorites()
{
	// This function is invoked by the shell.
	for (%i = 0; %i < 20; %i = %i + 1) {
		if ($pref::itemFavorite[%i] != "") {
			%type = getItemType($pref::itemFavorite[%i]);
			if (%type != -1) {
				%list = %list @ "," @ %type;
			}
		}
	}
	if (%list != "") {
		eval("remoteEval(2048,buyFavorites" @ %list @ ");");
	}
}	

function sell(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		remoteEval(2048,sellItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function use(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
    echo("use: " @ %type);
		// The client useItem function will make sure the use is
		// sequenced correctly with trigger events.  The remoteEval
		// works fine but may be delivered out of order.
		// remoteEval(2048,useItem,%type);
		schedule("Event::Trigger(\"eventUsedItem\"," @ %type @ ");",1);
		useItem(%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}

}

function drop(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		schedule("Event::Trigger(\"eventDropItem\"," @ %type @ ");",1);
		remoteEval(2048,dropItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function throwStart()
{
	$throwStartTime = getSimTime();
}

function throwRelease(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		%delta = getSimTime() - $throwStartTime;
		if (%delta > 1)
			%delta = 100;
		else
			%delta = floor(%delta * 100);
		remoteEval(2048,throwItem,%type,%delta);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function deploy(%desc)
{
	%type = getItemType(%desc);
	if (%type != -1) {
		remoteEval(2048,deployItem,%type);
	}
	else {
		echo("Unknown item \"" @ %desc @ "\"");
	}
}

function nextWeapon()
{
	// Up to the server right now
	schedule("checkWeapon(\"Next\", "@$CheckWepNum++ @");", 1);
	remoteEval(2048,nextWeapon);
}	

function prevWeapon()
{
	// Up to the server right now
	schedule("checkWeapon(\"Prev\", "@$CheckWepNum++ @");", 1);
	remoteEval(2048,prevWeapon);
}

function checkWeapon(%type, %num) {
	if(%num == $CheckWepNum) {
		Event::Trigger("event"@ %type @"Weapon", GetMountedItem(0));
	}
}

function commandAck()
{
	// Placed here to avoid binding problems with gui.
	remoteEval(2048,CStatus,1,"Command Acknowledged~wacknow");
}

function commandDeclined()
{
	// Placed here to avoid binding problems with gui.
	remoteEval(2048,CStatus,0,"Unable to complete objective~wobjxcmp");
}

function CommandCompleted()
{
	// Placed here to avoid binding problems with gui.
	remoteEval(2048,CStatus,0,"Objective Completed~wobjcomp");
}

function targetClient()
{
   if($lastClientMessage)
   {
      if(Client::getTeam(getManagerId()) == Client::getTeam($lastClientMessage))
         %cmd = "Escort " @ Client::getName($lastClientMessage) @ ".~wescfr";
      else
         %cmd = "Attack " @ Client::getName($lastClientMessage) @ ".~wattway";
      remoteEval(2048, "IssueTargCommand", 0, %cmd, $lastClientMessage - 2048, getManagerId());
   }
}


function clearCenterPrint(%id)
{
   if(%id == $centerPrintId)
      Client::centerPrint("", 0);
}

function remoteITXT(%manager, %msg)
{
   if(%manager == 2048)
      Control::setValue(EnergyDisplayText, %msg);
}

function remoteCP(%manager, %msg, %timeout)
{
   if(%manager == 2048)
   {
      $centerPrintId++;
      if(%timeout)
         schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
      Client::centerPrint(%msg, 0);
   }
}

function remoteBP(%manager, %msg, %timeout)
{
   if(%manager == 2048)
   {
      $centerPrintId++;
      if(%timeout)
         schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
      Client::centerPrint(%msg, 1);
   }
}

function remoteTP(%manager, %msg, %timeout)
{
   if(%manager == 2048)
   {
      $centerPrintId++;
      if(%timeout)
         schedule("clearCenterPrint(" @ $centerPrintId @ ");", %timeout);
      Client::centerPrint(%msg, 2);
   }
}

function kill()
{
	remoteEval(2048,kill);
}	

function giveall()
{
	remoteEval(2048,giveall);
}

// Fear aliases
function setTeam(%team)
{
   remoteEval(2048, setTeam, %team);
}

function say(%channel, %message)
{
   remoteEval(2048, say, %channel, %message);
}

function mute(%playerName)
{
   remoteEval(2048, mute, 1, getClientByName(%playerName));
}

function unmute(%playerName)
{
   remoteEval(2048, mute, 0, getClientByName(%playerName));
}

function show()
{
   // redefine end frame script
   function Game::EndFrame()
   {
   }
   $Console::LastLineTimeout = 0;
   $Console::updateMetrics = false;
}
show();

function showTime()
{
   function Game::EndFrame()
   {
      echo("C: " @ getIntegerTime(false) @ "   S: " @ getIntegerTime(true));
   }
   $Console::LastLineTimeout = 1000;
   $Console::updateMetrics = false;
}

function showFPS()
{
   function Game::EndFrame()
   {
	   echo($ConsoleWorld::FrameRate);
   }
   $Console::LastLineTimeout = 1000;
   $Console::updateMetrics = false;
}

function changeLevel(%newLevel)
{
   remoteEval(2048, changeLevel, %newLevel);
}

function setArmor(%armorType)
{
   remoteEval(2048, setArmor, %armorType);
}

function voteYes()
{
   remoteEval(2048, VoteYes);
}

function voteNo()
{
   remoteEval(2048, VoteNo);
}

//editing functions

function winMouse()
{
   inputDeactivate(mouse0);
   windowsMouseEnable(MainWindow);
}

function dirMouse()
{
   inputActivate(mouse0);
   windowsMouseDisable(MainWindow);
}

function editGui() {
	winMouse();
	GuiInspect(MainWindow);
	//GuiToolbar(MainWindow);
	GuiEditMode(MainWindow);
	cursorOn(MainWindow);
	tree();
}

function tree()
{
	simTreeCreate(tree, MainWindow);
	simTreeAddSet(tree, manager);
}

function toggleMouse()
{
   if($flagMouseDirect = !$flagMouseDirect)
   {
      dirMouse();
   }
   else
   {
      winMouse();
   }
}

function remoteSetTime(%server, %time)
{
   if(%server == 2048)
      setHudTimer(%time);
}

function SADSetPassword(%password)
{
   remoteEval(2048, SetPassword, %password);
}

function ADSetTimeLimit(%time)
{
   remoteEval(2048, SetTimeLimit, %time);
}

function ADSetTeamInfo(%team, %teamName, %skinBase)
{
   remoteEval(2048, SetTeamInfo, %team, %teamName, %skinBase);
}

function remoteMODInfo(%server, %modString)
{
   if(%server == 2048)
   {
      $ServerModInfo = %modString;
      // if it is not "", 
      // show it on the loading gui
      if($ServerModInfo != "")
      {
         Control::setValue(ModTextString, "<jc><f1>NOTICE: This server has been modified\n<f0>" @ %modString);
      }
   }
}

function remoteFileURL(%server, %url)
{
   if(%server == 2048)
   {
      $ServerFileURL = %url;
      // if a disconnect occurs, pop this string up instead of error message
   }
}

function remoteMInfo(%server, %missionName)
{
   if(%server == 2048)
   {
      %file = "missions\\" @ %missionName @ ".dsc";
      $MDESC::Type = "";
      $MDESC::Text = "";
      if(File::findFirst(%file) != "")
         exec(%file);
      $ServerMission = %missionName;
      $ServerText = $MDESC::Text;
      $ServerMissionType = $MDESC::Type;
		if(isObject(LobbyGui))
			LobbyGui::onOpen();  // update lobby screen text.
   }
}

function remoteMissionChangeNotify(%serverManagerId, %nextMission)
{
   if(%serverManagerId == 2048)
   {
      cls();
      echo("Server mission complete - changing to mission: ", %nextMission);
      echo("Flushing Texture Cache");
      flushTextureCache();
      schedule("purgeResources(true);", 3);
   }
}

function dataGotBlock(%blockName, %pctDone)
{
   if(%pctDone < 0.1)
      %text = "Initializing Personal Digital Assistant...";
   else if(%pctDone < 0.2)
      %text = "Establishing uplink with satellite network...";
   else if(%pctDone < 0.3)
      %text = "Downloading navigational and topographical data...";
   else if(%pctDone < 0.4)
      %text = "Charging armor energy cell...";
   else if(%pctDone < 0.5)
      %text = "Pingback satellite uplink check...";
   else if(%pctDone < 0.6)
      %text = "Beginning primary weapons system check...";
   else if(%pctDone < 0.7)
      %text = "Beginning secondary weapons system check...";
   else if(%pctDone < 0.8)
      %text = "Downloading tactical information from tribal database...";
   else
      %text = "Starting armor power-up sequence...";

   //Control::setText(ProgressText, "Loading " @ %blockName @ " data...");
   Control::setValue(ProgressText, "<jc><f1>" @ %text);
   Control::setValue(ProgressSlider, %pctDone * 0.75);
}

function dataFinished()
{
   // called on client when all the dynamic data has
   // finished transfer.

   Control::setValue(ProgressText, "<jc><f0>Get ready to rock n' roll!");
   Control::setValue(ProgressSlider, 1);

   $dataFinished = true;
   remoteEval(2048, dataFinished);

   echo("Flushing Texture Cache");
   flushTextureCache();
}

function onClientGhostAlwaysDone()
{
   // preload the commander gui if it's not already loaded
   if(!isObject("CommandGui")) {
      exec("gui/command.gui.cs");
   }

   %temp = $pref::terrainTextureDetail;
   $pref::terrainTextureDetail = 1;
   echo( "rebuildCommandMap" );
   rebuildCommandMap();
   $pref::terrainTextureDetail = %temp;
   flushTextureCache();
   purgeResources(true);
   remoteEval(2048, "CGADone");

//   echo("Registering Static Textures");
//   RegisterStaticTextures(MainWindow);
}

function remoteSetMusic (%player, %track, %mode)
{
}

function setupRecorderFile(%fileName)
{
	if(%fileName != "" && %fileName != "False") {
		if(isFile("recordings/" @ %fileName)) 
			echo("Warning- " @ %fileName @ " File Already Exists");
		$recorderFileName = "recordings/" @ %fileName;
		if($recorderFileName != "False") {
			echo("File is named: ",%fileName);
			return "True";
		}	
 	}
	else {
		for(%i = 0; %i < 500; %i++) {
			if(!isFile("recordings/recording" @ %i @ ".rec")) {
			  $recorderFileName = "recordings/recording" @ %i @ ".rec";
				if($recorderFileName != "False") {
					echo("File is named: recording",%i,".rec");
					return "True";
				}	
			}		
		}
	}
	echo("Couldn't setup File");
	return "False";	
}

function EnterLobbyMode()
{
   schedule("ELM();", 0);
}

function ELM()
{
   if($playingDemo)
   {
   	  Event::Trigger( eventPlaybackOver );
      setCursor(MainWindow, "Cur_Arrow.bmp");
      disconnect();
      startMainMenuScreen();
      GuiLoadContentCtrl(MainWindow, "gui/Recordings.gui");
   }
   else
   {
	   $InLobbyMode = true;
      GuiLoadContentCtrl(MainWindow, "gui/Lobby.gui");
      CursorOn(MainWindow);
   }
}

i also noticed that tribes will auto-equip the cg and gl on pickup, but not the disc. anyone know why?


for (%i = 0; %i < 64; %i++) // how many item types are there anyway?
->
Code:
function loopItems(){
	%i = 0;
	%sup = GetItemdesc(%i);
	while(%sup != "")
	{
		echoc(1, %sup,  " (", getItemType(%sup),  ") ");
		%i++;
		%sup = GetItemdesc(%i);
	}
}
 
Dammit, I am total noob when it comes to this stuff. Do I copy that code, put it into a notepad or whatever, save it as a .acs.cs, put that into my modules folder and it should work? And how the hell do I bind my left mouse button to fire? It is still set in my binds in-game.
 
Rofl! Sorry, got it to work. No idea what that will do but I once erased command.exe on my dads computer when i was 8 trying to make room for doom 95. From then on, I havent done much without any explanation or research ;)
 
Back
Top