* Took Philip's advice and made all local GUI variables actually local using var.

* Added a simple "Game is Paused" text message to the Pause hotkey.

This was SVN commit r3672.
This commit is contained in:
Acumen
2006-03-21 22:30:29 +00:00
parent f45c44ca09
commit 8dd3a61a3a
19 changed files with 211 additions and 261 deletions
@@ -4,15 +4,15 @@
<objects>
<!--
==========================================
- INCLUDE SCRIPT - UTILITY FUNCTIONS
==========================================
-->
<!--
==========================================
- INCLUDE SCRIPT - UTILITY FUNCTIONS
==========================================
-->
<script file="gui/test/functions_utility.js" />
<script file="gui/test/functions_utility_list.js" />
<script file="gui/test/functions_utility_list.js" />
<script file="gui/test/functions_utility_object.js" />
@@ -102,10 +102,10 @@
>
<action on="Load"><![CDATA[
// Get list of profile names (profile folders).
profileArray = buildFileList("profiles/", "user.cfg", true);
var profileArray = buildFileList("profiles/", "user.cfg", true);
// Populate profile list.
for (profileIndex = 0; profileIndex < profileArray.length; profileIndex++)
for (var profileIndex = 0; profileIndex < profileArray.length; profileIndex++)
{
// Remove path/file information so only profile name remains.
profileArray[profileIndex] = profileArray[profileIndex].replace ("profiles/", "");
@@ -245,10 +245,10 @@
>
<action on="Press"><![CDATA[
// Get credits text.
creditsArray = readFileLines("gui/text/credits.txt");
var creditsArray = readFileLines("gui/text/credits.txt");
// Populate credits list.
for (creditsIndex = 0; creditsIndex < creditsArray.length; creditsIndex++)
for (var creditsIndex = 0; creditsIndex < creditsArray.length; creditsIndex++)
{
// Add credit row to the end of the object's list.
pushItem ("pgCredits", creditsArray[creditsIndex]);
@@ -54,15 +54,6 @@
]]></action>
</object>
<!-- EMPTY OBJECT USED TO PAUSE/UNPAUSE GAME. -->
<object name="snPause"
hotkey="pause"
>
<action on="Press"><![CDATA[
setPaused( !isPaused() );
]]></action>
</object>
<!-- GROUP: MINIMAP -->
<object name="snMiniMap"
hotkey="session.minimap.toggle"
@@ -98,14 +89,14 @@
<object name="snMiniMapButtonArc_Up" style="snMiniMapArcUp" type="button"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snMiniMapBorder");
var currCrd = getCrd ("snMiniMapBorder");
addCrds (this.name, 100, 100, currCrd.coord[rb].x+currCrd.coord[rb].width-32, currCrd.coord[rb].y+currCrd.coord[rb].height-83, 25, 52);
]]></action>
</object>
<object name="snMiniMapButtonArc_Left" style="snMiniMapArcLeft" type="button"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snMiniMapBorder");
var currCrd = getCrd ("snMiniMapBorder");
addCrds (this.name, 100, 100, currCrd.coord[rb].x+currCrd.coord[rb].width-83, currCrd.coord[rb].y+currCrd.coord[rb].height-32, 52, 25);
]]></action>
</object>
@@ -115,10 +106,10 @@
>
<action on="Load"><![CDATA[
// Seek through this group of buttons (determining length from last object's name).
max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (loop = 1; loop <= max; loop++)
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (var loop = 1; loop <= max; loop++)
{
tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
// Set size/position.
if (loop == 1)
{
@@ -141,7 +132,7 @@
currCrd.coord[rb].height);
}
// Set object properties.
tempObject = getGUIObjectByName (tempName);
var tempObject = getGUIObjectByName (tempName);
switch (loop)
{
case 1:
@@ -168,14 +159,14 @@
>
<action on="Load"><![CDATA[
// Seek through this group of buttons (determining length from last object's name).
max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (loop = 1; loop <= max; loop++)
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (var loop = 1; loop <= max; loop++)
{
tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
// Set size/position.
if (loop == 1)
{
currCrd = getCrd ("snMiniMapBorder");
var currCrd = getCrd ("snMiniMapBorder");
addCrds (tempName,
100, 100,
currCrd.coord[rb].x,
@@ -185,7 +176,7 @@
}
else
{
currCrd = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop - 1));
var currCrd = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop - 1));
addCrds (tempName,
100, 100,
currCrd.coord[rb].x+currCrd.coord[rb].width+1,
@@ -194,7 +185,7 @@
currCrd.coord[rb].height);
}
// Set object properties.
tempObject = getGUIObjectByName (tempName);
var tempObject = getGUIObjectByName (tempName);
switch (loop)
{
case 1:
@@ -248,11 +239,11 @@
>
<action on="Load"><![CDATA[
// Seek through this group of buttons (determining length from last object's name).
max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (loop = 1; loop <= max; loop++)
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (var loop = 1; loop <= max; loop++)
{
// Get name of current object in group.
tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
// Create coordinates for object (the actual coordinates are refreshed when the
// resource is updated, so at this point we don't sweat that they have the same
// coordinates).
@@ -284,11 +275,11 @@
>
<action on="Load"><![CDATA[
// Seek through this group of buttons (determining length from last object's name).
max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (loop = 1; loop <= max; loop++)
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
for (var loop = 1; loop <= max; loop++)
{
// Get name of current object in group.
tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
// Create coordinates for object (the actual coordinates are refreshed when the
// resource is updated, so at this point we don't sweat that they have the same
// coordinates).
@@ -299,6 +290,26 @@
</object>
</object>
<!-- PAUSE/UNPAUSE GAME TITLE. -->
<object name="snPause"
type="button"
font="prospero18b"
hidden="true"
hotkey="pause"
text_align="center"
text_valign="center"
textcolor="gold"
>Game is Paused
<action on="Load"><![CDATA[
var currCrd = getCrd ("snResourceCounter_1")
addCrds (this.name, 50, 0, -200, currCrd.coord[rb].y+currCrd.coord[rb].height, 200, currCrd.coord[rb].y+currCrd.coord[rb].height+52, 50, 0);
]]></action>
<action on="Press"><![CDATA[
setPaused( !isPaused() );
getGUIObjectByName (this.name).hidden = (!(getGUIObjectByName (this.name).hidden));
]]></action>
</object>
<!-- GROUP: STATUS PANE -->
<object name="snStatusPane"
@@ -314,10 +325,7 @@
type="image"
>
<action on="Load"><![CDATA[
addCrd (this.name, rb, 0, 100, 0, 0, 256, 128);
addCrd (this.name, lb, 100, 100);
addCrd (this.name, lt, 100, 0);
addCrd (this.name, rt, 0, 0);
addCrds (this.name, 0, 100, 0, 0, 256, 128);
]]></action>
<object name="snStatusPaneEmblem"
@@ -326,7 +334,7 @@
z="10"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneBkg");
var currCrd = getCrd ("snStatusPaneBkg");
addCrds (this.name, 0, 0, currCrd.coord[rb].x, currCrd.coord[rb].y,
currCrd.coord[rb].width, currCrd.coord[rb].height);
]]></action>
@@ -338,11 +346,8 @@
hotkey="selection.snap"
>
<action on="Load"><![CDATA[
addCrd (this.name, rb, 0, 0, 7, 11,
addCrds (this.name, 0, 0, 7, 11,
snConst.Portrait.Lrg.Width, snConst.Portrait.Lrg.Height);
addCrd (this.name, lb, 100, 100);
addCrd (this.name, lt, 100, 0);
addCrd (this.name, rt, 0, 0);
]]></action>
<action on="Press"><![CDATA[
// Focus the camera on the unit when his portrait is clicked.
@@ -357,7 +362,7 @@
sprite="snIconSheetRank"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPanePortrait");
var currCrd = getCrd ("snStatusPanePortrait");
addCrds (this.name, 0, 0, currCrd.coord[rb].x,
currCrd.coord[rb].y, 25, 25);
]]></action>
@@ -368,7 +373,7 @@
type="progressbar"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPanePortrait");
var currCrd = getCrd ("snStatusPanePortrait");
addCrds (this.name, 0, 0, currCrd.coord[rb].x+1,
currCrd.coord[rb].y+currCrd.coord[rb].height+3, 35, 8);
]]></action>
@@ -379,7 +384,7 @@
type="progressbar"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneHealthBar");
var currCrd = getCrd ("snStatusPaneHealthBar");
addCrds (this.name, 0, 0, currCrd.coord[rb].x,
currCrd.coord[rb].y+currCrd.coord[rb].height, currCrd.coord[rb].width, currCrd.coord[rb].height);
]]></action>
@@ -392,8 +397,8 @@
text_valign="center"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneHealthBar");
currCrd2 = getCrd ("snStatusPanePortrait");
var currCrd = getCrd ("snStatusPaneHealthBar");
var currCrd2 = getCrd ("snStatusPanePortrait");
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width, currCrd.coord[rb].y, currCrd2.coord[rb].width-currCrd.coord[rb].width-2, currCrd.coord[rb].height);
]]></action>
</object>
@@ -405,8 +410,8 @@
text_valign="center"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneHealthBarText");
currCrd2 = getCrd ("snStatusPaneStaminaBar");
var currCrd = getCrd ("snStatusPaneHealthBarText");
var currCrd2 = getCrd ("snStatusPaneStaminaBar");
addCrds (this.name, 0, 0, currCrd.coord[rb].x, currCrd2.coord[rb].y, currCrd.coord[rb].width, currCrd.coord[rb].height);
]]></action>
</object>
@@ -419,7 +424,7 @@
text_valign="top"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPanePortrait");
var currCrd = getCrd ("snStatusPanePortrait");
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width+3,
currCrd.coord[rb].y-1, 190, currCrd.coord[rb].height);
]]></action>
@@ -432,7 +437,7 @@
sprite="snIconSheetResource"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneText");
var currCrd = getCrd ("snStatusPaneText");
addCrds (this.name, 0, 0, currCrd.coord[rb].x,
currCrd.coord[rb].y+currCrd.coord[rb].height+2, 20, 20);
]]></action>
@@ -444,7 +449,7 @@
sprite="bkDarkGrayBorderBlack"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneSupplyIcon");
var currCrd = getCrd ("snStatusPaneSupplyIcon");
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width,
currCrd.coord[rb].y, 64, currCrd.coord[rb].height);
]]></action>
@@ -457,8 +462,8 @@
sprite="snIconSheetGarrison"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneSupply");
currCrd2 = getCrd ("snStatusPaneSupplyIcon");
var currCrd = getCrd ("snStatusPaneSupply");
var currCrd2 = getCrd ("snStatusPaneSupplyIcon");
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width,
currCrd.coord[rb].y, currCrd2.coord[rb].width, currCrd.coord[rb].height);
]]></action>
@@ -470,8 +475,8 @@
sprite="bkDarkGrayBorderBlack"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPaneSupply");
currCrd2 = getCrd ("snStatusPaneGarrisonIcon");
var currCrd = getCrd ("snStatusPaneSupply");
var currCrd2 = getCrd ("snStatusPaneGarrisonIcon");
addCrds (this.name, 0, 0, currCrd2.coord[rb].x+currCrd2.coord[rb].width, currCrd2.coord[rb].y, currCrd.coord[rb].width, currCrd.coord[rb].height);
]]></action>
</object>
@@ -487,9 +492,9 @@
>
<action on="Load"><![CDATA[
// Seek through this group of buttons (determining length from last object's name).
max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
currCrd = getCrd ("snStatusPaneBkg");
currCrd3 = getCrd ("snStatusPanePortrait");
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
var currCrd = getCrd ("snStatusPaneBkg");
var currCrd3 = getCrd ("snStatusPanePortrait");
for (loop = 1; loop <= max; loop++)
{
// Get name of current object in group.
@@ -511,7 +516,7 @@
else
{
// Get previous stat.
currCrd2 = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop-1));
var currCrd2 = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop-1));
// Align to the right of it.
addCrds (tempName, 0, 0, currCrd2.coord[rb].x + currCrd2.coord[rb].width, currCrd2.coord[rb].y, tempWidth, currCrd2.coord[rb].height);
}
@@ -690,14 +695,11 @@
hidden="true"
>
<action on="Load"><![CDATA[
addCrd (this.name, rb, 0, 100,
addCrds (this.name, 0, 100,
getCrd ("snStatusPaneBkg").coord[rb].x
+getCrd ("snStatusPaneBkg").coord[rb].width,
getCrd ("snStatusPaneBkg").coord[rb].y+getCrd ("snStatusPaneBkg").coord[rb].height,
snConst.Portrait.Sml.Width, snConst.Portrait.Sml.Height);
addCrd (this.name, lb, 100, 100);
addCrd (this.name, lt, 100, 0);
addCrd (this.name, rt, 0, 0);
]]></action>
</object>
-->
@@ -10,7 +10,7 @@
<objects>
<object type="empty" name="JUKEBOX_GUI" size="0 0 100% 100%" z="1" hidden="true">
<object name="jb" >
</object>
@@ -25,7 +25,7 @@
z="198"
>
<!-- control for blocking access to other controls in background -->
<object name="mbBlocker"
<object name="mbBlocker"
type="image"
hidden="false"
/>
@@ -36,8 +36,8 @@
>mbTitle
</object>
<!-- text -->
<object name="mbText"
<!-- text -->
<object name="mbText"
style="fancyTextTitleBlack"
type="text"
size="30 30 100%-30 100%-100"
@@ -51,9 +51,9 @@
size="40 100%-50 33%-30 100%-20"
>mbButton1Caption
<action on="Press"><![CDATA[
eval (getGUIGlobal().mbButton1Code);
guiHide ("mbMain");
]]></action>
eval (getGUIGlobal().mbButton1Code);
guiHide ("mbMain");
]]></action>
</object>
<object name="mbButton2"
style="wheatButtonFancy"
@@ -50,13 +50,13 @@ function openOptionsTab(tabName)
switch (i)
{
case 1:
tmpName = "pgOptionsAudio";
var tmpName = "pgOptionsAudio";
break;
case 2:
tmpName = "pgOptionsVideo";
var tmpName = "pgOptionsVideo";
break;
case 3:
tmpName = "pgOptionsGame";
var tmpName = "pgOptionsGame";
break;
default:
break;
@@ -12,11 +12,11 @@ function startMap (mapName, losSetting, openWindow)
// openWindow: Window group (usually parent string) of control that called the function. It'll be hidden.
// Check whether we have a correct file extension, to avoid crashes
extension = mapName.substring (mapName.length, mapName.length-4);
var extension = mapName.substring (mapName.length, mapName.length-4);
if (extension != ".pmp")
{
// Add .pmp to the file name.
mapName = mapName + ".pmp";
var mapName = mapName + ".pmp";
}
// Set up game
@@ -68,7 +68,7 @@ function startLoadingScreen()
console.write ("Loading " + g_GameAttributes.mapFile + " (" + g_GameAttributes.numPlayers + " players) ...");
// Generate random number for random concept art (should be depending on the selected civ later)
randVar = getRandom(1, 6);
var randVar = getRandom(1, 6);
switch (randVar) {
case 1:
@@ -101,7 +101,7 @@ function startLoadingScreen()
getGUIObjectByName ("ldText").caption = "LOADING " + g_GameAttributes.mapFile + " ...\nPlease wait ...";
// Pick a random tip of the day (each line is a separate tip).
tipArray = readFileLines("gui/text/tips.txt");
var tipArray = readFileLines("gui/text/tips.txt");
// Set tip string.
getGUIObjectByName ("ldTip").caption = tipArray[getRandom(0, tipArray.length-1)];
}
@@ -137,7 +137,7 @@ function setupSession ()
console.write ("Setting Up Temporary Single Players");
// The first player is by default allocated to the local player in SP, so
// adding 7 players means that we'll have 8 players in total
for (i=0; i<7; i++)
for (var i=0; i<7; i++)
{
g_GameAttributes.slots[i+1].assignLocal();
console.write ("Slot "+(i+1)+" is assigned: " + g_GameAttributes.slots[i+1].assignment);
@@ -148,7 +148,7 @@ function setupSession ()
// Select session peace track.
curr_session_playlist_1 = newRandomSound("music", "peace");
// Fade out main theme and fade in session theme.
crossFade(curr_music, curr_session_playlist_1, g_ConfigDB.system["sound.mastergain"]);
crossFade(curr_music, curr_session_playlist_1); // , g_ConfigDB.system["sound.mastergain"]);
// Start refreshing the session controls.
setInterval( snRefresh, 1, 100 );
@@ -169,8 +169,8 @@ function endSession (closeType)
endGame();
// Fade out current music and return to playing menu theme.
curr_music = newRandomSound('music', 'menu');
crossFade(curr_session_playlist_1, curr_music, 1);
curr_music = newRandomSound("music", "menu");
crossFade(curr_session_playlist_1, curr_music); // , 1);
// Stop refreshing the session controls.
cancelInterval();
@@ -8,7 +8,7 @@
function initMPHost (parentWindow, gameName, welcomeMessage, profileName)
{
// Set up the server
server = createServer();
var server = createServer();
// Welcome message
server.welcomeMessage = welcomeMessage;
// Server Name
@@ -52,7 +52,7 @@ console.write (event.id);
{
// Client has disconnected; free their slot.
g_GameAttributes.slots[event.id].assignOpen();
result = setCurrItemValue ("pgSessionSetupP" + event.id, "Open");
var result = setCurrItemValue ("pgSessionSetupP" + event.id, "Open");
messageBox(400, 200, "Client " + event.name + "(" + event.id + ") disconnected from " + event.session + ".", "Client Disconnected", 2, new Array(), new Array());
}
@@ -70,11 +70,11 @@ console.write (event.id);
function initMPClient (mpParentWindow, ipAddress, profileName)
{
// Create the client instance
client = createClient();
var client = createClient();
// Player Name
client.playerName = profileName;
success = client.beginConnect (ipAddress);
var success = client.beginConnect (ipAddress);
if (!success)
{
messageBox(400, 200, "Failed to connect to server. Please check the network connection.",
@@ -8,11 +8,11 @@
// Open the Session Setup screen.
function openSessionSetup (sessionReturnWindow)
{
profileName = getCurrItemValue ("pgProfileName");
titleBar = getGUIObjectByName ("pgSessionSetupTitleBar");
var profileName = getCurrItemValue ("pgProfileName");
var titleBar = getGUIObjectByName ("pgSessionSetupTitleBar");
// Setup remaining slots.
for (i = 1; i <= g_GameAttributes.numSlots; i++)
for (var i = 1; i <= g_GameAttributes.numSlots; i++)
{
if (i == 1)
{
@@ -28,12 +28,12 @@ function openSessionSetup (sessionReturnWindow)
// pushItem ("pgSessionSetupP" + i, "AI");
// Set other slots to Open.
result = setCurrItemValue ("pgSessionSetupP" + i, "Open");
var result = setCurrItemValue ("pgSessionSetupP" + i, "Open");
// Setup onchange event (closing and opening affects host slots).
getGUIObjectByName ("pgSessionSetupP" + i).onSelectionChange = function (event)
{
slotNumber = this.name.substring (this.name.length-1, this.name.length);
var slotNumber = this.name.substring (this.name.length-1, this.name.length);
switch (getCurrItemValue (this.name))
{
case "Open":
@@ -49,28 +49,28 @@ function initCellReference()
function addCellGroupCategory(iconSheetPath)
{
// Get array list of all icon sheet reference files.
iconSheets = buildFileList (iconSheetPath, "*.txt", true);
var iconSheets = buildFileList (iconSheetPath, "*.txt", true);
// Alphabetically sort the array.
iconSheets.sort();
// Seek through all icon sheets.
for (sheet = 0; sheet < iconSheets.length; sheet++)
for (var sheet = 0; sheet < iconSheets.length; sheet++)
{
// Get the current icon sheet name.
groupName = iconSheets[sheet];
var groupName = iconSheets[sheet];
// Remove path and extension information so we just have the group name.
groupName = groupName.replace (iconSheetPath, "");
groupName = groupName.replace (".txt", "");
groupName = toTitleCase(groupName);
// Get the elements from the current icon sheet.
iconArray = readFileLines (iconSheets[sheet]);
var iconArray = readFileLines (iconSheets[sheet]);
// For each row in the icon sheet file,
for (row = 0; row < iconArray.length; row++)
for (var row = 0; row < iconArray.length; row++)
{
// Get the individual fields in the array as another array.
iconElements = iconArray[row].split (",");
var iconElements = iconArray[row].split (",");
// Add this cell to the current group.
addCell (groupName, iconElements[0], iconElements[1]);
}
@@ -102,16 +102,16 @@ function addCell (group, cellID, cellName)
function setPortrait(objectName, portraitString, portraitSuffix, portraitCell)
{
// Use this function as a shortcut to change a portrait object to a different portrait image.
// Use this function as a shortcut to change a portrait object to a different portrait image.
// Accepts an object and specifies its default, rollover (lit) and disabled (gray) sprites.
// Sprite Format: "sn""portraitString""portraitSuffix"
// Sprite Format: "sn""portraitString""portraitSuffix""Over"
// Sprite Format: "sn""portraitString""portraitSuffix""Disabled"
// Note: Make sure the file follows this naming convention or bad things could happen.
// Accepts an object and specifies its default, rollover (lit) and disabled (gray) sprites.
// Sprite Format: "sn""portraitString""portraitSuffix"
// Sprite Format: "sn""portraitString""portraitSuffix""Over"
// Sprite Format: "sn""portraitString""portraitSuffix""Disabled"
// Note: Make sure the file follows this naming convention or bad things could happen.
// Get GUI object
setPortraitGUIObject = getGUIObjectByName(objectName);
// Get GUI object
setPortraitGUIObject = getGUIObjectByName(objectName);
// Report error if object not found.
if (!setPortraitGUIObject)
@@ -168,7 +168,7 @@ function flipGUI (NewGUIType)
break;
}
// Seek through all sizes created.
for (i = 0; i <= Crd.last; i++)
for (var i = 0; i <= Crd.last; i++)
{
// Set their sizes to the stored value.
getGUIObjectByName (Crd[i].name).size = Crd[i].size[GUIType];
@@ -55,71 +55,22 @@ function refreshManual()
// Display rollover text.
if (selection[0].traits.id.rollover)
{
manualRollover = getGUIObjectByName("mnRollover");
var manualRollover = getGUIObjectByName("mnRollover");
manualRollover.caption = selection[0].traits.id.rollover;
}
// Display history text.
if (selection[0].traits.id.rollover)
{
manualHistory = getGUIObjectByName("mnHistory");
var manualHistory = getGUIObjectByName("mnHistory");
manualHistory.caption = selection[0].traits.id.history;
}
// Build manual text.
manualText = "";
var manualText = "";
addItemsRecursively ( selection[0], "", "trebuchet14" );
manualText += recursiveString;
/*
container = selection[0];
for( item in container )
{
switch (item)
{
case "actions":
case "traits":
break;
default:
// If it's a null value, or function reference, don't even bother.
if (item == null || container[item] == null) break;
// Store current property value.
currItem = container[item].toString();
// If it's a function reference, also don't bother.
if (currItem[0] == "\n") break;
manualText += item + ": " + currItem + "\n";
break;
}
}
if (selection[0].actions)
{
manualText += "[font=trebuchet14b][[Actions]]\n";
subContainer = selection[0].actions;
for (sub in subContainer)
{
switch (sub)
{
default:
// List attribute.
manualText += sub;
// List value if there is one.
if (subContainer[sub] && subContainer[sub] != "true" && subContainer[sub] != true)
manualText += ": " + subContainer[sub].toString() + "\n";
else
manualText += "\n"
break;
}
}
}
*/
// Close the manual string.
manualText += "[/font]";
@@ -23,18 +23,18 @@ function defineCommandButtons(command)
snStatusPaneCommand.span = 1;
// Get the coordinates of the Status Pane background (referenced to determine command button locations).
currCrd = getCrd ("snStatusPaneBkg");
var currCrd = getCrd ("snStatusPaneBkg");
// Update each tab.
for (var tabLoop = 1; tabLoop <= snStatusPaneCommand.tab.max; tabLoop++)
{
tempGroupObject = getGUIObjectByName("snStatusPaneCommand" +
var tempGroupObject = getGUIObjectByName("snStatusPaneCommand" +
"Group" + tabLoop);
// Update each list under each tab.
for (var listLoop = 1; listLoop <= snStatusPaneCommand.list.max; listLoop++)
{
tempListObject = getGUIObjectByName("snStatusPaneCommand" +
var tempListObject = getGUIObjectByName("snStatusPaneCommand" +
tabLoop + "_" + listLoop);
// Set default portrait.
@@ -52,9 +52,9 @@ function defineCommandButtons(command)
if (tabLoop > snStatusPaneCommand.split)
{
// Get the first tab.
firstTab = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split) + "_" + listLoop);
var firstTab = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split) + "_" + listLoop);
// Get the previous tab.
lastTab = getCrd ("snStatusPaneCommand" + (tabLoop-1) + "_" + listLoop);
var lastTab = getCrd ("snStatusPaneCommand" + (tabLoop-1) + "_" + listLoop);
}
// Set position of tab (it curves, so we need to specifically set each button position).
@@ -83,7 +83,7 @@ function defineCommandButtons(command)
}
else
{
parentTab = getCrd ("snStatusPaneCommand" + (tabLoop) + "_" + (listLoop - 1));
var parentTab = getCrd ("snStatusPaneCommand" + (tabLoop) + "_" + (listLoop - 1));
// Set position of buttons under tab (parallel row to the right of it).
var buttonX = parentTab.coord[rb].x+parentTab.coord[rb].width
+snStatusPaneCommand.span;
@@ -160,8 +160,8 @@ function updateTab (tab, type, cellSheet, attribute, attribute2)
// attribute2: * For pick: The variable used to store the current item in the pick that has been selected -- placed in the tab (eg selection[0].actions.formation.curr)
// Store string form of attribute for future reference.
attributeString = attribute;
attribute2String = attribute2;
var attributeString = attribute;
var attribute2String = attribute2;
// If either attribute is not a valid property, return false.
if ( (validProperty (attributeString)) && (validProperty (attribute2String)) )
@@ -194,7 +194,7 @@ console.write ("1st: " + tabCounter + " " + tab + " " + type + " " + cellSheet +
console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet + " " + attribute + " " + attribute2);
// Get tab.
tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
var tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
// Enable tab.
guiUnHide (tabObject.name);
@@ -207,17 +207,17 @@ console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet +
{
case "command":
// Set tab tooltip.
tooltip = cellGroup[cellSheet][tab].name;
var tooltip = cellGroup[cellSheet][tab].name;
tooltip += " " + cellSheet;
break;
case "pick":
// Set tab tooltip.
tooltip = cellSheet;
var tooltip = cellSheet;
tooltip += " List\nCurrent " + cellSheet + ": " + cellGroup[cellSheet][tab].name;
break;
default:
// Set tab tooltip.
tooltip = cellGroup[cellSheet][tab].name;
var tooltip = cellGroup[cellSheet][tab].name;
tooltip += " " + cellSheet;
break;
}
@@ -248,14 +248,14 @@ console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet +
}
// Get group.
groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter);
var groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter);
// If the list hasn't been hidden (tab is open), and it should have list items (it's not merely a command),
if ( type != "command" )
{
// Extract item list into an array.
listArray = [];
for ( i in attribute )
var listArray = [];
for ( var i in attribute )
{
listArray[listArray.length] = i;
// Store any current quantity in the queue for this object.
@@ -264,13 +264,13 @@ console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet +
}
// Populate the buttons in this tab's list.
for (createLoop = 1; createLoop < snStatusPaneCommand.list.max; createLoop++)
for (var createLoop = 1; createLoop < snStatusPaneCommand.list.max; createLoop++)
{
// (Skip research list for the moment, since we don't have any portraits for techs. But we should remove the research condition later.)
if (createLoop < listArray.length && type != "command" && tab != "research")
{
// Get name of current button.
listObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_" + (createLoop+1));
var listObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_" + (createLoop+1));
switch (type)
{
@@ -290,7 +290,7 @@ console.write ("2nd: " + tabCounter + " " + tab + " " + type + " " + cellSheet +
break;
default:
// Get name of item to display in list.
itemName = selection[0].traits.id.civ_code + "_" + listArray[createLoop];
var itemName = selection[0].traits.id.civ_code + "_" + listArray[createLoop];
// Set tooltip.
listObject.tooltip = getEntityTemplate(itemName).traits.id.civ + " " + getEntityTemplate(itemName).traits.id.generic;
@@ -436,7 +436,7 @@ function refreshCommandButtons()
updateTab ("research", "production", "", "selection[0].actions.create.list.research", "");
// End of production and pick lists. Store end position.
listCounter = tabCounter;
var listCounter = tabCounter;
// Commands begin from this point.
tabCounter = snStatusPaneCommand.split;
@@ -449,7 +449,7 @@ function refreshCommandButtons()
updateTab ("stop", "command", "", "selection[0].actions.stop", "");
// End of commands. Store end position.
commandCounter = tabCounter;
var commandCounter = tabCounter;
}
else
{
@@ -461,13 +461,13 @@ function refreshCommandButtons()
if ( selectionChanged )
{
// Clear remaining buttons between the lists and commands.
for (commandClearLoop = listCounter; commandClearLoop <= snStatusPaneCommand.split-1; commandClearLoop++)
for (var commandClearLoop = listCounter; commandClearLoop <= snStatusPaneCommand.split-1; commandClearLoop++)
{
guiHide ("snStatusPaneCommand" + commandClearLoop + "_1");
// If this slot could possibly contain a list, hide that too.
guiHide ("snStatusPaneCommand" + "Group" + commandClearLoop);
}
for (commandClearLoop = commandCounter; commandClearLoop <= snStatusPaneCommand.tab.max; commandClearLoop++)
for (var commandClearLoop = commandCounter; commandClearLoop <= snStatusPaneCommand.tab.max; commandClearLoop++)
{
guiHide ("snStatusPaneCommand" + commandClearLoop + "_1");
// If this slot could possibly contain a list, hide that too.
@@ -10,7 +10,7 @@ function refreshStatusPane()
// Update civilisation emblem.
if ( selectionChanged )
{
emblemObject = getGUIObjectByName ("snStatusPaneEmblem");
var emblemObject = getGUIObjectByName ("snStatusPaneEmblem");
if (selection[0].traits.id.civ_code != "gaia")
emblemObject.sprite = "snStatusPaneEmblem" + toTitleCase (selection[0].traits.id.civ_code);
else
@@ -34,8 +34,8 @@ function refreshStatusPane()
// Update hitpoint bar.
if ( selectionChanged || shouldUpdateStat ( "traits.health.max" ) || shouldUpdateStat ( "traits.health.curr" ) )
{
barObject = getGUIObjectByName ("snStatusPaneHealthBar");
textObject = getGUIObjectByName ("snStatusPaneHealthBarText");
var barObject = getGUIObjectByName ("snStatusPaneHealthBar");
var textObject = getGUIObjectByName ("snStatusPaneHealthBarText");
if (selection[0].traits.health.max && selection[0].traits.health.max != 0)
{
barObject.caption = (selection[0].traits.health.curr * 100) / selection[0].traits.health.max;
@@ -52,8 +52,8 @@ function refreshStatusPane()
// Update stamina bar.
if ( selectionChanged || shouldUpdateStat ( "traits.stamina.max" ) || shouldUpdateStat ( "traits.stamina.curr" ) )
{
barObject = getGUIObjectByName ("snStatusPaneStaminaBar");
textObject = getGUIObjectByName ("snStatusPaneStaminaBarText");
var barObject = getGUIObjectByName ("snStatusPaneStaminaBar");
var textObject = getGUIObjectByName ("snStatusPaneStaminaBarText");
if (selection[0].traits.stamina.max && selection[0].traits.stamina.max != 0)
{
barObject.caption = (selection[0].traits.stamina.curr * 100) / selection[0].traits.stamina.max;
@@ -70,7 +70,7 @@ function refreshStatusPane()
// Update unit text panel.
if ( shouldUpdateStat ("player") || shouldUpdateStat ( "traits.id.civ" ) || shouldUpdateStat ( "traits.id.generic" ) || shouldUpdateStat ( "traits.id.specific" ) )
{
textCaption = "";
var textCaption = "";
textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getColour().r*255) + ' ' + Math.round(selection[0].player.getColour().g*255) + ' ' + Math.round(selection[0].player.getColour().b*255) + '"]' + selection[0].player.name + '[/color][/font]\n';
textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.civ + "[/color][/font]\n";
textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.specific + "[/color][/font]\n";
@@ -81,7 +81,7 @@ textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getCo
// Update rank icon.
if ( shouldUpdateStat ( "traits.promotion" ) )
{
rankObject = getGUIObjectByName ("snStatusPaneRank");
var rankObject = getGUIObjectByName ("snStatusPaneRank");
// Don't show a rank icon for Basic or unranked units.
if (selection[0].traits.promotion.rank > 1)
@@ -98,7 +98,7 @@ textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getCo
if( shouldUpdateStat( "traits.garrison" ) )
{
// Update Supply/Garrison
guiObject = getGUIObjectByName("snStatusPaneGarrison");
var guiObject = getGUIObjectByName("snStatusPaneGarrison");
guiObject.caption = '';
if (selection[0].traits.garrison)
@@ -166,11 +166,11 @@ textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getCo
function updateStat (baseName, cellSheet, cell, statistic)
{
textStat = getGUIObjectByName (baseName + statCurr);
var textStat = getGUIObjectByName (baseName + statCurr);
textStat.sprite = "snIconSheet" + cellSheet;
textStat.cell_id = cellGroup[cellSheet][cell].id;
textStat.tooltip = cellGroup[cellSheet][cell].name;
iconStat = getGUIObjectByName (baseName + (statCurr + 1))
var iconStat = getGUIObjectByName (baseName + (statCurr + 1))
iconStat.caption = statistic;
iconStat.tooltip = cellGroup[cellSheet][cell].name + ": " + statistic + ".";
statCurr = (statCurr + 2);
@@ -176,8 +176,8 @@ function makeUnit (x, y, z, MakeUnitName)
{
// Spawn an entity at the given coordinates.
DudeSpawnPoint = new Vector3D(x, y, z);
new Entity(getEntityTemplate(MakeUnitName), DudeSpawnPoint, 1.0);
var dudeSpawnPoint = new Vector3D(x, y, z);
new Entity(getEntityTemplate(MakeUnitName), dudeSpawnPoint, 1.0);
// writeConsole(MakeUnitName + " created at " + DudeSpawnPoint);
}
@@ -220,8 +220,6 @@ function validProperty (propertyName)
// and checks if all the elements (selection[0].traits, selection[0].traits.id, etc) are valid properties.
// Returns false if any invalids are found. Returns true if the whole property is valid.
console.write (propertyName);
// An empty string is always successful.
if (propertyName == "") return true;
@@ -229,11 +227,11 @@ console.write (propertyName);
if (propertyName == undefined) return false;
// Store elements of the property as an array of strings.
splitArray = propertyName.toString().split (".");
var splitArray = propertyName.toString().split (".");
// Seek through elements in array.
arrayString = "";
for (i = 0; i < splitArray.length; i++)
var arrayString = "";
for (var i = 0; i < splitArray.length; i++)
{
// Test each element combination of the string to ensure they are all valid.
if (i > 0) arrayString += ".";
@@ -167,9 +167,9 @@ function refreshResources ()
{
// Refreshes all resource counters after update.
resourcePool = localPlayer.resource;
resourceCount = 0;
for (currResource in resourcePool)
var resourcePool = localPlayer.resource;
var resourceCount = 0;
for (var currResource in resourcePool)
{
// Pass the array index of the resource as the second parameter (as we'll need that to determine the centered screen position of each counter).
refreshResource (toTitleCase(currResource), resourceUIArray[resourceCount]);
@@ -191,12 +191,12 @@ function refreshResource (resourceName, resourceIndex)
return;
// Get resource readout object.
resourceObject = getGUIObjectByName ("snResourceCounter_" + (resourceIndex + 1));
var resourceObject = getGUIObjectByName ("snResourceCounter_" + (resourceIndex + 1));
// Get resource icon object.
resourceIconObject = getGUIObjectByName ("snResourceCounterIcon_" + (resourceIndex + 1));
var resourceIconObject = getGUIObjectByName ("snResourceCounterIcon_" + (resourceIndex + 1));
// Update counter caption (since we need to have up-to-date text to determine the length of the counter).
caption = localPlayer.resource.valueOf()[resourceName];
var caption = localPlayer.resource.valueOf()[resourceName];
// The Population counter also lists the amount of available housing.
if (resourceName == "Population")
caption += "/" + localPlayer.resource.valueOf()["Housing"];
@@ -209,12 +209,12 @@ function refreshResource (resourceName, resourceIndex)
resourceIconObject.cell_id = cellGroup["Resource"][resourceName.toLowerCase()].id;
// Get the index of the resource readout to be resized.
crdResult = getCrd (resourceObject.name, true);
var crdResult = getCrd (resourceObject.name, true);
// Get the index of the resource icon.
crdIconResult = getCrd (resourceIconObject.name, true);
var crdIconResult = getCrd (resourceIconObject.name, true);
// For each coordinate group stored for this control,
for (coordGroup in Crd[crdResult].coord)
for (var coordGroup in Crd[crdResult].coord)
{
// Set width of readout based on length of caption.
Crd[crdResult].coord[coordGroup].width = snConst.MiniIcon.Width+5 + resourceObject.caption.length * 10;
@@ -262,8 +262,7 @@ function refreshResource (resourceName, resourceIndex)
Crd[crdIconResult].coord[coordGroup].height = 32;
Crd[crdIconResult].coord[coordGroup].x = Crd[crdResult].coord[coordGroup].x;
Crd[crdIconResult].coord[coordGroup].y = Crd[crdResult].coord[coordGroup].y;
// Recalculate readout's size coordinates.
Crd[crdResult].size[coordGroup] = calcCrdArray (Crd[crdResult].coord[coordGroup].rx, Crd[crdResult].coord[coordGroup].ry, Crd[crdResult].coord[coordGroup].x, Crd[crdResult].coord[coordGroup].y, Crd[crdResult].coord[coordGroup].width, Crd[crdResult].coord[coordGroup].height, Crd[crdResult].coord[coordGroup].rx2, Crd[crdResult].coord[coordGroup].ry2);
@@ -11,28 +11,28 @@ function getRandom(randomMin, randomMax)
// NOTE: There should probably be an engine function for this,
// since we'd need to keep track of random seeds for replays.
randomNum = randomMin + (randomMax-randomMin)*Math.random(); // num is random, from A to B
var randomNum = randomMin + (randomMax-randomMin)*Math.random(); // num is random, from A to B
return Math.round(randomNum);
}
// ====================================================================
function parseDelimiterString (parseString, Delimiter)
function parseDelimiterString (parseString, delimiter)
{
// Seeks through the delimiters in a string and populates the elements of an array with fields found between them.
// Declare local variables.
parseLoop = 0;
parseElement = 0;
seekDelimiter = 0;
parseArray = new Array();
var parseLoop = 0;
var parseElement = 0;
var seekDelimiter = 0;
var parseArray = new Array();
// While we're still within the bounds of the string,
while (parseLoop <= parseString.length)
{
// Seek until we find a delimiter.
seekDelimiter = parseLoop;
while (parseString[seekDelimiter] != Delimiter && seekDelimiter <= parseString.length)
while (parseString[seekDelimiter] != delimiter && seekDelimiter <= parseString.length)
seekDelimiter++;
// If we found a delimiter within the string,
@@ -73,37 +73,37 @@ function addCrds (name, rx, ry, x, y, width, height, rx2, ry2)
switch (rx)
{
case 0:
rx1 = 100;
rx2 = 100;
rx3 = 0;
var rx1 = 100;
var rx2 = 100;
var rx3 = 0;
break;
case 50:
rx1 = 50;
rx2 = 50;
rx3 = 50;
var rx1 = 50;
var rx2 = 50;
var rx3 = 50;
break;
case 100:
rx1 = 0;
rx2 = 0;
rx3 = 100;
var rx1 = 0;
var rx2 = 0;
var rx3 = 100;
break;
}
switch (ry)
{
case 0:
ry1 = 0;
ry2 = 100;
ry3 = 100;
var ry1 = 0;
var ry2 = 100;
var ry3 = 100;
break;
case 50:
ry1 = 50;
ry2 = 50;
ry3 = 50;
var ry1 = 50;
var ry2 = 50;
var ry3 = 50;
break;
case 100:
ry1 = 100;
ry2 = 0;
ry3 = 0;
var ry1 = 100;
var ry2 = 0;
var ry3 = 0;
break;
}
@@ -119,7 +119,7 @@ function addCrds (name, rx, ry, x, y, width, height, rx2, ry2)
// Optionally can choose to return the index to the coordinate, rather than the coordinate itself.
function getCrd (name, byIndex)
{
for (getCrdLoop = 0; getCrdLoop <= Crd.last; getCrdLoop++)
for (var getCrdLoop = 0; getCrdLoop <= Crd.last; getCrdLoop++)
{
if (Crd[getCrdLoop].name == name)
{
@@ -152,7 +152,7 @@ function calcCrdArray (rx, ry, x, y, width, height, rx2, ry2)
// Width from X
// Height from Y
setSizeContainer = new Object();
var setSizeContainer = new Object();
setSizeContainer.rleft = rx;
setSizeContainer.rtop = ry;
@@ -230,7 +230,7 @@ function calcCrdArray (rx, ry, x, y, width, height, rx2, ry2)
function setCrd (name, newCrd)
{
// Get the index to the given coordinate.
crdResult = getCrd (name, true);
var crdResult = getCrd (name, true);
if (crdResult != -1)
{
// Set new value of this coordinate.
@@ -256,21 +256,21 @@ function setSkin (skinName)
// Obviously such sprite names must exist, or it all will go horribly wrong.
// Seek through all registered coordinates.
for (i = 0; i <= Crd.last; i++)
for (var i = 0; i <= Crd.last; i++)
{
objectName = getGUIObjectByName (Crd[i].name);
var objectName = getGUIObjectByName (Crd[i].name);
// We need to deliberately ignore the minimap object as it has no sprite (and checking for the existence of the property or type doesn't work).
if (objectName.name != "snMiniMapDisplay")
{
// Get first asterisk position.
startIndex = objectName.style.indexOf ("*", 1);
var startIndex = objectName.style.indexOf ("*", 1);
console.write (startIndex);
// If the coordinate begins with a "skin*" (and therefore qualifies for replacement),
if (startIndex != -1)
{
// Look for and return the ending asterisk.
endIndex = objectName.style.indexOf ("*", 5);
var endIndex = objectName.style.indexOf ("*", 5);
console.write (endIndex);
if (endIndex != -1)
{
@@ -31,7 +31,7 @@ function newRandomSound(soundType, soundSubType, soundPrePath)
switch (soundType)
{
case "music":
randomSoundPath = "audio/music/"
var randomSoundPath = "audio/music/"
break;
case "voice":
randomSoundPath = soundPrePath + "/";
@@ -43,16 +43,16 @@ function newRandomSound(soundType, soundSubType, soundPrePath)
// Get names of sounds (attack, command, select, hit, pain).
// or
// Get names of "peace", "menu" (theme) and "battle" tracks.
soundArray = buildFileList(randomSoundPath, "*" + soundSubType + "*", false);
var soundArray = buildFileList(randomSoundPath, "*" + soundSubType + "*", false);
if (soundArray.length == 0)
{
console.write ("Failed to find sounds matching '*"+soundSubType+"*'");
return;
}
// Get a random number within the sound's range.
randomSound = getRandom (0, soundArray.length-1);
var randomSound = getRandom (0, soundArray.length-1);
// Set name of track.
randomFileName = soundArray[randomSound];
var randomFileName = soundArray[randomSound];
// Build path to random audio file.
randomSoundPath = randomFileName;
@@ -97,7 +97,7 @@ function crossFade (outHandle, inHandle, fadeDuration)
if (inHandle)
{
inHandle.play();
fadeIn(inHandle, 1, fadeDuration);
fadeIn(inHandle, g_ConfigDB.system["sound.mastergain"], fadeDuration);
}
return true;
@@ -32,8 +32,8 @@ function guiUnHide (objectName)
// Toggle visibility of GUI object.
function guiToggle (objectName)
{
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
console.write ("guiToggle(): GUI Object not found: " + objectName);
@@ -47,7 +47,7 @@ function guiToggle (objectName)
// Enable GUI object.
function guiEnable (objectName)
{
var guiObject = getGUIObjectByName (objectName);
var guiObject = getGUIObjectByName (objectName);
if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
console.write ("guiEnable(): GUI Object not found: " + objectName);
guiObject.enabled = true;
@@ -58,7 +58,7 @@ function guiEnable (objectName)
// Disable GUI object.
function guiDisable (objectName)
{
var guiObject = getGUIObjectByName (objectName);
var guiObject = getGUIObjectByName (objectName);
if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
console.write ("guiDisable(): GUI Object not found: " + objectName);
guiObject.enabled = false;
@@ -69,8 +69,8 @@ function guiDisable (objectName)
// Change caption of GUI object and then make it visible.
function guiRenameAndReveal (objectName, objectCaption)
{
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
console.write ("guiRenameAndReveal(): GUI Object not found: " + objectName);
@@ -78,8 +78,8 @@ function guiRenameAndReveal (objectName, objectCaption)
// Rename it
guiObject.caption = objectCaption;
// Toggle it
guiObject.hidden = false;
// Toggle it
guiObject.hidden = false;
}
// ====================================================================
@@ -92,8 +92,8 @@ function guiModifyCaption (objectName, objectModifier, objectPlaces)
// objectPlaces specifies the number of decimal places to use for a floating point number.
// If not specified, it defaults to zero (whole number).
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
console.write ("guiModifyCaption(): GUI Object not found: " + objectName);
@@ -113,8 +113,8 @@ function guiSetCaption (objectName, objectCaption)
{
// Sets an object's caption to the specified value.
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
// Get our GUI object
var guiObject = getGUIObjectByName (objectName);
if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
console.write ("guiSetCaption(): GUI Object not found: " + objectName);