| string | refers to any single or double quoted collection of characters that can include both numbers and text |
| boolean | refers to a numeric value of either 1 or 0 (1 being TRUE and 0 being FALSE) |
| numeric | refers to any intrinsic numeric data type (whole number, boolean, decimal number and or a hexadecimal number) |
| global | variable refers to a variable that is accessible from within any function or script |
| local variable | refers to a variable that is only accessible within the function or script it is created |
| variable | refers to any string that begins with a percent sign (%) denoting a local variable or dollar sign ($) denoting a global variable |
| tagged string | Tagged strings is used for any string constant that is transmitted across a connection. The entire tagged string is sent only once, when referenced a short tag (numeric value) identifying that string is sent instead of the entire string. |
Assignment operators | |
| = | Assigns the value of the second operand to the first operand. |
Mathematical Operators: | |
| + | (Addition) Adds 2 numbers |
| - | (subtraction) Subtracts the value of its argument. |
| * | (Multiplication) Multiplies 2 numbers. |
| / | (Division) Divides 2 numbers. |
| % | (Modulus) Computes the integer remainder of dividing 2 numbers. |
| += | Adds 2 numbers and assigns the result to the first. |
| -= | Subtracts 2 numbers and assigns the result to the first. |
| *= | Multiplies 2 numbers and assigns the result to the first. |
| /= | Divides 2 numbers and assigns the result to the first. |
| %= | Computes the modulus of 2 numbers and assigns the result to the first. |
| ++ | (Increment) Adds one to a variable representing a number (returning either the new or old value of the variable) |
| -- | (Decrement) Subtracts one from a variable representing a number (returning either the new or old value of the variable) |
Bitwise Operators: | |
| ~ | (Bitwise NOT) Flips the bits of its operand. |
| | | (Bitwise OR) Returns a one in a bit if bits of either operand is one. |
| & | (Bitwise AND) Returns a one in each bit position if bits of both operands are ones. |
| ^ | (Bitwise XOR) Returns a one in a bit position if bits of one but not both operands are one. |
| << | (Left shift) Shifts its first operand in binary representation the number of bits to the left specified in the second operand, shifting in zeros from the right. |
| >> | (Sign-propagating right shift) Shifts the first operand in binary representation the number of bits to the right specified in the second operand, discarding bits shifted off. |
| |= | Performs a bitwise OR and assigns the result to the first operand. |
| &= | Performs a bitwise AND and assigns the result to the first operand. |
| ^= | Performs a bitwise XOR and assigns the result to the first operand. |
| <<= | Performs a left shift and assigns the result to the first operand. |
| >>= | Performs a sign-propagating right shift and assigns the result to the first operand. |
String operators:: | |
| @ | Concatenates one or more values together to form a new value |
| NL | Concatenates one value together with a new line to form a new value |
| TAB | Concatenates one value together with a tab to form a new value |
| SPC | Concatenates one value together with a space to form a new value |
Logical Operators: | |
| ! | evaluates the opposite of the value specified |
| && | requires both values to be true for the result to be true. |
| || | requires only one value to be true for the result to be true. |
Relational Operators: | |
| == | value1 and value2 are equal |
| != | value1 and value2 are not equal |
| < | value1 is less than value2 |
| > | value1 is greater than value2 |
| <= | value1 is less than or equal to value2 |
| >= | value1 is greater than or equal to value2 |
String comparison Operators: | |
| $= | string1 is equal to string2 |
| !$= | string1 is not equal to string2 |
if(!OpenALInitDriver())
error(" Failed to initialize driver.");
function OpenALShutdown()
{
OpenALShutdownDriver()
}
function OpenALRegister()
{
OpenALRegisterExtensions();
}
function OptAudioUpdate()
{
// set the driver text
%text = "Vendor: " @ alGetString("AL_VENDOR") @
"\nVersion: " @ alGetString("AL_VERSION") @
"\nRenderer: " @ alGetString("AL_RENDERER") @
"\nExtensions: " @ alGetString("AL_EXTENSIONS");
OptAudioInfo.setText(%text);
}
function OptAudioUpdateMasterVolume(%volume)
{
if (%volume == $pref::Audio::masterVolume)
return;
alxListenerf(AL_GAIN_LINEAR, %volume)
$pref::Audio::masterVolume = %volume;
if (!alxIsPlaying($AudioTestHandle))
{
$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));
alxPlay($AudioTestHandle);
}
}
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %x, %y, %z);
alxSourcei($ClientChatHandle[%sender], "AL_PITCH", %pitch);
%pitch = alxGetSourcef(($ClientChatHandle[%sender], "AL_PITCH");
%pitch = alxGetSourcef(($ClientChatHandle[%sender], "AL_PITCH");
%pitch = alxGetSourcef(($ClientChatHandle[%sender], "AL_PITCH");
function OptAudioUpdateChannelVolume(%channel, %volume)
{
if (%channel < 1 || %channel > 8)
return;
if (%volume == $pref::Audio::channelVolume[%channel])
return;
alxSetChannelVolume(%channel, %volume);
$pref::Audio::channelVolume[%channel] = %volume;
if (!alxIsPlaying($AudioTestHandle))
{
$AudioTestHandle = alxCreateSource("AudioChannel"@%channel, expandFilename("~/data/sound/testing.wav"));
alxPlay($AudioTestHandle);
}
}
if ( $ClientChatHandle[%sender] != 0 )
alxStop( $ClientChatHandle[%sender] );
function clientCmdMissionEnd(%seq,%player)
{
// Recieved when the current mission is ended.
alxStopAll();
}
if (!alxIsPlaying($AudioTestHandle))
{
$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));
alxPlay($AudioTestHandle);
}
function OpenALInit()
{
OpenALShutdownDriver();
echo("");
echo("OpenAL Driver Init:");
echo ($pref::Audio::driver);
if($pref::Audio::driver $= "OpenAL")
if(!OpenALInitDriver())
error(" Failed to initialize driver.");
echo(" Vendor: " @ alGetString("AL_VENDOR"));
echo(" Version: " @ alGetString("AL_VERSION"));
echo(" Renderer: " @ alGetString("AL_RENDERER"));
echo(" Extensions: " @ alGetString("AL_EXTENSIONS"));
alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
for (%channel=1; %channel <= 8; %channel++)
alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);
echo("");
}
function OpenALInit()
{
OpenALShutdownDriver();
echo("");
echo("OpenAL Driver Init:");
echo ($pref::Audio::driver);
if($pref::Audio::driver $= "OpenAL")
if(!OpenALInitDriver())
error(" Failed to initialize driver.");
echo(" Vendor: " @ alGetString("AL_VENDOR"));
echo(" Version: " @ alGetString("AL_VERSION"));
echo(" Renderer: " @ alGetString("AL_RENDERER"));
echo(" Extensions: " @ alGetString("AL_EXTENSIONS"));
alxListener3f( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
for (%channel=1; %channel <= 8; %channel++)
alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);
echo("");
}
%LinearGain = alxGetListenerf(AL_GAIN_LINEAR);
%LinearGain = alxGetListenerf(AL_GAIN_LINEAR);
%LinearGain = alxGetListenerf(AL_GAIN_LINEAR);
$pref::Audio::channelVolume[%channel] = alxGetChannelVolume(%channel);
alxSetChannelVolume(%channel, %volume);
dumpConsoleClasses()
$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));
if ( strcmp( %name, %rawName ) == 0 ) return false;
< 0 "one" is less than "two". 0 "one" is equal to "two". > 0 "one" is greater than "two" if ( stricmp( %name, %rawName ) == 0 ) return false;
%StringLength = strlen(%player.ShapeName);
%pos = strstr( %action, "pov" );
if (%hasNextArg && strpos(%nextArg, "-") == -1)
{
$showShapeList = $showShapeList @ " " @ %nextArg;
$argUsed[%i+1]++;
%i++;
}
%trimed = ltrim(%value);
%trimed = rtrim(%value);
%trimed = trim(%value");
%striped = stripChars(%value, "~" );
%var = strlwr(%value);
%var = strupr(%value);
%var = strchr(%vale, "~" );
%var = strreplace(%value, "~", "-");
function serverCmdTeamMessageSent(%client, %text)
{
if(strlen(%text) >= $Pref::Server::MaxChatLen)
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
chatMessageTeam(%client, %client.team, '\c3%1: %2', %client.name, %text);
}
function TerrainEditor::offsetBrush(%this, %x, %y)
{
%curPos = %this.getBrushPos();
%this.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y);
}
%pos = getWords(%obj.getTransform(), 0, 2);
function WorldEditor::dropCameraToSelection(%this)
{
if(%this.getSelectionSize() == 0)
return;
%pos = %this.getSelectionCentroid();
%cam = LocalClientConnection.camera.getTransform();
// set the pnt
%cam = setWord(%cam, 0, getWord(%pos, 0));
%cam = setWord(%cam, 1, getWord(%pos, 1));
%cam = setWord(%cam, 2, getWord(%pos, 2));
LocalClientConnection.camera.setTransform(%cam);
}
%cam = removeWord(%cam, 0, getWord(%pos, 0));
if ( %pos != -1 )
{
%wordCount = getWordCount( %action );
%mods = %wordCount > 1 ? getWords( %action, 0, %wordCount - 2 ) @ " " : "";
%object = getWord( %action, %wordCount - 1 );
switch$ ( %object )
{
case "upov": %object = "POV1 up";
case "dpov": %object = "POV1 down";
case "lpov": %object = "POV1 left";
case "rpov": %object = "POV1 right";
case "upov2": %object = "POV2 up";
case "dpov2": %object = "POV2 down";
case "lpov2": %object = "POV2 left";
case "rpov2": %object = "POV2 right";
default: %object = "??";
}
return( %mods @ %object );
}
else
error( "Unsupported Joystick input object passed to getDisplayMapName!" );
}
function SM_StartMission()
{
%id = SM_missionList.getSelectedId();
%mission = getField(SM_missionList.getRowTextById(%id), 1);
if ($pref::HostMultiPlayer)
%serverType = "MultiPlayer";
else
%serverType = "SinglePlayer";
createServer(%serverType, %mission);
localConnect($pref::Player::Name);
}
%fields = getFields((SM_missionList.getRowTextById(%id), 1, 3 );
function PlayerListGui::updateScore(%this,%clientId,%score)
{
%text = PlayerListGuiList.getRowTextById(%clientId);
%text = setField(%text,1,%score);
PlayerListGuiList.setRowById(%clientId, %text);
PlayerListGuiList.sortNumerical(1);
}
function removeFromServerGuidList( %guid )
{
%count = getFieldCount( $Server::GuidList );
for ( %i = 0; %i < %count; %i++ )
{
if ( getField( $Server::GuidList, %i ) == %guid )
{
$Server::GuidList = removeField( $Server::GuidList, %i );
return;
}
}
// Huh, didnt find it.
}
%count = getFieldCount($Server::GuidList);
function Texture::saveMaterial()
{
%id = $selectedMaterial;
if (%id == -1)
return;
Texture::SaveOperation();
%data = Texture_Material.getRowTextById(%id);
%newData = getRecord(%data,0);
%rowCount = Texture_Operation.rowCount();
for (%row=0; %row<%rowCount; %row++)
%newdata = %newdata @ "\n" @ Texture_Operation.getRowText(%row);
Texture_Material.setRowById(%id, %newdata);
Texture::save();
}
%data = Texture_Material.getRowTextById(%id); %records = getRecords(%data,1,3);
%data = Texture_Material.getRowTextById(%id); %replaced = setRecord(%data,3,"foo");
%data = Texture_Material.getRowTextById(%id); %replaced = removeRecord(%data,3);
%data = Texture_material.getRowTextById(%id); Texture_operation.clear(); %recordCount = getRecordCount(%data);
// a target in range was found so select it
if (%scanTarg)
{
%targetObject = firstWord(%scanTarg);
%client.setSelectedObj(%targetObject);
}
function Heightfield::showTab(%id)
{
Heightfield::hideTab();
%data = restWords(Heightfield_operation.getRowTextById(%id));
%tab = getField(%data,1);
echo("Tab data: " @ %data @ " tab: " @ %tab);
%tab.setVisible(true);
}
function isNameUnique(%name)
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%test = ClientGroup.getObject( %i );
%rawName = stripChars( detag( getTaggedString( %test.name ) ), "\cp\co\c6\c7\c8\c9" );
if ( strcmp( %name, %rawName ) == 0 )
return false;
}
return true;
}
%tag = getTag(%variable);
echo( "This will be printed to the console");
warn("Warning, this will be printed to the console");
error("Error Will Rogers, Error!");
%expanded = expandEscape(%variable);
%colapsed = collapseEscape(%variable);
quit();
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%tag = getWord(%msgType, 0);
for(%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
if(%tag !$= "")
for(%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
if( compile("/fps/client/scripts/script.cs") )
echo("Compile success");
if( exec("/fps/client/scripts/script.cs"))
echo("exec success");
echo("Exporting server prefs");
export("$Pref::Server::*", "./server/prefs.cs", False);
deleteVariables(*);
trace(1);
debug();
findFirstFile("/fps", "*.cs");
findNextFile("/fps", "*.cs");
getFileCount("/fps/client/scripts", "*.cs");
getFileCRC("/fps/client/scripts/script/cs");
isFile("/fps/client/scripts/script.cs");
isWriteableFileName("/fps/client/scripts/script.cs");
fileExt("script.cs"); // will return ".cs" as a string
fileBase("/fps/client/scripts/script.cs"); // will return "fps/client/scripts/script" as a string
fileName("scripts.cs"); // will return "scripts" as a string
filePath("/fps/client/scripts/script.cs"); // Will return "fps/client/scripts/" as a string
nextToken("A,E,I,O,U", voul, ";");
//First pass vould would be equal to A, the next iteration would set vould to E, then I then O and finaly U.
SetLogMode(1);
setEchoFileLoads(1);
backtrace();
isPackage(Show);
activatePackage(Show);
deactivePackage(Show);
nameToId(%player);
isObject(%player);
// if centerprint already visible, reset text and time.
if ($centerPrintActive) {
if (centerPrintDlg.removePrint !$= "")
cancel(centerPrintDlg.removePrint);
}
$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");
if( isEventPending($Game::Schedule) )
echo("got a pending event");
$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");
deleteDataBlocks();
telnetSetParameters(4123, "Garage", "Games");
dbgSetParameters(1130, "morbid");
dnetSetLogging(1);
setNPatch(1, 1);
toggleNPatch();
increaseNPatch();
decreaseNPatch(): setFSAA See setNPatch() IncreaseFSAA See increaseNPatch() decreaseFSAA See decreaseNPatch()
setOpenGlMipReduction(2);
setOpenGlMipReduction(2);
setOpenGLInteriorMipReduction(2);
setOpenGLTextureCompressionHint(GL_NICEST);
setOpenGLAnisotropy(0);
// Dump anything we're not using clearTextureHolds();
addMaterialMapping( "sand" , "sound: 0" , "color: 0.46 0.36 0.26 0.4 0.0" );
aiConnect(1);
aiAddPlayer("BotBoy");
%coverage = calcExplosionCoverage(%position, %targetObject,
$TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType |
$TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType);
if (%coverage == 0)
continue;
gotoWebPage("http://www.garagegames.com");
deactivateDirectInput();
activateDirectInput();
%name = stripTrailingSpaces( strToPlayerName( %name ) );
%name = stripTrailingSpaces( strToPlayerName( %name ) );
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );
setFov( $Pref::player::CurrentFOV );
screenShot("MyScreen");
panoramaScreenShot("WideEyedScreenShot");
purgeResources();
if (lightScene("sceneLightingComplete", ""))
{
error("Lighting mission....");
schedule(1, 0, "updateLightingProgress");
onMissionDownloadPhase3(%missionName);
$lightingMission = true;
}
flushTextureCache();
dumpTextureStats();
dumpResourceStats();
%player.getControlObjectAltitude();
%player.getControlObjectSpeed();
snapToggle();
echo("Version Number: " @ getVersionNumber() );
echo("Version Number: " @ getVersionNumber() );
function aboutDlg::onWake(%this)
{
%text="Torque Game Engine Test Application\n( v1.1.1 )\n"@
""@ getCompileTimeString() @", "@ getBuildString() @"Build\n\n"@
"Copyright (c) 2001 GarageGames.Com\n"@
"Portions Copyright (c) 2001 by Sierra Online, Inc.\n\n"@
"";
aboutText.setText(%text);
}
function aboutDlg::onWake(%this)
{
%text="Torque Game Engine Test Application\n( v1.1.1 )\n"@
""@ getCompileTimeString() @", "@ getBuildString() @"Build\n\n"@
"Copyright (c) 2001 GarageGames.Com\n"@
"Portions Copyright (c) 2001 by Sierra Online, Inc.\n\n"@
"";
aboutText.setText(%text);
}
function timeMetricsCallback()
{
return fpsMetricsCallback() @
" Time -- " @
" Sim Time: " @ getSimTime() @
" Mod: " @ getSimTime() % 32;
}
echo("Time in milliseconds: " @ getRealTime() );
function portInit(%port)
{
%failCount = 0;
while(%failCount < 10 && !setNetPort(%port)) {
echo("Port init failed on port " @ %port @ " trying next port.");
%port++; %failCount++;
}
}
function cursorOff()
{
if ( $cursorControlled )
lockMouse(true);
Canvas.cursorOff();
}
rebuildModPaths();
// Set the mod path which dictates which directories will be visible // to the scripts and the resource engine. $modPath = pushback($userMods, $baseMods, ";"); setModPaths($modPath);
$modPath = getModPaths();
if (!createCanvas(%windowName)){
quit();
return;
}
//--------------------
case "-jSave":
$argUsed[$i]++;
if ($hasNextArg)
{
echo("Saving event log to journal: " @ $nextArg);
saveJournal($nextArg);
$argUsed[$i+1]++;
$i++;
}
else
error("Error: Missing Command Line argument. Usage: -jSave ");
//--------------------
case "-jPlay":
$argUsed[$i]++;
if ($hasNextArg)
{
playJournal($nextArg,false);
$argUsed[$i+1]++;
$i++;
}
else
error("Error: Missing Command Line argument. Usage: -jPlay ");
// Tag the name with the "smurf" color:
%client.nameBase = %name;
%client.name = addTaggedString("\cp\c8" @ %name @ "\co");
removeTaggedString(%client.name);
%name = getTaggedString( %client.name );
%MyTagedString = builtTaggedString(%client.name, %string);
function SADSetPassword(%password)
{
commandToServer('SADSetPassword', %password);
}
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
//see if the client has muted the sender
if ( !%client.muted[%sender] )
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
// Make sure the network port is set to the correct pref.
portInit($Pref::Server::Port);
allowConnections(true);
connect(ip:192.168.0.1:4123);
//----------------------------------------
function SM_StartMission()
{
%id = SM_missionList.getSelectedId();
%mission = getField(SM_missionList.getRowTextById(%id), 1);
if ($pref::HostMultiPlayer)
%serverType = "MultiPlayer";
else
%serverType = "SinglePlayer";
createServer(%serverType, %mission);
localConnect($pref::Player::Name);
}
startRecord(MyNiftyDemo);
stopRecord();
playDemo(MyNiftyDemo);
if( isDemoRecording())
echo("Can only record one demo at a time"):
msg(%someObject, somemessage);
function JoinServerGui::query(%this)
{
queryMasterServer(
28000, // lanPort for local queries
0, // Query flags
$Client::GameTypeQuery, // gameTypes
$Client::MissionTypeQuery, // missionType
0, // minPlayers
100, // maxPlayers
0, // maxBots
2, // regionMask
0, // maxPing
100, // minCPU
0 // filterFlags
);
}
function JoinServerGui::cancel(%this)
{
cancelServerQuery();
}
function JoinServerGui::stop(%this)
{
stopServerQuery();
}
if ($pref::Net::DisplayOnMaster !$= "Never" )
schedule(0,0,startHeartbeat);
function destroyServer()
{
$Server::ServerType = "";
$missionRunning = false;
allowConnections(false);
stopHeartbeat();
}
//----------------------------------------
function JoinServerGui::update(%this)
{
// Copy the servers into the server list.
JS_queryStatus.setVisible(false);
JS_serverList.clear();
%sc = getServerCount();
}
//----------------------------------------
function JoinServerGui::join(%this)
{
cancelServerQuery();
%id = JS_serverList.getSelectedId();
// The server info index is stored in the row along with the
// rest of displayed info.
%index = getField(JS_serverList.getRowTextById(%id),6);
if (setServerInfo(%index)) {
connect($ServerInfo::Address,$Client::Password,$pref::Player::Name);
}
}
// Copy saved script prefs into C++ code. setShadowDetailLevel( $pref::shadows ); setDefaultFov( $pref::Player::defaultFov ); setZoomSpeed( $pref::Player::zoomSpeed );
command = "getLoadFilename(\"*.dts\", showShapeLoad);";
command = "getLoadFilename(\"*.dsq\", showSequenceLoad);";
showMoveMap.bind(keyboard, z, showTurnLeft);
showMoveMap.bind(keyboard, x, showTurnRight);
showUpdateThreadControl();
showSelectSequence();
command = "showPlay(threadList.getValue());";
command = "showStop(threadList.getValue());";
new GuiTextEditCtrl(showScale)
{
profile = "GuiTextEditProfile";
position = "80 20";
extent = "50 20";
altCommand = "showSetScale(threadList.getValue(),showScale.getValue()); Canvas.popDialog(TSShowEditScale);";
}
showSetPos(threadList.getValue(),showScale.getValue());
command = "showNewThread();";
command = "showDeleteThread(threadList.getValue());";
command = "showToggleRoot();";
command = "showToggleStick();";
command = "showSetCamera(true); showSetKeyboard(false);";
command = "showSetCamera(true); showSetKeyboard(false);";
new GuiButtonCtrl ()
{
profile = "GuiButtonProfile";
position = "40 330";
extent = "60 20";
text = "Set Direction";
command = "showSetLightDirection();";
};
function showToggleDetail()
{
if ($showAutoDetail)
{
showDetailText.setValue("Slider Sets Detail Level");
showSetDetailSlider();
$showAutoDetail = false;
}
else
{
showDetailText.setValue("Auto Detail Using Distance");
$showAutoDetail = true;
}
}
function PlayerListGui::update
(%this,%clientId,%name,%isSuperAdmin,%isAdmin,%isAI,%score)
{
// Build the row to display. The name can have ML control tags,
// including color and font. Since we're not using and
// ML control here, we need to strip them off.
%tag = %isSuperAdmin? "[Super]":
(%isAdmin? "[Admin]":
(%isAI? "[Bot]":
""));
%text = StripMLControlChars(%name) SPC %tag TAB %score;
}
function cycleDebugRenderMode(%val)
{
if (!%val)
return;
if($MFDebugRenderMode == 0)
{
// Outline mode, including fonts so no stats
$MFDebugRenderMode = 1;
GLEnableOutline(true);
}
else if ($MFDebugRenderMode == 1)
{
// Interior debug mode
$MFDebugRenderMode = 2;
GLEnableOutline(false);
setInteriorRenderMode(7);
showInterior();
}
else if ($MFDebugRenderMode == 2)
{
// Back to normal
$MFDebugRenderMode = 0;
setInteriorRenderMode(0);
GLEnableOutline(false);
show();
}
}
setInteriorFocusedDebug();
isPointInside("143 34 567");
%muzzleVelocity = VectorAdd(
VectorScale(%muzzleVector, %projectile.muzzleVelocity),
VectorScale(%objectVelocity, %projectile.velInheritFactor));
// Apply the impulse
if (%impulse) {
%impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
%impulseVec = VectorNormalize(%impulseVec);
%impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
%targetObject.applyImpulse(%position, %impulseVec);
}
// Apply the impulse
if (%impulse) {
%impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
%impulseVec = VectorNormalize(%impulseVec);
%impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
%targetObject.applyImpulse(%position, %impulseVec);
}
// Apply the impulse
if (%impulse) {
%impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
%impulseVec = VectorNormalize(%impulseVec);
%impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
%targetObject.applyImpulse(%position, %impulseVec);
}
// Add a vertical component to give the object a better arc
%verticalForce = %throwForce / 2;
%dot = vectorDot("0 0 1",%eye);
%vecCross = vectorCross("x y z","x y z");
%disatance = vectorDist(vector1,vector2);
%length = vectorLen(vector);
%ortho = vectorOrthoBasis("x y z angle");
%mat = matrixCreate("x y z", "x y z angle");
%newMatrix = matrixMultiply(matrix1,matrix2);
%daMatrix = matrixMulVector(matrix,vector);
%daMatrix = matrixMulPoint(matrix,point);
// Set the object's position and initial velocity %pos = getBoxCenter(%this.getWorldBox());
function initCommon()
{
// All mods need the random seed set
setRandomSeed();
// Very basic functions used by everyone
exec("./client/canvas.cs");
exec("./client/audio.cs");
}
%seed = getRandomSeed();
%random = getRandom(34,176);
%daMatrix = MatrixCreateFromEuler("x y z");
%quad = mSolveQuadratic(a,b,c);
%cube = mSolveCubic(a,b,c,d);
%quartic = mSolveQuartic(a,b,c,d,e);
%pageLines = mFloor(%chatScrollHeight / %textHeight);
if (%pageLines <= 0)
%pageLines = 1;
%min = mCeil(%chatScrollHeight / %textHeight);
%newFloat = mFloatLength((7/3),5);
%abs = mAbs(76.3);
%sqrt = mSqrt(69);
%pow = mPow(2,4);
%log = mLog(7654.98);
%sin = mSin(65);
%cos = mCos(69);
%tan = mTan(87.6);
%asin = mAsin(-3,8);
%acos = mAcos(-8,3);
%atan = mAtan(-10,3);
%r2d = mRadToDeg(5);
%c2r = mDegToRad(171);
ValidateMemory();
FreeMemoryDump();
dumpMemSnapshot(memdump.txt);
redbookOpen();
redbookClose();
redbookPlay(2);
redbookStop();
%tracks = redbookGetTrackCount();
%volume = redbookGetVolume();
redbookSetVolume(%volume);
%count = redbookGetDeviceCount();
echo("Red Book (whats that?) device name :" @ redbookGetDeviceName(1) );
echo("RedBook (whats that?) last known error :" @ redbookGetLastError() );
videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
function optionsDlg::applyGraphics( %this )
{
%newDriver = OptGraphicsDriverMenu.getText();
%newRes = OptGraphicsResolutionMenu.getText();
%newBpp = OptGraphicsBPPMenu.getText();
%newFullScreen = OptGraphicsFullscreenToggle.getValue();
if ( %newDriver !$= $pref::Video::displayDevice )
{
setDisplayDevice( %newDriver, firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
//OptionsDlg::deviceDependent( %this );
}
else
setScreenMode( firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
}
setScreenMode( firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
toggleFullScreen();
if(isFullScreen())
echo("We be full screened!");
if(!switchBitDepth())
echo("Unable to switch screen bpp");
if(!prevResolution ())
echo("Unable to switch screen resolution");
if(!nextResolution ())
echo("Unable to switch screen resolution");
%res = getResolution():
if(!setResolution(640,480,32);)
echo("Unable to set resolution to 640x480x32");
echo("Display Device(s) :" @ getDisplayDeviceList() );
echo("Possible resolutions :" @ getResolutionList(%device) );
echo("Device driver info :" @ getVideroDriverInfo() );
if(isDeviceFullScreenOnly(%devicename) )
echo("You are limited to fullscreen mode only!"):
if(!setVerticalSync(1) )
echo("Unable to enable Vertical Sync for your video device");
profilerMarkerEnable(mark,true);
profilerEnable(false);
profilerDump();
profileDumpToFile(dump.txt);
case "-console":
enableWinConsole(true);
$argUsed[$i]++;
if(!isJoystickDetected())
echo("No Joystick was detected");
%joyAxes = getJoystickAxes( 3 );
enableMouse();
disableMouse();
permDisableMouse();
echoInputState();
toggleInputState();
MathInit(detect);
%res = getDesktopResolution():
if(activateKeyboard())
echo("Keyboard has been activated");
deactivateKeyboard();
GLEnableLoggin(true);
GLEnableOutline(true);
GLEnableMetrics(1);
inputLog(DI.log);
launchDedicatedServer(mymission,damap,0);
if(isKoreanBuild())
echo("Silly Korean Build!");
debug_testx86unixmutex();
debug_debugbreak();
resetLighting();
%maxFrameAlloc = getMaxFrameAllocation();
dumpNetStringTable();
InitContainerRadiusSearch ("0 450 76", %somerad, %somemask)
while(ContainerSearchNext() != -1 )
{
}
%dist = ContainerSearchCurrDist();
%rad = ContainerSearchCurrRadiusDist();
// Search for objects within the range that fit the masks above
// If we are in first person mode, we make sure player is not selectable by setting fourth parameter (exempt
// from collisions) when calling ContainerRayCast
%player = %client.player;
if ($firstPerson)
{
%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %searchMasks, %player);
}
else //3rd person - player is selectable in this case
{
%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %searchMasks);
}
pathOnMissionLoadDone();
%TerHeight = getTerrainHeight(%pos);