Jump to content


Photo

Displaying Other Info In The Clock Panel


  • Please log in to reply
12 replies to this topic

#1 Dazza

Dazza

    X-S Young Member

  • Members
  • Pip
  • 30 posts
  • Location:Rugby, England
  • Xbox Version:v1.2

Posted 19 January 2005 - 06:25 PM

I was using the Y button to show me the Xbox Information panel but I thought it might be better to show this in the clock panel instead.

in default.xip\default.xap go to the bottom of the file and add:

CODE

function ChangeDisplay()
{
var nMaxDisplay = 10;
if (nDisplayNum > nMaxDisplay) { nDisplayNum = 1; }
if (nDisplayNum < 1) { nDisplayNum = nMaxDisplay; }
var sTopText = "";
var sBotText = "";
var sMainText = "";

if (nDisplayNum == 1)
{
    sTopText = "DATE";
    sBotText = "TIME";
    sMainText = "<clock>";
}
else if (nDisplayNum == 2)
{
    var nIntTemp = theConfig.GetInternalTemp();
    var nCPUTemp = theConfig.GetCPUTemp();
     var sScale = "C";

//     var IniFile = new Settings;
//     IniFile.SetIniSection( "Settings" );
//     var e = IniFile.GetIniValue( "temp" );
//     IniFile.CloseIniFile();
// mine is setable from the config screen

    var e = "centigrade";

    if( e == "fahrenheit" )
    {
        sScale = "F";
               nIntTemp = Math.round(nIntTemp * 9/5 + 32);
               nCPUTemp = Math.round(nCPUTemp * 9/5 + 32);
    }
    else if( e == "kelvin" )
    {
        sScale = "K";
               nIntTemp = nIntTemp + 273;
               nCPUTemp = nCPUTemp + 273;
    }
    sTopText = "MB Temp";
    sBotText = "CPU";
    sMainText = nIntTemp + " " + sScale + "       "+ nCPUTemp + " " + sScale;
}
else if (nDisplayNum == 3)
{
    var sIPAddress = theXboxNetwork.GetXboxIP();
    sTopText = "IP";
    sMainText = sIPAddress;
}
else if (nDisplayNum == 4)
{
    sTopText = "C:";
    sBotText = "FREE";
    sMainText = DriveSpace(sTopText);
}
else if (nDisplayNum == 5)
{
    sTopText = "E:";
    sBotText = "FREE";
    sMainText = DriveSpace(sTopText);
}
else if (nDisplayNum == 6)
{
    sTopText = "F:";
    sBotText = "FREE";
    sMainText = DriveSpace(sTopText);
    if (sMainText == "")
    {
 ChangeDisplay();
 return;
    }
}
else if (nDisplayNum == 7)
{
    sTopText = "G:";
    sBotText = "FREE";
    sMainText = DriveSpace(sTopText);
    if (sMainText == "")
    {
 ChangeDisplay();
 return;
    }
}
else if (nDisplayNum == 8)
{
    sTopText = "BIOS";
    sMainText = theConfig.GetROMVersion();
}
else if (nDisplayNum == 9)
{
    sTopText = "DASH";
    sMainText = theConfig.GetXdashVersion();
}
else if (nDisplayNum == 10)
{
   var sTrackName = theMusicCollection.GetSoundtrackSongName(currentAlbum, currentTrack);
    sTopText = "MUSIC";
    sMainText = sTrackName;
}

var c = theMainMenu.children[0].children[0];
c.theClock_text.children[0].children[0].geometry.text = sMainText;
c.Clock_panel_header_text.text = sTopText;
c.Clock_panel_support_03_text.text = sBotText;
}

function DriveSpace( sDrive )
{
var nFreeSpace = theHardDrive.GetFreeSpace(sDrive + "\\");
       var nTotalSpace = theHardDrive.GetTotalSpace(sDrive + "\\");
if (nTotalSpace == 0) { return ""; }
return nFreeSpace + "MB of " + nTotalSpace + "MB";
}


Then find:
CODE

function MusicPlayerPlay()
{
theMusicPlayer.url = "st:" + theMusicCollection.GetSoundtrackSongID( currentAlbum, currentTrack );
log("Playing " + theMusicPlayer.url);
DisableAmbientAudio();
theMusicPlayer.Play();
}

and add an extra line to the end so that it looks like this:
CODE

function MusicPlayerPlay()
{
theMusicPlayer.url = "st:" + theMusicCollection.GetSoundtrackSongID( currentAlbum, currentTrack );
log("Playing " + theMusicPlayer.url);
DisableAmbientAudio();
theMusicPlayer.Play();
if (nDisplayNum == 10) { ChangeDisplay(); }
}

That ensures that the music title is updated if you are looking at that info when the song changes. It assumes that 10 is the page number for the music.

next find:
CODE

var currentAlbum;
var currentTrack;


and add under this line:
CODE

var nDisplayNum;


next you need to find:
CODE

currentAlbum = 0;
currentTrack = 0;


and add under that:

CODE

nDisplayNum = 1;


lastly find:
CODE

   control DEF theMainMenuJoy Joystick
   {


and insert this under that:
CODE

       function OnLeftThumbDown()
{
           PlaySoundB();
    nDisplayNum = nDisplayNum + 1;
    ChangeDisplay();
}

       function OnRightThumbDown()
{
           PlaySoundB();
    nDisplayNum = nDisplayNum - 1;
    ChangeDisplay();
}


This should allow you to click the left and right thumb buttons so you can go forward and backward through the displays.

You can add any other information you like to this easily enough.
I display my temperatures in centigrade if you want them in fahrenheit change the

var e = "centigrade";
to
var e = "fahrenheit";

I hope someone finds this useful.

#2 EBear

EBear

    X-S X-perience

  • Members
  • PipPip
  • 366 posts

Posted 19 January 2005 - 08:26 PM

Anyway you (or anyone else) can post a pic of this? Can you use this in conjunction with the clock?

#3 SSJToo

SSJToo

    X-S Enthusiast

  • Members
  • 28 posts
  • Location:Newfoundland
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 20 January 2005 - 12:07 AM

I know very little about coding, but i was wondering how i could setup the code to autocycle the screens. I was thinking of something along the lines of having the screen start and stay as the clock, but when you press Y it checks the condition of a variable say "AutoScreenChange" and if it is 0 set to 1 and beging cycling the info on the screen every 5 seconds. press the Y again and if AutoScreenChange is 1 set to 0 and display the default screen info the clock.

Is this possible, if so how would i setup the code to cycle the screen.

the button press being something like below. I know the code below is not correct, just using it as example of what might be.

CODE

      function OnYDown()
{
          PlaySoundB();
  if (AutoScreenChange = 0)
  {
    AutoScreenChange = 1;
    nDisplayNum = 1;
    //Have some way to cycle and loop the ChangeDisplay() every 5 seconds
  }
  elseif (AutoScreenChange = 1)
  {
   AutoScreenChange = 0;
   nDisplayNum = 1;
   ChangeDisplay();
  }
}





#4 Dazza

Dazza

    X-S Young Member

  • Members
  • Pip
  • 30 posts
  • Location:Rugby, England
  • Xbox Version:v1.2

Posted 20 January 2005 - 01:22 AM

I originally had it autocycling but with there being so many screens it seemed to take ages to get to the screen I was waiting for and then it was easy to miss.

But here is the code I used:
Change your ONYDOWN function so it lookes like this:

CODE

       function OnYDown()
       {
           PlaySoundB();
    if (bAutoDisplay == true)
    {
 bAutoDisplay = false;
 nDisplayNum = 1;
 ChangeDisplay();
    }
    else
    {
 bAutoDisplay = true;
 nDisplayNum = 1;
 ChangeDisplay();
    }
}


Then find :
CODE

var nDisplayNum;


and insert under that
CODE

var bAutoDisplay;


Then find :
CODE

nDisplayNum = 1;


and insert under that
CODE

bAutoDisplay = false;


finally you need to make it sleep for 5 seconds so find
CODE

  function OnActivate()
  {
EnableAudio();
CurrentViewpoint = theMainMenuViewpoint;
CurrentAltViewpoint = theMainMenuAlternateViewpoint;
  }
}


and above that LAST } put the following code:
CODE

   behavior
   {
       sleep 5;
if ( bAutoDisplay )
{
    nDisplayNum = nDisplayNum + 1;
    ChangeDisplay();
}
   }


Now it is possible that you already have a behavior defined in the ONACTIVATE function and it doesn't appear to like two of them so you'll have to merge the code in.

I have the clock on the orb as well so my behavior code looks like this
CODE

   behavior
   {
       sleep 5;
if(theMainMenu.visible) {UpdateListClockHands();} // for the clock
if ( bAutoDisplay )
{
    nDisplayNum = nDisplayNum + 1;
    ChangeDisplay();
}
   }


but yours may well have to be different!



#5 evil_ted

evil_ted

    X-S Member

  • Members
  • Pip
  • 71 posts

Posted 20 January 2005 - 07:16 PM

Jus to add to this thread, with my audio display. This will make the current track slide in and out on the mainmenu..

in default.xip-default.xap
search for
CODE

function MusicPlayerPlay()

make it look like this
function MusicPlayerPlay()
{
theMusicPlayer.url = "st:" + theMusicCollection.GetSoundtrackSongID( currentAlbum, currentTrack );
log("Playing " + theMusicPlayer.url);
DisableAmbientAudio();
theMusicPlayer.Play();

var str1 = theMusicCollection.GetSoundtrackSongName(currentAlbum, currentTrack);
var c = theMainMenu.children[0].children[0];
c.NowPlayingtext_text.geometry.text = str1;
c.NowPlaying_text.SetAlpha(1);
c.NowPlaying_text.Fade= 8;
c.NowPlaying_text.SetTranslation(10, -75, 80);
}

next look for
CODE

function OnStop()

make it like this
CODE

function OnStop() { MusicPlayerStopping(); theMusicPlayer.Stop(); }

next look for
CODE

behavior

if you dont have it add the whole thing under the last } of function OnActivate()
CODE

   behavior
{
sleep 30;
MusicPlayerStopping();
}

next add this to the bottom of the file as the last entry
CODE

function MusicPlayerStopping()
{
  var c = theMainMenu.children[0].children[0];
  c.NowPlaying_text.SetAlpha(0);
  c.NowPlaying_text.Fade= 1;
  c.NowPlaying_text.SetTranslation(100, -75, 80);
}

save and close
open mainmenu.xip/default.xap and put this code at the very bottom
CODE

DEF NowPlaying_text Transform
 {
   children
   [
     Transform                                                                
     {
       rotation -1 0 0 1.571
       children

       [
         DEF NowPlayingtext_text Shape
         {
           appearance Appearance
             {
                material
                DEF NowPlayingTextMaterial MaxMaterial { name "AudioCD" }
             }
           geometry Text { font "Heading" translate true text "now playing" }
         }
       ]        
     }
   ]
   rotation -1.000000 0.002966 0.003888 -1.551000
   scale 5 5 5 // 7.000 0.0 7.000
   translation 100 -75 80 // 10 -75 80  -14.379000 -10.540000 3.903000
 }

ur done, save upload reboot..


#6 CrakkedOut

CrakkedOut

    X-S Expert

  • Members
  • PipPipPip
  • 731 posts
  • Location:LINY
  • Xbox Version:none
  • 360 version:none

Posted 20 January 2005 - 07:24 PM

GOOD SHIT TED......just wut i wanted

#7 SSJToo

SSJToo

    X-S Enthusiast

  • Members
  • 28 posts
  • Location:Newfoundland
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 20 January 2005 - 09:37 PM

Perfect, i'm going to have a go at this tonight. See, it always helps to know what you are doing. Thanks evil_ted

#8 EBear

EBear

    X-S X-perience

  • Members
  • PipPip
  • 366 posts

Posted 23 January 2005 - 09:48 PM

Shoot. My DVD player stopped working in the dash after successfully adding these. The music keeps playing on the UIX loading screen when I launch a DVD now. Ill try removing ted's code to see if it works. Anyone else experience any probs?

#9 EBear

EBear

    X-S X-perience

  • Members
  • PipPip
  • 366 posts

Posted 24 January 2005 - 02:51 AM

Update: Just as I suspected, I removed EvilTed's portion (too bad - I really liked it too) and now my DVD player works again! Anyway this can be fixed easily? Anyone else test this?

#10 EBear

EBear

    X-S X-perience

  • Members
  • PipPip
  • 366 posts

Posted 25 January 2005 - 02:01 AM

Problem lies in this line. . . I have no clue as to how to fix it.
CODE
function OnStop() { MusicPlayerStopping(); theMusicPlayer.Stop(); }

Edited by EBear, 25 January 2005 - 02:01 AM.


#11 CrakkedOut

CrakkedOut

    X-S Expert

  • Members
  • PipPipPip
  • 731 posts
  • Location:LINY
  • Xbox Version:none
  • 360 version:none

Posted 29 January 2005 - 09:58 PM

ted where is function OnStop() ??

i cant find it, im lookin in the default.xip/xap

#12 *LEGEND*

*LEGEND*

    X-S Enthusiast

  • Members
  • 29 posts

Posted 30 January 2005 - 07:22 PM

QUOTE(EBear @ Jan 24 2005, 04:07 PM)
Problem lies in this line. . . I have no clue as to how to fix it.
CODE
function OnStop() { MusicPlayerStopping(); theMusicPlayer.Stop(); }

View Post


did it ever get fixed bear???

cuz i cant even find that line homie...ive searched everywhere....

#13 CrakkedOut

CrakkedOut

    X-S Expert

  • Members
  • PipPipPip
  • 731 posts
  • Location:LINY
  • Xbox Version:none
  • 360 version:none

Posted 30 January 2005 - 09:50 PM

ive been thru every default file and i cant find that function OnStop




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users