xboxscene.org forums

Author Topic: Yes I Done It Random Backgrounds For Thc Lite  (Read 66 times)

SSChevy2001

  • Archived User
  • Full Member
  • *
  • Posts: 126
Yes I Done It Random Backgrounds For Thc Lite
« on: May 24, 2004, 07:47:00 PM »

Very Cool! Thanks
Logged

Spike13

  • Archived User
  • Jr. Member
  • *
  • Posts: 84
Yes I Done It Random Backgrounds For Thc Lite
« Reply #1 on: May 24, 2004, 08:29:00 PM »

Here is allready an update for ppl who want to be asked for random

First replace
CODE
function OnBlackDown()


With this

CODE
   function OnBlackDown()
   {
       if((RightTrigger == true) & (LeftTrigger == true))
       {
           ChangeCBG();
       }
       else if((RightTrigger == true) & (LeftTrigger == false))
       {
           AskRBG();
       }
       else
       {
           theGameBoardLayer.visible = true;
           theGameBoardInline.children[0].theGameBoardDisplay.fade = 1;
           theGameBoardInline.children[0].theGameBoardDisplay.SetAlpha(1);
           theGameBoardInline.children[0].theGameBoardDisplay.SetTranslation(-47.5,47.5,-20);
           theGameBoardInline.children[0].theGameBoardDisplay.SetRotation(-0.0001,0,0,0.54);
           theGameBoardControlsInline.children[0].InitializeGame();
           thePlayerPanelIn.Play();
           StartGameBoardView();
      }
   }


Now go down were here inserted the new functions and replace this

CODE
function GetCBG()
{
  var info = new Settings;
  info.file = "Y:\\config.xbx";
  var cbg = info.GetValue("CurrentBackground");
  nBG = ReturnInteger(cbg);
  loadBackground(nBG);
}

function ChangeCBG()
{
  nBG = nBG + 1;
  loadBackground(nBG);
  var info = new Settings;
  info.file = "Y:\\config.xbx";
  var ccbg = info.SetValue("CurrentBackground", nBG);
}


With this

CODE
function GetCBG()
{
   var info = new Settings;
   info.file = "Y:\\config.xbx";
   var cbg = info.GetValue("CurrentBackground");
   var rbg = info.GetValue("RandomBackground");
   if(rbg == "1")
   {
   nBG = Math.round(Math.random() * (myBackgroundList.children.length() - 1));
   loadBackground(nBG);
   }
   else
   {
   nBG = ReturnInteger(cbg);
   loadBackground(nBG);
   }
}

function ChangeCBG()
{
   nBG = nBG + 1;
   loadBackground(nBG);
   var info = new Settings;
   info.file = "Y:\\config.xbx";
   var ccbg = info.SetValue("CurrentBackground", nBG);
}

function AskRBG()
{
   var info = new Settings;
   info.file = "Y:\\config.xbx";
   var rbg = info.GetValue("RandomBackground");
   if(rbg == "1")
   {
       AskQuestion(theTranslator.Translate("\n \n          " + "Turn off random \n           backgrounds?"), "NoRBG()","",1);
   }
   else
   {
       AskQuestion(theTranslator.Translate("\n \n          " + "Turn on random \n           backgrounds?"), "YesRBG()","",1);
   }
}

function YesRBG()
{
   var info = new Settings;
   info.file = "Y:\\config.xbx";
   var rbg = info.SetValue("RandomBackground", 1);
}

function NoRBG()
{
   var info = new Settings;
   info.file = "Y:\\config.xbx";
   var rbg = info.SetValue("RandomBackground", 0);
}


Now in config.xbx add
CODE
RandomBackground=1


now you are done...
To use hold down left/right triggers & black to change Backgrounds
Right Trigger & black to ask to put on random

In Congif file
1=Yes / 0=No
Logged

kanaberra

  • Archived User
  • Sr. Member
  • *
  • Posts: 260
Yes I Done It Random Backgrounds For Thc Lite
« Reply #2 on: May 24, 2004, 09:09:00 PM »

that's nice Spike13, THANX
i was looking for that awhile but too lazy to do it by myself
may i insert your post on my site as a tut ?

br


k
Logged

Spike13

  • Archived User
  • Jr. Member
  • *
  • Posts: 84
Yes I Done It Random Backgrounds For Thc Lite
« Reply #3 on: May 26, 2004, 03:06:00 AM »

hay i just found a fuck i have fix the orig and here is were i fuck up
Original Code
CODE
function GetCBG()
{
  var info = new Settings;
  info.file = "Y:\\config.xbx";
  var cbg = info.GetValue("CurrentBackground");
  var rbg = info.GetValue("RandomBackground");
  if(rbg == "Yes")
  {
  nBG = Math.round(Math.random() * (myBackgroundList.children.length() - 1));
  loadBackground(nBG);
  }
  else
  {
  nBG = ReturnInteger(cbg);
  loadBackground(nBG);
  }
}

Fixed Code
CODE
function GetCBG()
{
  var info = new Settings;
  info.file = "Y:\\config.xbx";
  var cbg = info.GetValue("CurrentBackground");
  var rbg = info.GetValue("RandomBackground");
  if(rbg == "1")
  {
  nBG = Math.round(Math.random() * (myBackgroundList.children.length() - 1));
  loadBackground(nBG);
  }
  else
  {
  nBG = ReturnInteger(cbg);
  loadBackground(nBG);
  }
}


all i did is change
CODE
  if(rbg == "Yes")
to
CODE
  if(rbg == "1")

I am surprised no one ealse picked it up before me i guess no one uses that feature
Logged

Spike13

  • Archived User
  • Jr. Member
  • *
  • Posts: 84
Yes I Done It Random Backgrounds For Thc Lite
« Reply #4 on: May 27, 2004, 08:31:00 PM »

for ppl who want just backgrounds, change from this
CODE
DEF myBackgroundList Group
{
children
[
DEF background0 Background{ skyColor 0 0 0 backdrop ImageTexture { url "" }}
DEF background1 Background{ skyColor 0 0 0 backdrop ImageTexture { url "Background.xbx" }}
DEF background2 Background{ skyColor 0 0 0 backdrop ImageTexture { url "Background1.xbx" }}
]
}

to this
CODE
DEF myBackgroundList Group
{
children
[
DEF background0 Background{ skyColor 0 0 0 backdrop ImageTexture { url "Background.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" }}
]
}

and make sure you edit the skin.xip/default.xap and add the images to skin.xip to add more backgrounds do it like this
CODE
DEF myBackgroundList Group
{
children
[
DEF background0 Background{ skyColor 0 0 0 backdrop ImageTexture { url "Background.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" }}
]
}
Logged

Spike13

  • Archived User
  • Jr. Member
  • *
  • Posts: 84
Yes I Done It Random Backgrounds For Thc Lite
« Reply #5 on: May 29, 2004, 11:39:00 PM »

*Bump* alot of bumping going on  biggrin.gif
Logged