Page 1 of 2

[UPDATED] Sniper Sight OXP

Posted: Sat Jul 23, 2011 3:38 am
by Wildeblood
G'day all. I've got an "all new" version of Sniper Sight. This new version has yet more customization options, and is target sensitive.

Download Sniper Sight 2 OXP here.

On target:

Image

Off target:

Image
Sniper Sight READ ME wrote:
Sniper Sight OXP ver. 2.0
Date: January 24th, 2012


Installation and use:

Place the Sniper Sight OXP - "Sniper Sight 2.0.oxp" - into your "AddOns" folder.

Head to a planet of technical level 10 or above, where you can purchase the Sniper Sight from the ship outfitters. Sniper Sight requires the Advanced Space Compass to function, and will not be offered in the ship outfitters if you do not already have the ASC.

To use the Sniper Sight, first target a distant asteroid normally using the ident computer, then cycle through your Advanced Space Compass to "target mode". Sniper Sight will appear and facilitate more accurate targeting. Please use responsibly - Wildefire Systems does not endorse or condone hostility between spacefarers.

The Wildefire Systems Type 1D Gunsight (a.k.a. Sniper Sight) is the Ooniverse's most customizable high-precision gunsight, however there is no need to edit files to enjoy this high level of user-customization. All of Sniper Sight's configuration options are easily set using in-game menus, and can be changed on the fly.


Operating modes:

Unlike previous versions, Sniper Sight 2 has two distinct modes of operation: "hold" and "automatic release" modes refer to the gunsight's behaviour once a target is destroyed or lost for another reason.

Hold mode: when the current target is destroyed, moves out of scanner range, or the player re-activates the ident computer to seek a new target, Sniper Sight will remain active and the gunsight will immediately re-appear once a new target is acquired. To de-activate Sniper Sight when there is a current target, cycle the advanced space compass out of target mode or press F5, F6, F7 or F8 to go to a "non-flight-view" screen. If there is no current target, do not attempt to cycle the ASC, but you can still de-activate Sniper Sight by momentarily changing to another screen.

Release mode: when the current target is lost or destroyed - including if the player re-activates the target or ident systems - Sniper Sight will immediately be de-activated, and the gunsight HUD will automatically revert to the normal in-flight HUD.


Sniper Sight configuration:

You can change the configuration settings only while Sniper Sight is in use.
While the "Gunsight" HUD is shown, press N (shift-n) until "Customize Gunsight Settings" appears on screen.
Press n to show the configuration options of your Wildefire Systems Type 1D Gunsight on the prime-able equipment menu.

Then press N until "Gunsight Size" appears on screen.
Press n to switch among the six differently sized sights available, or to switch it off completely. Your new setting should take effect immediately.

Then press N until "Gunsight Mode" appears on screen.
Press n to switch the mode of operation between "hold" and "automatic release" modes.

Then press N until "Gunsight Centre" appears on screen.
Press n to switch on the centre mark. Pressing repeatedly will vary the mark through six different sizes, before switching it off again.

Then press N until "Gunsight Opacity" appears on screen.
Press n to alter the transparency among 33%, 40% or 50% opacity. Your new setting should take effect immediately.

Then press N until "Gunsight Contrast" appears on screen.
Press n to alter the brightness of the central higher-contrast patch among six different levels of low, medium or high brightness. Your new setting should take effect immediately.

Then press N until "Gunsight Reticle" appears on screen.
Press n to switch the supplementary reticle (a.k.a. Scanner Targeting Enhancement) on or off. Use of the reticle in Sniper Sight is completely independant of whether you have purchased Scanner Targeting Enhancement for general use.

Then press N until "Gunsight Camera" appears on screen.
Press n to enable the gunsight camera. While the camera is enabled, Sniper Sight will automatically keep a photographic record of all asteroids successfully destroyed. (Image files will be stored in the folder "oolite.app/oolite-saves/snapshots/" on Windows computers.)

Then press N until "Gunsight Centre Colour" appears on screen.
Press n to switch the square centre mark, and the vanes shown in hold mode, from green to yellow.

Then press N until "Gunsight Glow" appears on screen.
Press n to switch the colour the gunsight will glow when on target. When on target, Sniper Sight can glow either bright red or bright green.

Then press N until "Gunsight Sensitivity" appears on screen.
Press n to adjust the target sensitivity of your gunsight among five different settings. There should not normally be any need to adjust this setting.

Once you are satisfied with your choice of settings, press N until "Lock Gunsight Configuration" appears on screen.
Press n to hide the configuration menu of your Wildefire Systems Type 1D Gunsight from the prime-able equipment menu.


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.


Change Log:

2.0 (January 24th, 2012)
Re-started change log for all new version 2. Includes high-contrast centre patch copied from Cmdr Wyvern's MilHUD. Includes half a dozen lines of Javascript copy/pasted from Eric Walch's Tionisla Reporter OXP.
Download Sniper Sight 2 OXP here.

Please post any responses regarding version 2 in this other thread: the all new version 2.

Re: [Release] Sniper Sight

Posted: Sat Jul 23, 2011 4:47 pm
by CommonSenseOTB
Wildeblood, this one is better than the last one. I like the adjustability factor and I like that you have set your hud switching to work even with switching huds such as the numeric hud. :)

I found some problems:

The remove sniper sight feature doesn't work as intended. Here's the relevant lines from the log.

09:18:24.343 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Sniper Sight 1.75.3): Error: Ship.removeEquipment: Invalid arguments ("EQ_TARGET_SCOPE_null_null") -- expected equipment type.
09:18:24.343 [script.javaScript.exception.ooliteDefinedError]: ../AddOns/equip Sniper Sight.oxp/Config/script.js, line 71.

For some reason the reticle is not sensitive until after you make your first targetted shot. Might need to check that.

The sniper sight was damaged in a test combat. Is that supposed to happen?

Also when browsing the scripts I noticed a few deprecated "!=". You might want to change them to "!==" as this has caused problems in oxp's including Save Anywhere3.1.oxp.

Minor problems that should be easy to correct. It is unfortunate that a way can't be found to automatically activate the compass and cycle to the target mode when the target is over a certain range. That would really allow this concept to blossom.

As it is with the problems fixed this will give people a targetting aide that will work with thier existing huds. Good show. :)

Re: [Release] Sniper Sight

Posted: Sat Jul 23, 2011 5:01 pm
by Capt. Murphy
There's nothing wrong with != or == as long as you are comparing like with like (i.e, 2 numbers, or 2 strings). You only need !== or === if it's important that for example 10 the number should not equal "10" the string. Nothing been deprecated - it's standard JS syntax. What has been fixed was a special case with Vector3D values.

Wildeblood the missionVariables need to be checked and if necessary declared in the main script as well in case the player hasn't used the configurator to avoid the error message - although it's not actually a problem the equipment is successfully removed even with the error by line 72.

Maybe something like this just before line 70, and then you can lose line 72.

Code: Select all

if (!missionVariables.sniperScope_Size)
{missionVariables.sniperScope_Size = 4;
missionVariables.sniperScope_Opacity = 4;}

Re: [Release] Sniper Sight

Posted: Sat Jul 23, 2011 5:57 pm
by CommonSenseOTB
You know best Capt.Murphy as my understanding of JS is "crude" at best. I was only trying to help. Wildeblood, please disregard my above post and follow Capt. Murphy's advice to the letter. :wink:

Re: [Release] Sniper Sight

Posted: Sat Jul 23, 2011 6:03 pm
by Capt. Murphy
CommonSenseOTB wrote:
You know best Capt.Murphy as my understanding of JS is "crude" at best. I was only trying to help. Wildeblood, please disregard my above post and follow Capt. Murphy's advice to the letter. :wink:
I wouldn't say that CSOTB - I'm new to JS myself and we are all learning together, and it's the mistakes help you learn. I look at Escort Contracts and Illegal Goods Tweak code both of which grew rather organically and cringe inwardly. They'll probably get a rewrite at some point.

I did take the time to read the whole set of Wikipedia articles on JS last weekend though... :)

Re: [Release] Sniper Sight

Posted: Sat Jul 23, 2011 6:17 pm
by CommonSenseOTB
Capt. Murphy wrote:
CommonSenseOTB wrote:
You know best Capt.Murphy as my understanding of JS is "crude" at best. I was only trying to help. Wildeblood, please disregard my above post and follow Capt. Murphy's advice to the letter. :wink:
I wouldn't say that CSOTB - I'm new to JS myself and we are all learning together, and it's the mistakes help you learn. I look at Escort Contracts and Illegal Goods Tweak code both of which grew rather organically and cringe inwardly. They'll probably get a rewrite at some point.

I did take the time to read the whole set of Wikipedia articles on JS last weekend though... :)
My primary concern was if this doesn't work as I thought it did after 1.75

if(guiScreen != "GUI_SCREEN_STATUS")

but this does

if(guiScreen !== "GUI_SCREEN_STATUS")

then why risk getting the wrong result? I just assume use exactly not equal to prevent problems after 1.75. and get the result I want.

You are right Capt. Murphy, I do still have lots to learn. :wink:

Re: [Release] Sniper Sight

Posted: Sun Jul 24, 2011 4:04 am
by Capt. Murphy
CommonSenseOTB wrote:
My primary concern was if this doesn't work as I thought it did after 1.75
if(guiScreen != "GUI_SCREEN_STATUS")
but this does
if(guiScreen !== "GUI_SCREEN_STATUS")
then why risk getting the wrong result?
Both of these do give the correct result (just double checked with debug console) as they should. Anyway we are in danger of derailing the thread.

Re: [Release] Sniper Sight

Posted: Mon Jul 25, 2011 7:11 pm
by Wildeblood
CommonSenseOTB wrote:
The remove sniper sight feature doesn't work as intended. Here's the relevant lines from the log.

09:18:24.343 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Sniper Sight 1.75.3): Error: Ship.removeEquipment: Invalid arguments ("EQ_TARGET_SCOPE_null_null") -- expected equipment type.
09:18:24.343 [script.javaScript.exception.ooliteDefinedError]: ../AddOns/equip Sniper Sight.oxp/Config/script.js, line 71.
Yes, in the exceptional case of of a player buying the equipment and then re-selling it without using it, an exception will be logged in the log file. The purchased equipment, the extra equipment not visible to the player, and the mission variables are correctly removed. In any case, I've already changed that line of code for the next version, but not because of any concern that it "doesn't work as intended".
CommonSenseOTB wrote:
The sniper sight was damaged in a test combat. Is that supposed to happen?
Give me a break. Every item of equipment that can be purchased on the F3 screen can get damaged in combat. If you don't like paying for repairs, avoid combat. Anyway, why would you take a tool that is plainly stated is intended for asteroid mining into combat? What were you thinking of?

Re: [Release] Sniper Sight

Posted: Tue Jul 26, 2011 11:36 am
by Lone_Wolf
I wondered why you separated the configurator part, then realised you wanted the player to be able to enable / remove the shift+n functionality for this device.

I had a similar problem with my shieldcycler, but used another route to solve it.

Separate basic functionality and configurability over 2 devices, each with there own remove option.
EQ_SNIPER_SCOPE
the scope itself
EQ_SNIPER_SCOPE_CONFIGURATOR
the new part that requires EQ_SNIPER_SCOPE and links to the shift+n script

<edit>
EQ_TARGET_SCOPE_CONFIG_OPACITY & EQ_TARGET_SCOPE_CONFIG_SIZE would now require EQ_SNIPER_SCOPE_CONFIGURATOR, and no longer be linked to the shift+n script.
</edit>

Players that want to configure the scope can buy the configurator , then sell it when desired.
This way you can don't need to split off the shift+n part in a separate oxp.

Re: [Release] Sniper Sight

Posted: Tue Jul 26, 2011 2:14 pm
by Wildeblood
Lone_Wolf wrote:
I wondered why you separated the configurator part, then realised you wanted the player to be able to enable / remove the shift+n functionality for this device.
The shocking truth is, it's in a separate folder because I was for a time using the same config script for this stand-alone OXP and my personal HUD, which of course has Sniper Sight built in. You can of course take the "Scripts" folder out of the configuration OXP and drop it into the main OXP - it will work exactly the same.
Lone_Wolf wrote:
Separate basic functionality and configurability over 2 devices, each with there own remove option.
EQ_SNIPER_SCOPE
the scope itself
EQ_SNIPER_SCOPE_CONFIGURATOR
the new part that requires EQ_SNIPER_SCOPE and links to the shift+n script

<edit>
EQ_TARGET_SCOPE_CONFIG_OPACITY & EQ_TARGET_SCOPE_CONFIG_SIZE would now require EQ_SNIPER_SCOPE_CONFIGURATOR, and no longer be linked to the shift+n script.
</edit>

Players that want to configure the scope can buy the configurator , then sell it when desired.
This way you can don't need to split off the shift+n part in a separate oxp.
Thanks, Lone Wolf. Your comment is interesting, as that's actually what I did first and didn't like it. Aside from the equipment key being EQ_SNIPER_SCOPE_CONFIG, not EQ_SNIPER_SCOPE_CONFIGURATOR, that's exactly what I did. After you bought Sniper Sight, the configurator would appear in the F3 screen (for free). I had a note in the readme file, "Don't forget to grab the configurator too, it's free!" But the whole setup seemed rather lame.

It's a different situation to Shield-Cycler; players will need to configure the sight to their preferences, so the config script shouldn't be optional in-game, even if it's free. It needs to be working the first time they use the the sight. No, the only reason I left it in a separate OXP folder when I uploaded it is so if people settled on one setting they preferred and didn't need it any more they could easily get rid of it. My N-menu gets crowded sometimes.

In the next version, the configuration options are only accessible while the sight is actually in use, so menu crowding is no longer an issue.

Re: [Updated] Sniper Sight

Posted: Sat Jul 30, 2011 12:07 pm
by Wildeblood
I've just uploaded an updated version which has the following changes:

1) A selectable centre mark in the sight is now implemented.
2) Configuration options on the N-menu are now only available while the sight is actually in use.
3) Selection of 6 different sized sights included (the previous version had 5).

The Ooniverse's most configurable precision gun sight

Posted: Thu Nov 10, 2011 4:45 am
by Wildeblood
Version 1.75.3.2 is a minor tweak which allows you to switch the target reticle (a.k.a. Scanner Targeting Enhancement) on or off in Sniper Sight, without affecting its general use.

Re: [Updated] Sniper Sight

Posted: Thu Nov 10, 2011 2:19 pm
by JazHaz
Forgive me asking a noobie question. Does this work independent of your HUD, ie, is it compatible with all HUDs?

Re: [Updated] Sniper Sight

Posted: Thu Nov 10, 2011 3:45 pm
by Wildeblood
JazHaz wrote:
Does this work independent of your HUD, ie, is it compatible with all HUDs?
Most of them, yes:

- It works with any normal static HUD.
- It works with dynamic HUDs that use Thargoid's switching script (Killer Wolf's HUDs* and MilHUD).
- It works with CSOTB's numeric HUD, but I doubt about his more recent ones.

For any static HUD that has its hud.plist file in openstep format it's easy to modify the sniper-hud.plist to match its look, but not so for older ones in XML format (MilHUD, unfortunately, is XML).

* I can't vouch for Killer Wolf's "Phantom", which uses a different script.

Re: [Updated] Sniper Sight

Posted: Mon Nov 21, 2011 9:09 am
by Wildeblood
I've just tweaked it again to remove an irritating bug:-
1.75.3.4 (November 21st, 2011)

Added code to switch back to normal HUD if the player changes the GUI view while Sniper Sight is in use. (Previously Sniper Sight would appear superimposed over the status screen, etc.)
That also means if the gunsight appears when you don't want it to, you can quickly switch it off by pressing F5, F1.