Re: [Release] HUD Selector v1.17
Posted: Thu Mar 10, 2022 10:23 am
Help!
I wish to update some older HUDs for compatibility with HUD Selector.
But I don't understand the instructions.
* must be the plist differently named than hud.plist ... ?
* must define a worldScript (for example in Config/script.js) with similar this.name than the plist ... !
* set your HUD in startUp and add your HUD and plist name into HUDSelector: ... I can't find any of the various HUD Selector recognised HUDS listed anywhere inside the .oxp (eg XenonHUD, VimanaHUD, Coluber HUD, Dangerous HUD...)
et cetera, et cetera...
I wish to update some older HUDs for compatibility with HUD Selector.
But I don't understand the instructions.
Can anybody explain the relevant bits of this to me please (and possibly even provide an example!)?Norby wrote: ↑Fri Jul 04, 2014 11:34 pmOther HUDs can join by the following steps:
* must be the plist differently named than hud.plist
* must define a worldScript (for example in Config/script.js) with similar this.name than the plist
* set your HUD in startUp and add your HUD and plist name into HUDSelector:* if your HUD define different plists for 4:3, 16:10 and 16:9 screens named to "yourhud.plist", "yourhud10.plist" and "yourhud9.plist" then give all of them to AddHUD:Code: Select all
this.name = "yourhud"; this.startUp = function () { player.ship.hud = this.name + ".plist"; var w = worldScripts.hudselector; if( w ) w.$HUDSelectorAddHUD("Your HUD", this.name); }
HUDSelector will set the proper plist for the current screen but will not follow the window resizes, for example if you switch to fullscreen during flight. In this case you can set your HUD again by activating the HUDSelector equipment.Code: Select all
if( h ) h.$HUDSelectorAddHUD("Your HUD", this.name, this.name+"10", this.name+"9" );
* You can define a callback function in your worldScript to start/stop some parts of your scripted HUD:There are a built-in support for some existing Multi-Function Display (MFD) OXPs, these will be set as default MFDs.Code: Select all
this.$HUDSelectorCallBack = function ( off ) { var w = worldScripts["yourhud"]; if( off ) { //do things to disable your HUD like rename functions if( w.shipWillLaunchFromStation ) { w.$save_shipWillLaunchFromStation = w.shipWillLaunchFromStation; delete w.shipWillLaunchFromStation; } } else { //do things to activate your HUD like restore disabled functions if( !w.shipWillLaunchFromStation ) eval("w.shipWillLaunchFromStation = "+w.$save_shipWillLaunchFromStation); } }
New MFDs can register in startUp:If the name of the MFD defined in setMultiFunctionText() call is different from the worldscript name then must give the name in the second parameter:Code: Select all
var h = worldScripts.hudselector; if( h && h.$HUDSelectorAddMFD ) h.$HUDSelectorAddMFD(this.name);
Code: Select all
var h = worldScripts.hudselector; if( h && h.$HUDSelectorAddMFD ) h.$HUDSelectorAddMFD(this.name, "nameOfTheMFD");
* must be the plist differently named than hud.plist ... ?
* must define a worldScript (for example in Config/script.js) with similar this.name than the plist ... !
* set your HUD in startUp and add your HUD and plist name into HUDSelector: ... I can't find any of the various HUD Selector recognised HUDS listed anywhere inside the .oxp (eg XenonHUD, VimanaHUD, Coluber HUD, Dangerous HUD...)
et cetera, et cetera...