[UPDATED] Sniper Sight OXP

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

Moderators: winston, another_commander

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

[UPDATED] Sniper Sight OXP

Post 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.
Last edited by Wildeblood on Tue Feb 07, 2012 2:15 am, edited 11 times in total.
"Would somebody stop that bloody music!"
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: [Release] Sniper Sight

Post 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. :)
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: [Release] Sniper Sight

Post 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;}
Last edited by Capt. Murphy on Sun Jul 24, 2011 9:21 am, edited 1 time in total.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: [Release] Sniper Sight

Post 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:
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: [Release] Sniper Sight

Post 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... :)
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: [Release] Sniper Sight

Post 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:
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: [Release] Sniper Sight

Post 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.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: [Release] Sniper Sight

Post 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?
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: [Release] Sniper Sight

Post 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.
OS : Arch Linux 64-bit - rolling release

OXPs : My user page

Retired, reachable at [email protected]
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: [Release] Sniper Sight

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: [Updated] Sniper Sight

Post 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).
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

The Ooniverse's most configurable precision gun sight

Post 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.
User avatar
JazHaz
---- E L I T E ----
---- E L I T E ----
Posts: 2991
Joined: Tue Sep 22, 2009 11:07 am
Location: Enfield, Middlesex
Contact:

Re: [Updated] Sniper Sight

Post by JazHaz »

Forgive me asking a noobie question. Does this work independent of your HUD, ie, is it compatible with all HUDs?
JazHaz

Gimi wrote:
drew wrote:
£4,500 though! :shock: <Faints>
Cheers,
Drew.
Maybe you could start a Kickstarter Campaign to found your £4500 pledge. 8)
Thanks to Gimi, I got an eBook in my inbox tonight (31st May 2014 - Release of Elite Reclamation)!
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: [Updated] Sniper Sight

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: [Updated] Sniper Sight

Post 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.
"Would somebody stop that bloody music!"
Post Reply