View Single Post
  #1  
Old 12-09-2012, 07:14 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
New F3 options tab

I figured it was a better and more logical idea to add local serveroptions at the same place that all other options were located, so I wrote up some code that allows you to do that.


PHP Code:
//#CLIENTSIDE
const SERVERNAME "Maloria";  // Change this to your likings.

function onCreated()
  if (
OptDialogWindow2D.visible)
    
setInitialData();

function 
OptDialogWindow2D.onShow()
{
  if (!
isObject(OptionTabs))
    
setInitialData();
  
  
updateSelectedTab();
  
  if (
OptDialogTab.rows[1].text != SERVERNAME) {
    
this.originalSize = { 444404 };  // Default dimensions of OptDialogWindow2D
    
    
OptDialogWindow2D.resize(OptDialogWindow2D.xOptDialogWindow2D.ythis.originalSize[0] + 47this.originalSize[1]);
    
    
OptDialogTab.insertRow(14SERVERNAME);
  }
  
  new 
GuiControl("OptServerPane2D") {
    
this.profile GuiOptPaneProfile;
    
    
this.x      OptGeneralPane2D.x;
    
this.y      OptGeneralPane2D.y;
    
this.width  OptGeneralPane2D.width;
    
this.height OptGeneralPane2D.height;
    
    
this.visible false;
    
    
OptDialogWindow2D.addControl(this);
    
    
// Add subsequent GUI controls here
  
}
  
  
OptDialogTab.setSelectedRow(0);
}

function 
OptDialogTab.onSelect(temp.idtemp.texttemp.row)
{
  if (
temp.text == SERVERNAME) {
    
temp.lastSelectedTabName getSelectedTabText();
    
OptionTabs.(@temp.lastSelectedTabName).hide();
    
    
OptServerPane2D.show();
  }
  else if (
OptServerPane2D.visible)
    
OptServerPane2D.hide();
  
  
updateSelectedTab();
}



function 
setInitialData()
{
  
this.tabs          = new TStaticVar("OptionTabs");
  
  
OptionTabs.General OptGeneralPane2D;
  
OptionTabs.Sound   OptAudioPane2D;
  
OptionTabs.Keys    OptControlsPane2D;
  
OptionTabs.Capture OptCapturePane2D;
}

function 
updateSelectedTab()
  
this.selectedTab OptDialogTab.getselectedrow();
function 
getSelectedTabID()
  return 
this.selectedTab;
function 
getSelectedTabText()
  return 
OptDialogTab.rows[getSelectedTabID()].text
Each time that the F3 menu is opened, it clears tabs. This is a great thing, because it means your custom tabs won't remain upon changing servers. The only change that will remain until your game client is restarted, is that the windows width is slightly increased when the new tab is added. This could likely be easily fixed if the script on Login would be updated by Stefan/Skyld/Tig to reset the windows dimensions each time it's opened.

Enjoy
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto

Last edited by xXziroXx; 12-09-2012 at 08:15 AM..
Reply With Quote