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