xboxscene.org forums

Author Topic: Random Backgrounds In Uix  (Read 685 times)

frostyfire03530

  • Archived User
  • Newbie
  • *
  • Posts: 18
Random Backgrounds In Uix
« on: October 05, 2005, 02:11:00 AM »

|||||||||||||||||||||||||||Random Backgrounds in UIX|||||||||||||||||||||||||||||||||

(NOTE: I HAVE TESTED THIS TO WORK ON VIRGIN XIPs AND IT WORKS...)

/////////////////////////////Default.Xip=Default.Xap\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

First find this code

CODE

DEF theBackground Background
{
    skyColor 0 0 0
    //backdrop ImageTexture { url "xboxlogo.xbx" }
}


Then right after it insert this code

CODE

DEF theBackground Group
{
    children
    [
        DEF background0 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background0.xbx" }
        }
        DEF background1 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background1.xbx" }
        }
        DEF background2 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background2.xbx" }
        }
        DEF background3 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background3.xbx" }
        }
        DEF background4 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background4.xbx" }
        }
        DEF background5 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background5.xbx" }
        }
        DEF background6 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background6.xbx" }
        }
        DEF background7 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background7.xbx" }
        }
        DEF background8 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background8.xbx" }
        }
        DEF background9 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background9.xbx" }
        }
        DEF background10 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background10.xbx" }
        }
        DEF background11 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background11.xbx" }
        }
        DEF background12 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background12.xbx" }
        }
        DEF background13 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background13.xbx" }
        }
        DEF background14 Background
        {
            skyColor 0 0 0 backdrop ImageTexture { url "background14.xbx" }
        }
    ]
}

var z;

function GetBackground()
{
    var IniFile = new Settings;
    IniFile.SetIniSection( "BackgroundSettings" );
    z = IniFile.GetIniValue( "number" );
    IniFile.CloseIniFile();
    var a = ReturnInteger(z);
    return a;
}

function LoadBackground()
{
    var IniFile = new Settings;
    IniFile.SetIniSection( "BackgroundSettings" );
    var a = IniFile.GetIniValue( "random" );
    IniFile.CloseIniFile();
    var n = Math.round(Math.random() * (GetBackground() - 1));
    if( a == "true" ) { theBackground.children[n].isBound = true; }
    else if( a == "single" ) { theBackground.children[0].isBound = true; }
    else if( a == "false" ) { theBackground.children[n].isBound = false; }
}


Then search for this

CODE

DEF theMainMenu Level


after this code

CODE

EnableAudio();


insert this

CODE

LoadBackground();


Then look for

CODE

control DEF theMainMenuJoy Joystick  


and add right above this

CODE

        function OnADown()
        {
            PlaySoundA();
            if(nCurMainMenuItem == 0)
            {
                theMusicMenuIn.Play();
                GoToMusic();
            }
            else if(nCurMainMenuItem == 1)
            {
                theSettingsMenuIn.Play();
                GoToHardDrive();
            }
            else if(nCurMainMenuItem == 2)
            {
            }
            else if(nCurMainMenuItem == 3)
            {
                theSettingsMenuIn.Play();
                GoToSettings();
            }
        }


This

CODE

        function OnRightThumbDown()
        {
            LoadBackground();
        }


save and insert into default.xip

////////////////////////////Default.Xip=Default.Xap\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/////////////////////////////Default.Xip=Config.Xap\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

find this code

CODE

function BuildMainList()


and find and insert before this code

CODE

ClearText();
UpdateText();


this code

CODE

   configList = "Random Background:";
   configValues = "c-BackgroundSettings-random";
   configSelect = "ToggleRBG()";
   i = i + 1;

   configList = "Number of Backgrounds:";
   configValues = "c-BackgroundSettings-number";
   configSelect = "ToggleRBGN()";
   i = i + 1;


then insert this and the END of the file

CODE

function ToggleRBG()
{
   var c = theConfigPanel.children[0].children[0];
   var b = c.theRightSlots.children[LV2Item].children[0].geometry.text;
   if(b.toLowerCase() == "true") { RefreshMenu("single"); }
   else if(b.toLowerCase() == "single") { RefreshMenu("false"); }
   else if(b.toLowerCase() == "false") { RefreshMenu("true"); }
}

function ToggleRBGN()
{
   var c = theConfigPanel.children[0].children[0];
   var b = c.theRightSlots.children[LV2Item].children[0].geometry.text;
   if(b.toLowerCase() == "1") { RefreshMenu("2"); }
   else if(b.toLowerCase() == "2") { RefreshMenu("3"); }
   else if(b.toLowerCase() == "3") { RefreshMenu("4"); }
   else if(b.toLowerCase() == "4") { RefreshMenu("5"); }
   else if(b.toLowerCase() == "5") { RefreshMenu("6"); }
   else if(b.toLowerCase() == "6") { RefreshMenu("7"); }
   else if(b.toLowerCase() == "7") { RefreshMenu("8"); }
   else if(b.toLowerCase() == "8") { RefreshMenu("9"); }
   else if(b.toLowerCase() == "9") { RefreshMenu("10"); }
   else if(b.toLowerCase() == "10") { RefreshMenu("11"); }
   else if(b.toLowerCase() == "11") { RefreshMenu("12"); }
   else if(b.toLowerCase() == "12") { RefreshMenu("13"); }
   else if(b.toLowerCase() == "13") { RefreshMenu("14"); }
   else if(b.toLowerCase() == "14") { RefreshMenu("15"); }
   else if(b.toLowerCase() == "15") { RefreshMenu("1"); }
}


save and insert into default.xip (SAVE AGAIN), upload to xbox

/////////////////////////////Default.Xip=Config.Xap\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

////////////////////////////////////Uix.ini\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Add this at the END of the file

CODE

[BackgroundSettings]
random=false
number=3


save and upload to xbox

////////////////////////////////////Uix.ini\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/////////////////////////////////////Notes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Now, there are two ways you can set up where the background files go...

One-
    You can inject the xbxs straight into the Default.Xip file and the backgrounds will be global for all the skins.

Two-
    You can place the xbxs into different skin folders so you can have differnt random sets for different skins. (The only thing is you then are taking up more hard drive space doing it this way, and you must remember to change the amount of backgrounds you have in the dashboard settings.)

    The background you want to load as a "single" background must be entitled background0.xbx.

    This code is for a max limit of 15 TOTAL backgrounds if you want more you will have to reconfigure the code yourself.

    I take no credit for this code just the compilation thereof into UIX. I would like to thank TeamUix for the help they have given me to get this code straight and working, thanks guys for all the help and this great dash!!!
Enjoy!
-Frsty0353

/////////////////////////////////////Notes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

||||||||||||||||||||||||||||||||||End Tutourial|||||||||||||||||||||||||||||||||||||
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
Random Backgrounds In Uix
« Reply #1 on: October 07, 2005, 01:42:00 AM »

Looks pretty good. I like the idea of having a global set of bg images. I think it'd look good if there were a bunch of solid color bg images like the project mayhem skin.
 beerchug.gif
Logged

frostyfire03530

  • Archived User
  • Newbie
  • *
  • Posts: 18
Random Backgrounds In Uix
« Reply #2 on: October 07, 2005, 04:23:00 PM »

Adding this as a second thought to things:
This will allow you to cycle back with X in the config options... that way if you accidently pass what amount of backgrounds you want you don't have to cycle all the way through the numbers again...

///////////////////////////////Default.Xip=Config.Xap\\\\\\\\\\\\\\\\\\\\\\\\\\\\

At the begining after this

CODE

var configSelect;


add this

CODE

var configSelectX;
;

go to this list you have built the Number of Backgrounds command to and after this

CODE

configSelect = new Array;


put this code

CODE

configSelectX = new Array;


then after this

CODE

configSelect = "ToggleRBGN()";


put this

CODE

configSelectX = "ToggleRBGNX()";


find this code

CODE

function OnADown()


and after that entire function make a new function like this

CODE

function OnXDown()
{
   if(inLV2 == true)
   {
  settChanged = true;
  eval(configSelectX[LV2Item]);
   }
}


then go to the end of the file and add this

CODE

function ToggleRBGNX()
{
   var c = theConfigPanel.children[0].children[0];
   var b = c.theRightSlots.children[LV2Item].children[0].geometry.text;
   if(b.toLowerCase() == "1") { RefreshMenu("30"); }
   else if(b.toLowerCase() == "30") { RefreshMenu("29"); }
   else if(b.toLowerCase() == "29") { RefreshMenu("28"); }
   else if(b.toLowerCase() == "28") { RefreshMenu("27"); }
   else if(b.toLowerCase() == "27") { RefreshMenu("26"); }
   else if(b.toLowerCase() == "26") { RefreshMenu("25"); }
   else if(b.toLowerCase() == "25") { RefreshMenu("24"); }
   else if(b.toLowerCase() == "24") { RefreshMenu("23"); }
   else if(b.toLowerCase() == "23") { RefreshMenu("22"); }
   else if(b.toLowerCase() == "22") { RefreshMenu("21"); }
   else if(b.toLowerCase() == "21") { RefreshMenu("20"); }
   else if(b.toLowerCase() == "20") { RefreshMenu("19"); }
   else if(b.toLowerCase() == "19") { RefreshMenu("18"); }
   else if(b.toLowerCase() == "18") { RefreshMenu("17"); }
   else if(b.toLowerCase() == "17") { RefreshMenu("16"); }
   else if(b.toLowerCase() == "16") { RefreshMenu("15"); }
   else if(b.toLowerCase() == "15") { RefreshMenu("14"); }
   else if(b.toLowerCase() == "14") { RefreshMenu("13"); }
   else if(b.toLowerCase() == "13") { RefreshMenu("12"); }
   else if(b.toLowerCase() == "12") { RefreshMenu("11"); }
   else if(b.toLowerCase() == "11") { RefreshMenu("10"); }
   else if(b.toLowerCase() == "10") { RefreshMenu("9"); }
   else if(b.toLowerCase() == "9") { RefreshMenu("8"); }
   else if(b.toLowerCase() == "8") { RefreshMenu("7"); }
   else if(b.toLowerCase() == "7") { RefreshMenu("6"); }
   else if(b.toLowerCase() == "6") { RefreshMenu("5"); }
   else if(b.toLowerCase() == "5") { RefreshMenu("4"); }
   else if(b.toLowerCase() == "4") { RefreshMenu("3"); }
   else if(b.toLowerCase() == "3") { RefreshMenu("2"); }
   else if(b.toLowerCase() == "2") { RefreshMenu("1"); }
}


save and insert in default.Xip SAVE AGAIN...
///////////////////////////////Default.Xip=Config.Xap\\\\\\\\\\\\\\\\\\\\\\\\\\\\

(NOTE: I use 30 bg's if you are using the 15 like in the TUT. then use 15 down instead of 30. Also, if you use this and accidently hit X on a LVL2 item that is not defined to do the function the dash WILL RESTART.)


Hope this is usefull I know for me it is becuase i hate when i pass up a number i wanted in the list and now i can just use X to go back one...
Thanks for the support Odb718, i just like to fill it up with anime bg's, i'm a dork  laugh.gif
-Frsty0353
Logged