|||||||||||||||||||||||||||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|||||||||||||||||||||||||||||||||||||