Law Enforcement Device MKI
  requires Community Mod Pack

For discussion, technical assistance, and suggestions go to:

Thank you for your interest in the Law Enforcement Device MKI (LEMKI) by Bitspring.  
LEMKI currently has one powerful capability, although development continues.  LEMKI 
coordinates the detection capabilities of one or more Advanced Satellites in a 
sector to detect illegal goods and falsified ID signals anywhere within the range 
of the satellites.  When transgressors are detected, their status is immediately 
reported, sector-wide, to maximize the chances of safe apprehension by forces in 
the area.

Please note that sale of this product is limited to Argon police and military 
authorities.  At this time, LEMKI is being released for a limited trial period.
LEMKI's functionality is currently limited and the user may encounter unexpected
operational issues.  Please report any problems immediately.

Developed for:
   X3-Reunion 2.0.02       (REQUIRED)
   Bonus Pack 3.1.05       
   Community Mod Pack 2.01 (REQUIRED)
   Cycrow's Script Manager (REQUIRED)

   CMP Ware:  312 (28;0;0;0;0;312;12363;0;65735;1;1;0;65735;10000;0;0;SS_WARE_SW_CUSTOM12_12;)
   T File:   8760 (448760.xml)
   Page ID:  8760
   Command:   645

you will test it and let me know what issues you encounter.  To set some minds
at ease, however, I've been programming for over 20 years now.  I chose all 
currently unused command and ware slots, page ids, etc. however I will not seek 
official "dibs" on them until such time as folks feel that it is worthy.  Obviously, 
I'd appreciate if other script authors would avoid these for the time being.  At 
least until we see if anyone other than me wants to use this script.  

   Use Cycrow's Script Manager to install the SPK file.

Where to buy:
   LEMKI should be available for purchase at all Argon Equipment docks for ~1.85M to 
players of rank Federation Marshall.

How to use it:
   Once the device is onboard the player's ship, LEMKI Sector Scan can be activated 
in the Command Console in the Piracy section.  Additionally it can be mapped to a key 
in Options->Controls->Interface->Extensions.  (e.g. Shift-F1)

What it does: (other functionality may be implemented in the future)
   When a sector scan is activated (either via mapped keystroke or through the Piracy 
command menu), this script will check all ships within range of your advanced 
satellites in the current sector for one of two conditions:

1) Illegal goods
2) Forged ID signal (pirate smugglers do this, the mangy dogs)

In both cases, their freight is scanned and their false ID signal is jammed (i.e.
Pirate cover is exposed).  A report is then displayed to the pilot.  If the player's
ship is detected by the advanced satellites, then the results will include and be 
sorted by distance to the player's ship.  Additionally, if no ship is currently 
selected, then the nearest detected infraction is selected.

Function notes:
1) Only ships within range of your advanced satellites will be scanned.
2) The farther the ships are from the scanning satellite, the greater the chance
   that infractions will go undetected.  Overlap of satellites does significantly
   improve detection chance.
3) Different races only permit use of this device in their sectors if your notoriety
   with them is sufficient.  This varies from race to race and are understandably 
4) This is an active scan and all ships will know they have been scanned.  Due to 
   this, there is a chance that ships you have scanned will become hostile to your
   satellites, or in especially rare cases to your ship.  Only M5, M4, M3, TS and TP
   ships will currently consider reprisals.  
5) The chances of such attacks vary according to the ownership of the sector and
   the notoriety of the player with the ship owner's race.
6) Non-race sectors (pirate, xenon, etc.) have no limitations on use, however, 
   chances of reprisals are much greater in these sectors.  
7) The chances of a reprisal from scanned Xenon and Kha'ak ships is almost 
   guaranteed.  Pirates and Yaki are significanly more likely to exhibit a hostile
   response than normal race ships.
8) While pirate bases have always tolerated attacks against fighters and smugglers, 
   they will become hostile when you start picking off their transports carrying
   legitimate goods.
9) I strongly recommend use of the satellite replacement functionality of Cycrow's 
   SEWN script to keep your large network of advanced satellites functioning with
   a minimum of effort.

   As this is a fairly powerful script, I've taken many measures (some listed above, 
some just in the planning stages) to balance it.  Many will still consider it a 
cheat script, but my goal is to balance it to the point where people feel it is 
reasonably fair.  (Along the balance lines of the Universe Trader, which some feel 
makes things too easy, and others do not.)

   Nevertheless, it will likely take me a great deal of time (and input) to get the
balancing right on this script.  Right now, I think it leans toward being too
player-friendly.  But I really do not want to have it labeled as a cheat script
if I can help it.  Since it may be over-friendly right now, I recommend folks use
restraint in any active games.  You don't want to ruin your fun!

   If you aren't sure how this script can be abused, and therefore in need of 
properly gameplay balancing, then you just aren't aware how many transports out 
there are actually pirates transporting legitimate goods like crystals.  There are 
a lot of them!

My other concerns:
1) I have not finished the plot, but I worry that the fact that this script can 
   make some ships hostile (not Goners of course) could damage the plotline in
   extremely rare circumstances.  If anyone has input regarding this, be sure not
   to include spoiler information as I really do plan on starting the plot soon. :)
   As unlikely as I think this is, I'd recommend refraining from using the device 
   when on plot missions.
2) I originally envisioned this as Law Enforcement Software MKI, but, unless I'm 
   doing something wrong (entirely possible) the CMP wares are all 1 volume cargo.  
   So I changed "Software" to "Device".  I may change it to "Hardware" or something 
   else later.
3) I've left a ton of debug comments and commented out code in the script.  This
   will all be cleaned out later.
4) I chose the Piracy command menu for two reasons.  First, anti-piracy is 
   piracy related.  Second, there's a lot of extra room in there.  
5) I'm not entirely happy with the equation I'm using for calculating the chance 
   of not detecting a ship.  I'd like the curve to be a little less plateaued and 
   therefore less player-friendly.  I just discovered that there is a floating-
   point library available, which would help immensely.  Of course, I could also 
   just use a lookup table.

*Required ranks to scan in race sectors:
   Argon:   Federation Marshall 
   Boron:   Queen's Knight 
   Split:   Privileged Associated of Rhonkar 
   Paranid: Emperor's Protectorate 
   Teladi:  Venture Capitalist 

Known Bugs:
1) It seems that on rare occasions ghost or duplicate entries will appear in the list.
   This may not be a bug but rather an indication of how X3 stores covered pirate 
   ships.  It seems they have two entries in the sector ship list, one for the real
   Pirate ship and one for the cover.  This makes in-game sense and I may just leave 
   it or, at most, will change the way LEMKI displays them. (Should be resolved)
2) Message arrives from "Unknown".  (Will be fixed in next version thanks to moggy2)
3) Uninstallation message displays a Readtext.  (Will be fixed in the next version)

   There's a more realistic way of handling this, involving an AL script and a network 
of specialized satellites (similar to Cycrow's SEWN script).  This network would 
collect data on ships, the longer they are in range the better the chance of detection, 
and it could report to the player from any sector.  The problem with this is it would 
be rather CPU intensive, as they'd have to cycle very frequently, and not really worth 
the heavy amount of scripting.  I felt that the solution I have here is a pretty decent 
balance between realism and practicality.
   I may very well add new features/commands to the LEMKI, but for the time being I
just want to get the sector scan working as best I can.

Files in Package:
   plugin.lemki.main.xml            (main script)
   setup.plugin.lemki.xml           (setup script)
   lib.bof.lemki.sort.num.2ar.xml   (array sorting script by B-O'F)
   setup.plugin.lemki.uninstall.xml (uninstall script)
   448760.xml                       (t file)

   Use the Script Manager to remove script files.  This should install the uninstall 
script automatically.  After loading a save game, this script should run and remove 
the LEMKI ware from all ships and stations, and it should remove the command slot 
and hotkey registration.  
   If this doesn't happen, manually copy the uninstall script (available for download 
below) to your X3 scripts directory.  Be sure to remove the uninstall script before
re-installing LEMKI.  You never want both setup.plugin.lemki.xml and 
setup.plugin.lemki.uninstall.xml installed in your scripts directory at the same time.

   All the tutorial authors, I used most of 'em. ;)
   Special thanks to Cycrow (for lots of things) and B-O'F (for the sorting library)

   SPK Package v1.00:
   Uninstall Script v1.00: (Right-click->Save Target As...)