Re: [Release] Clear HUD
Posted: Thu Oct 25, 2012 5:04 pm
Uploaded a new version with persistent log screen
For information and discussion about Oolite.
https://bb.oolite.space/
I was not aware of that! To the text editor!another_commander wrote:...you can make it persistent if you want. Just set the permanent key toyes
...
Gimbal Locke wrote:I like the Clear HUD design very much, but it does not play well with the Sniper Sight OXP: in the middle of a fight, the sniper sight often suddenly disappears.
I _think_ it is when the Clear HUD cross hairs change colour that I get kicked out of Sniper Sight.
The problem is the last two lines of this function in Spara's script:-Sniper Sight README wrote:Compatibility note:
Sniper Sight 2 is NOT compatible with scripted HUDs, such as MilHUD, which switch the whole HUD file to achieve changes in the HUD while in flight. It is compatible with scripts that switch only between 'docked' and 'in-flight' HUDs.
Code: Select all
//Switch hud to distance hud on state green and normal hud otherwis
this.alertConditionChanged = function(newCondition, oldCondition) {
if (this.distanceTimer) {
this.distanceTimer.stop();
}
if (newCondition == 1){
player.ship.hud = this.distHud;
if (player.ship.equipmentStatus("EQ_ADVANCED_COMPASS") == "EQUIPMENT_OK") {
if (!this.distanceTimer){
this.distanceTimer = new Timer(this,this.updateDistance,0,0.5);
}
else {
this.distanceTimer.start();
}
}
}
else if (player.ship.hud != this.normalHud){
player.ship.hud = this.normalHud;
}
}
if (newCondition == 1)
(that's green alert) to switch HUDs, but at the bottom it checks for else if (player.ship.hud != this.normalHud)
to switch them back. That second check will pass when the alert condition changes from red to yellow or from yellow to red, as well at the intended time changing from green to yellow. I haven't tested it yet, but...else if (player.ship.hud != this.normalHud){
with either else if (player.ship.hud == this.distHud) {
or if (oldCondition == 1) {
(note there is no "else" in this one) should fix the problem.There will probably be trouble with the distance timer when switching to and from sniper zoom. I'll check it out when I have some time to spare. There was some reason for that "!=" thing, just can't remember what . It's probably from experimenting with more than two switching huds.Wildeblood wrote:Gimbal Locke wrote:I like the Clear HUD design very much, but it does not play well with the Sniper Sight OXP: in the middle of a fight, the sniper sight often suddenly disappears.
I _think_ it is when the Clear HUD cross hairs change colour that I get kicked out of Sniper Sight.The problem is the last two lines of this function in Spara's script:-Sniper Sight README wrote:Compatibility note:
Sniper Sight 2 is NOT compatible with scripted HUDs, such as MilHUD, which switch the whole HUD file to achieve changes in the HUD while in flight. It is compatible with scripts that switch only between 'docked' and 'in-flight' HUDs.Near the top it checks forCode: Select all
//Switch hud to distance hud on state green and normal hud otherwis this.alertConditionChanged = function(newCondition, oldCondition) { if (this.distanceTimer) { this.distanceTimer.stop(); } if (newCondition == 1){ player.ship.hud = this.distHud; if (player.ship.equipmentStatus("EQ_ADVANCED_COMPASS") == "EQUIPMENT_OK") { if (!this.distanceTimer){ this.distanceTimer = new Timer(this,this.updateDistance,0,0.5); } else { this.distanceTimer.start(); } } } else if (player.ship.hud != this.normalHud){ player.ship.hud = this.normalHud; } }
if (newCondition == 1)
(that's green alert) to switch HUDs, but at the bottom it checks forelse if (player.ship.hud != this.normalHud)
to switch them back. That second check will pass when the alert condition changes from red to yellow or from yellow to red, as well at the intended time changing from green to yellow. I haven't tested it yet, but...
Replacing the lineelse if (player.ship.hud != this.normalHud){
with eitherelse if (player.ship.hud == this.distHud) {
orif (oldCondition == 1) {
(note there is no "else" in this one) should fix the problem.
Ok. I dug into this and to make my script and sniper zoom cooperate would probably need a constant in-flight frame callback function, that would monitor the hud in use. The problem lies in switching to the sniper zoom on status green and off on yellow. Sniper zoom restores the green state hud when it should be yellow state. It's easy to fix with a frame callback, but is there a problem in using it like this? I'm not familiar with the overhead of it. Is it advisable or not?spara wrote:There will probably be trouble with the distance timer when switching to and from sniper zoom. I'll check it out when I have some time to spare. There was some reason for that "!=" thing, just can't remember what . It's probably from experimenting with more than two switching huds.
To make it compatible you need to change two lines of the script in Clear HUD.Gimbal Locke wrote:I like the Clear HUD design very much, but it does not play well with the Sniper Sight OXP: in the middle of a fight, the sniper sight often suddenly disappears.
I _think_ it is when the Clear HUD cross hairs change colour that I get kicked out of Sniper Sight.
Easy, peasy. I'll make up the necessary HUD files for you sometime this week.Gimbal Locke wrote:As with all other HUDs, the HUD layout changes while the Sniper Sight is enabled, maybe it would be a nice to integrate the Sniper Sight completely into the Clear HUD? But I know I'm asking a lot now.
You guys are far beyond and above awesome!Wildeblood wrote:Easy, peasy. I'll make up the necessary HUD files for you sometime this week.Gimbal Locke wrote:As with all other HUDs, the HUD layout changes while the Sniper Sight is enabled, maybe it would be a nice to integrate the Sniper Sight completely into the Clear HUD? But I know I'm asking a lot now.
Ok! My last change was to hud.plist. I'll leave the script unchanged to let the devs track the problem.Wildeblood wrote:Don't change the script again, Tichy. The devs will need to look at this one, I think.
https://bb.oolite.space/viewtopic.php?f=3&t=12823
This will make clear-hud work better with sniper sight, but it will not make them fully compatible. For example next situation causes erratic behaviour.Wildeblood wrote:Firstly, near the end of the this.alertConditionChanged() function, replace the line else if (player.ship.hud != this.normalHud){ with else if (player.ship.hud == this.distHud) {
I see a possible problem, but can't think of a situation it will happen. When does compassTarget return null exactly? I mean when showMessage is run, there is always a check for the ASC. Am I not getting something? Better include it anyway .Wildeblood wrote:Secondly, at the very top of the this.showMessage() function, insert if (!player.ship.compassTarget) return; as the first line off the function, above - not replacing - the existing first line (about line 146 in the script, IIRC). Spara, Tichy, that second is a bug fix that needs to go into the script regardless of whether you care about making it compatible with Sniper Sight.
I agree with your reasoning (so I tried something else first, which didn't work), but when I actually tried it, that didn't seem to be a problem. For example, in one test I targeted a rock hermit (which has scan class rock, so stays at green alert) and shot it using sniper sight, but it launched a defence ship before it exploded, so then I was at yellow alert. That's the situation you're describing, but it worked okay.spara wrote:This will make clear-hud work better with sniper sight, but it will not make them fully compatible. For example next situation causes erratic behaviour.Wildeblood wrote:Firstly, near the end of the this.alertConditionChanged() function, replace the line else if (player.ship.hud != this.normalHud){ with else if (player.ship.hud == this.distHud) {
Green state, distHud on. Switch sniper sight on (target buoy for example). Then state goes to yellow, which normally would cause switch to normalHud, but that does not happen because hud is not distHud anymore. Switch sniper sight off. Sniper sight restores distHud, when it should be normalHud.
Compass target is undefined when you are docked, whenever the compass is not drawn on the HUD, and when you are in interstellar space.spara wrote:I see a possible problem, but can't think of a situation it will happen. When does compassTarget return null exactly? I mean when showMessage is run, there is always a check for the ASC. Am I not getting something? Better include it anyway .Wildeblood wrote:Secondly, at the very top of the this.showMessage() function, insert if (!player.ship.compassTarget) return; as the first line off the function, above - not replacing - the existing first line (about line 146 in the script, IIRC). Spara, Tichy, that second is a bug fix that needs to go into the script regardless of whether you care about making it compatible with Sniper Sight.