[Release] Clear HUD 1.3 and Sniper Sight for Clear HUD

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Tichy
---- E L I T E ----
---- E L I T E ----
Posts: 345
Joined: Wed Jul 11, 2012 5:48 pm

Re: [Release] Clear HUD

Post by Tichy »

Uploaded a new version with persistent log screen :)
User avatar
Rese249er
---- E L I T E ----
---- E L I T E ----
Posts: 647
Joined: Thu Jun 07, 2012 2:19 pm
Location: Well, I WAS in G3...

Re: [Release] Clear HUD

Post by Rese249er »

another_commander wrote:
...you can make it persistent if you want. Just set the permanent key to yes...
I was not aware of that! To the text editor!
Got all turned around, lost my nav connection... Where am I now?
User avatar
Tichy
---- E L I T E ----
---- E L I T E ----
Posts: 345
Joined: Wed Jul 11, 2012 5:48 pm

Re: [Release] Clear HUD

Post by Tichy »

Another new version (now with version number! :D).
Download here: https://www.box.com/s/8m0m4f3rxw1xwl2qcd1r

- Integrated cim and spara's Talkative space compass with distances and time calculation.
It works exactly like in Aad-HUD. When condition is green, it shows constantly the distance and the time to arrive.

- Cyan crosshair when condition is yellow or red. Dark grey in green condition.
We need a bright crosshair only when fighting. :)

- Additional upper shileds and energy indicators in yellow and red conditions.
Useful when fighting, as we don't have to move the eyes to the extreme left side of the screen to see the shields and enegy state.

New screenshots in the first post :)
User avatar
Gimbal Locke
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jan 08, 2012 11:32 pm
Location: Brussels
Contact:

Re: [Release] Clear HUD

Post by Gimbal Locke »

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.

(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.)
User avatar
Tichy
---- E L I T E ----
---- E L I T E ----
Posts: 345
Joined: Wed Jul 11, 2012 5:48 pm

Re: [Release] Clear HUD

Post by Tichy »

You see the crosshair changing, when the script switches the hud.
But, I have no idea how to fix the problem with Sniper Sight. :oops:
At the moment, my scripting capabilities are quite limited...

However, I prefer to not integrate Sniper Sight. I like to keep the hud as simple as possible. But everyone is free to take the hud, modify and release modified versions at will. I'll be glad to try and use any variantion and improvement. :)
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: [Release] Clear HUD

Post by Wildeblood »

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.
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.
The problem is the last two lines of this function in Spara's script:-

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;
	}
}
Near the top it checks for 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...

Replacing the line 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.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] Clear HUD

Post by spara »

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.
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.
The problem is the last two lines of this function in Spara's script:-

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;
	}
}
Near the top it checks for 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...

Replacing the line 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 :roll:. It's probably from experimenting with more than two switching huds.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] Clear HUD

Post by spara »

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 :roll:. It's probably from experimenting with more than two switching huds.
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?

Another clitch is that sniper zoom switches to it's own hud, which will cause message and comms logs to be under/over hud. To make it flawless, one should integrate the sniper zoom into the hud.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: [Release] Clear HUD

Post by Wildeblood »

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.
To make it compatible you need to change two lines of the script in Clear HUD.

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

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.
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.
Easy, peasy. I'll make up the necessary HUD files for you sometime this week.
User avatar
Gimbal Locke
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jan 08, 2012 11:32 pm
Location: Brussels
Contact:

Re: [Release] Clear HUD

Post by Gimbal Locke »

Wildeblood wrote:
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.
Easy, peasy. I'll make up the necessary HUD files for you sometime this week.
You guys are far beyond and above awesome!
User avatar
Tichy
---- E L I T E ----
---- E L I T E ----
Posts: 345
Joined: Wed Jul 11, 2012 5:48 pm

Re: [Release] Clear HUD

Post by Tichy »

I just uploaded an updated version with the script patched as taught by Wildeblood. :)
https://www.box.com/s/8m0m4f3rxw1xwl2qcd1r

Could you please try it and tell me if it works correctly?

Edit: In the new version (1.1-2) I moved the additional energy and shields gauges to the bottom. Now they are just above the scanner. I'm triyng to find a position where they are easily reachable when fighting.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: [Release] Clear HUD

Post by Wildeblood »

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
User avatar
Tichy
---- E L I T E ----
---- E L I T E ----
Posts: 345
Joined: Wed Jul 11, 2012 5:48 pm

Re: [Release] Clear HUD

Post by Tichy »

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
Ok! My last change was to hud.plist. I'll leave the script unchanged to let the devs track the problem. :)
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] Clear HUD

Post by spara »

Firstly, thank you Wildeblood for taking a close look at the script. I really appreciate it.
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) {
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.

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.

I have an idea how this could be fixed once and for all. I'll do it when I have some quiet spare time on my own. (means that wife and kids sleeping :lol:).
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 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 :).

For the sniper sight, I would like to propose message_gui and comm_log_gui definitions. Otherwise they are inherited from other huds. This would solve the overlapping problem and there would be no need for hud integration. Could there even be a sniperish hud?
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: [Release] Clear HUD

Post by Wildeblood »

spara wrote:
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) {
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.

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.
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:
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 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 :).
Compass target is undefined when you are docked, whenever the compass is not drawn on the HUD, and when you are in interstellar space.
Post Reply