Hell's Knights Guild

Miner Radar

« Older   Newer »
  Share  
EttoreR
view post Posted on 22/8/2010, 23:38




Lo script vi fa vedere tile per tile quale tipo di minerale si può minare. All'inizio non sa il livello della miniera, ma mano che minate con lo script acceso lui memorizzerà il tile e cosa contiene

Non richiede configurazioni particolari, va bene il setting di default

(Lo divido in due perché troppo lungo)

CODICE
;==================================
; Script Name: CyberPope's Mining Radar
; Author: CyberPope
; Version: 4.1c
; Client Tested with: 5.0.1h
; EUO version tested with: 1_50_00 ver 67
; Shard OSI / FS:  OSI & Most Freeshards
; Revision Date: 9/11/06
; Public Release: 10/16/04
; Global Variables Used:
;        *MiningSetup
;        *Color_SHARDNAME_GridArea_Facet#
;        *Loc_SHARDNAME , Index#
;        *DBW_SHARDNAME , Facet#
;        *CPMR_Export
;        *CPMR_Import
;        *CPMR_Smelt
; Purpose: To select by tile where you want to mine,
; record ore types for mining locations, and to write
; UOAutoMap .map files
; Copyright: 2004/10/16 CyberPope
;==================================
gosub getGlobalVar MiningSetup CPMR SAME LPC NOLOCK
if ! #result
       {
       set %­LPC 1000
       gosub putGlobalVar MiningSetup CPMR SAME LPC NOLOCK
       }
set #lpc %­lpc
;***********User Defined Variables**************
;If you want to be able to attempt to dig any tile, set this
;to true. You can use this to test noname and others to
;see if they are digable. this is also a sort of debug
;option for identifying nonamed tiles.
       set %dig_all #false

;Set this to #false if you do not want the script to check
;Your UOAM path for bad characters
       set %­PathCheck #true

;************Error Messages**********************
;use these to help customize the mining error messages for
;your freeshard if needed.

;attempting to mine while mounted
       set %­mount_error you_can't_mine_while_riding
;cannot see location
       set %cantsee_error you_cannot_see_that_location
       set %cantsee_error2 target_cannot_be_seen
       set %cantsee_error3 you_have_moved_too_far_away
;too far away
       set %­too_far_error that_is_too_far_away
;Unmineable tile type (please inform me if these appear)
       set %­unminable_error you_can't_mine_there
       set %­unminable_error2 you_can't_mine_that
;Out of Ore
       set %­NoOre_error there_is_no_metal_here_to_mine
;Out of Sand
       set %­NoSand_error there_is_no_sand_here_to_mine
;Backpack full messages
       set %Full1_error your_backpack_is_full
       set %Full2_error your_backpack_can't_hold

;*****Ore Type Variables************
       set %­PreOre You_dig_some_
       set %­PostOre _ore

       set %­Number_of_OreTypes 9
       set %­NameOreType0 Unknown_Ore
       set %­TextOreType0 ?
       set %ColorOreType0 Gray
       set %­TextColorOreType0 blue
       set %­NameOreType1 Iron
       set %ColorOreType1 $DCDCDC
       set %­TextOreType1 I
       set %­TextColorOreType1 black
       set %­NameOreType2 Dull_Copper
       set %ColorOreType2  5267296
       set %­TextOreType2 D
       set %­TextColorOreType2 white
       set %­NameOreType3 Copper
       set %ColorOreType3 5209999
       set %­TextOreType3 C
       set %­TextColorOreType3 lime
       set %­NameOreType4 Shadow_Iron
       set %ColorOreType4 5193792
       set %­TextOreType4 S
       set %­TextColorOreType4 white
       set %­NameOreType5 Bronze
       set %ColorOreType5 3100783
       set %­TextOreType5 B
       set %­TextColorOreType5 white
       set %­NameOreType6 Golden
       set %ColorOreType6 $00D7FF
       set %­TextOreType6 G
       set %­TextColorOreType6 black
       set %­NameOreType7 Agapite
       set %ColorOreType7 $C1B6FF
       set %­TextOreType7 A
       set %­TextColorOreType7 Black
       set %­NameOreType8 Verite
       set %ColorOreType8 $32CD9A
       set %­TextOreType8 Vr
       set %­TextColorOreType8 black
       set %­NameOreType9 Valorite
       set %ColorOreType9 12562319
       set %­TextOreType9 Va
       set %­TextColorOreType9 black

;**FACETS***
       set %facet1 Felucca
       set %facet2 Trammel
       set %facet3 Ilshenar
       set %facet4 Malas
       set %facet5 Tokuno , #spc , Islands

;**Cosmetic Variables**
       ;TILE COLORS
       set %center_tile lime
       set %­noname_color purple
       set %­sand_color $8cb4d2
       set %­water_color blue
       set %­stone_color $696969
       set %dirt_color $13458b
       set %­snow_color white
       set %­rock_color gray
;grass, forests and jungle
       set %­GFJ_color green
       set %cave_color $20a5da
       set %­void_color black
;if a tile hasn't been given a color this is the default
       set %default_color Fuchsia

;** Digable Tiletypes (for ore) that are not labled 'rock' or
;have 'cave' in the tile name  If you find a new one, please PM me with
;the type and/or coords ****
set %digable |220|221|222|223|224|225|226|227|228|229|230|231|236|237|238|239|240|241|242|243|
       +244|245|246|247|252|253|254|255|256|257|258|259|260|261|262|263|268|269|270|271|
       +272|273|274|275|276|277|278|279|286|287|288|289|290|291|292|293|294|296|296|297|
       +321|322|323|324|467|468|469|470|471|472|473|474|476|477|478|479|480|481|482|483|
       +484|485|486|487|492|493|494|495|543|544|545|546|547|548|549|550|551|552|553|554|
       +555|556|557|558|559|560|561|562|563|564|565|566|567|568|569|570|571|572|573|574|
       +575|576|577|578|579|581|582|583|584|585|586|587|588|589|590|591|592|593|594|595|
       +596|597|598|599|600|601|610|611|612|613|1010|1741|1742|1743|1744|1745|1746|1747|
       +1748|1749|1750|1751|1752|1753|1754|1755|1756|1757|1771|1772|1773|1774|1775|1776|
       +1777|1778|1779|1780|1781|1782|1783|1784|1785|1786|1787|1788|1789|1790|1801|1802|
       +1803|1804|1805|1806|1807|1808|1809|1811|1812|1813|1814|1815|1816|1817|1818|1819|
       +1820|1821|1822|1823|1824|1831|1832|1833|1834|1835|1836|1837|1838|1839|1840|1841|
       +1842|1843|1844|1845|1846|1847|1848|1849|1850|1851|1852|1853|1854|1861|1862|1863|
       +1864|1865|1866|1867|1868|1869|1870|1871|1872|1873|1874|1875|1876|1877|1878|1879|
       +1880|1881|1882|1883|1884|1981|1982|1983|1984|1985|1986|1987|1988|1989|1990|1991|
       +1992|1993|1994|1995|1996|1997|1998|1999|2000|2001|2002|2003|2004|2028|2029|2030|
       +2031|2032|2033|2100|2101|2102|2103|2104|2105|1339|1340|1341|1342|1343|1344|1345|
       +1346|1347|1348|1349|1350|1351|1352|1353|1354|1355|1356|1357|1358|1359|

set %­sand |22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|
       +48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|68|69|70|71|72|73|74|75|286|287|288|289|
       +290|291|292|293|294|295|296|297|298|299|300|301|402|424|425|426|427|441|442|443|444|
       +445|446|447|448|449|450|451|452|453|454|455|456|457|458|459|460|461|462|463|464|465|
       +642|643|644|645|650|651|652|653|654|655|656|657|821|822|823|824|825|826|827|828|833|
       +834|835|836|845|846|847|848|849|850|851|852|857|858|859|860|951|952|953|954|955|956|
       +957|958|967|968|969|970|1447|1448|1449|1450|1451|1452|1453|1454|1455|1456|1457|1458|
       +1611|1612|1613|1614|1615|1616|1617|1618|1623|1624|1625|1626|1635|1636|1637|1638|1639|
       +1640|1641|1642|1647|1648|1649|1650|

;these are noname tiles that should be the same color as the
;variable name would suggest
set %dirt |16337|1946|
set %­water |100|97|93|89|85|81|77|78|86|98|90|96|95|88|84|76|83|
+91|87|99|79|82|94|92|80|
set %forest |15855|15856|15854|15853|2506|2501|2511|2508|2500|
+2510|2502|2507|15809|15844|15842|15849|15851|15852|15850|
+15843|15839|15846|15836|15845|15835|2509|2504|2503|2505|
+15838|15810|15848|
set %­void |580|

;Tiletypes that may also contain cave tiles that are not rock
set %cavesearch |2|2028|430|475|

;Static Forge Types
set %­STA_TotalForge _6522_6526_6530_6534_6538_6542_6546_6550_6554_6558_6562_6566_4017_

;*******End User Defined Variables**************
;======================================
;**Edit below this point, only if you know what you are doing**
;======================================

tile init
gosub ShardCheck
set %­lcharposx n/a
set %­lcharposy n/a
set %­space #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc
set %Boffsetx 5
set %Boffsety 5
set %­wait #scnt + %delay
if %­record
       set %­recorded_tiles |
if %­TrackOreTypes
       set %­ProToolUsed #false

;*** Start Main Script ***************************
MainLoop:
wait 1
;set #menubutton Options
if %­showFB && %­smeltonFB && %currentgrid <> n/a
       {
       Finditem %firebeetleID
       if #findkind <> -1 && #finddist < 5 && %­lastBeetleLoc <> #findx , _ , #findy
               {
               menu delete FireBeetleID
               gosub DrawObjectOnGrid button #findx #findy $008cff black FB FirebeetleID
               set %­lastBeetleloc #findx , _ , #findy
               }
       if #findkind <> -1 && #findbagid = #charid
               {
               menu delete firebeetleID
               set %­lastBeetleLoc n/a
               }
       }
if #menubutton <> n/a
       {
       if forge in #menubutton || #menubutton = firebeetleid
               {
               gosub SmeltOnObject % . #menubutton
               set #menubutton n/a
               goto MainLoop
               }
       if #menubutton = options
               {
               gosub Options
               set #menubutton n/a
               goto MainLoop
               }
       if %­record && #menubutton = reset
               {
               set %­recorded_tiles |
               gosub ClearGrid
               gosub DrawGrid
               set #menubutton n/a
               goto mainloop
               }
       if #menubutton = closed
               gosub ending
       if ! %­TrackOreTypes
               {
               menu get prospect
               if #menures
                       set %­useProTool #true
               }
       if button in #menubutton
               gosub dig
       if ! %dig_all
               {
               menu set DigX -
               menu set DigY -
               menu set Digz -
               menu set TileT -
               menu set LTK -
               }
       set #menubutton n/a
       }
if %­lcharposy <> #charposy || %­lcharposx <> #charposx
       {
        set %­lcharposx #charposx
           set %­lcharposy #charposy
       menu set CurX #charposx
       menu set CurY #charposy
       set %­wait #scnt + %delay
       goto mainloop
       }
if #scnt < %­wait
       goto mainloop
if %currentgrid = #charposx , _ , #charposy
       {
       set %­wait #scnt + %delay
       goto mainloop
       }
else
       {
       gosub ShardCheck
       gosub ClearGrid
       set %button 0
       gosub DrawGrid
       }
set %­wait #scnt + %delay
goto MainLoop
;********End Main Script ****************************


;*****************
;*****SUBS*****
;*****************


;*****SUB INITMENU*****
sub initmenu
menu font transparent #true
menu window title CP's Mining Radar
set #menubutton n/a
menu clear
if ! %dig_all
       ;menu hideeuo
menu window size 225 285
menu window color btnface
menu font bgcolor btnface
menu font transparent #true
menu font color black
menu font style b
menu font size 8
menu text m1 5 230 Cur-X:
menu text m1 5 240 Cur-Y:
menu text m1 97 230 Dig-X:
menu text m1 97 240 Dig-Y:
menu text m1 97 250 Dig-Z:
menu text m1 94 260 Tile-T:
menu text m1 90 270 lt-Kind:
menu text m1 5 215 Status:
if ! %­TrackOreTypes
       menu check prospect 5 268 75 17 #true Prospect
else
       {
       menu font color red
       menu text prospect 5 270 ++Track Ore++
       }
menu font color blue
menu text status 49 215 -
menu text CurX 44 230 #charposx
menu text CurY 44 240 #charposy
menu text DigX 134 230 -
menu text DigY 134 240 -
menu text DigZ 134 250 -
menu text TileT 134 260 -
menu text LTK 134 270 -
menu font color black
if %­record
       menu button reset 172 240 50 20 Reset
menu button options 172 262 50 20 Options
menu show
return

;*****SUB DRAWGRID*****
Sub DrawGrid
menu set status Drawing Grid
set %­gTime #systime
set %­startx #charposx - 4
set %­starty #charposy - 4
set %currentgrid #charposx , _ , #charposy
set %facet #curskind + 1
for %­x 0 8
       {
       set %coordx %­startx + %­x
       if ( %coordx % %­shardtype ) = 0 && %­shardtype <> 1
               {
               set %­lineX %­x * 23 + 8
               menu shape line %­lineX 3 2 208 3 7 5 red 3 red
               }
       for %­y 0 8
               {
               set %coordy %­starty + %­y
               if ( %coordy % %­shardtype ) = 0 && %­x = 8 && %­shardtype <> 1
                       {
                       set %­lineY %­y * 23 + 3
                       menu shape line 8 %­lineY 208 2 3 7 5 red 3 red
                       }
               set %­gridx %­x * 23 + 5
               set %­gridy %­y * 23
               tile get %coordx %coordy 1 #curskind
               tile cnt %coordx %coordy #curskind
               set %coordz #tilez
               set %dighere #false
               gosub colorcheck
               if %dighere
                       {
                       if %­record || %­TrackOreTypes || %DisplayColorOnTile || %DisplayTextOnTile
                               {
                               gosub convertXxX %coordx %coordy %­shardtype
                               set %­tileArea #result
                               }
                       if %­record
                               {
                               if | , %­tileArea , |  in %­recorded_tiles && ( %color = %cave_color || %color = %­rock_color )
                                       {
                                       set %color %­record_color
                                       set %dighere #false
                                       if ! %dig_all
                                               goto nodighere
                                       }
                               }
                       if ( %­TrackOreTypes || %DisplayColorOnTile || %DisplayTextOnTile ) && %color <> %­sand_color
                               {
                               set %currentLoc %­tileArea , _ , %facet
                               if % . %currentLoc = n/a
                                       {
                                       gosub DBArea %coordx %coordy %facet
                                       gosub getGlobalVar Color_ , #result CPMR SAME %currentLoc NOLOCK
                                       if ! #result
                                               {
                                               set % . %currentloc 0
                                               set %currentcolor 0
                                               }
                                       if _ in % . %currentLoc
                                               set %currentcolor 1
                                       }
                               set %currentColor % . %currentLoc
                               if _ in % . %currentLoc
                                       set %currentcolor 1
                               if %DisplayColorOnTile && ( %color <> %cave_color || ( %color = %cave_color && %currentcolor <> 0 ) )
                                       set %color %ColorOreType . %currentColor
                               }
                       displaycolor:
                       if %­TestZAxis && %dighere && ! %dig_all
                               {
                               set %­zAxistest %coordz - #charposz abs
                               if %­zAxistest > 19
                                       {
                                       set %dighere #false
                                       goto nodighere
                                       }
                               }
                       if %coordx = #charposx && %coordy = #charposy
                               set %color %center_tile
                       menu font bgcolor %color
                       menu font color %color
                       set %button %button + 1
                       set %button . %button %coordx , | , %coordy , | , %coordz , | , #tiletype , | , %­index
                       set %buttonx %­gridx + %Boffsetx
                       set %buttony %­gridy + %Boffsety
                       if %DisplayTextOnTile && %color <> %­sand_color && %color <> %center_tile
                               {
                               if ! %DisplayColorOnTile
                                       menu font color black
                               if %DisplayColorOnTile
                                       menu font color %­TextColorOreType . %currentcolor
                               menu button button , %button %buttonx %buttony 21 21 %­TextOreType . %currentcolor
                               }
                       else
                               menu button button , %button %buttonx %buttony 21 21 -
                       }
               nodighere:
               if %coordx = #charposx && %coordy = #charposy
                               set %color %center_tile
               if ! %dighere
                       menu shape m2 %­gridx %­gridy 30 30 6 6 10 %color 7 %color
               }
       }
gosub FindForges
set %­gTime #systime - %­gTime
str len %­gtime
set %dot #strres - 2
str del %­gtime #strres 1
str ins #strres #dot %dot
menu set status Grid Drawn in #strres , #spc , seconds
Return

;*****SUB DRAWOBJECTONGRID****
sub DrawObjectOnGrid
; %1 Button or Square
; %2 World X
; %­3 World Y
; %­4 ObjectColor
; %­5 Text Color
; %­6 Button Text
; %­7+ Object Name for button
namespace push
namespace local DOoG
set !gridx ( %2 - ( #charposx - 4 ) ) * 23 + 5
set !gridy ( %­3 - ( #charposy - 4 ) ) * 23
if %1 = button
       {
       set !gridx !gridx + %boffsetx
       set !gridy !gridy + %boffsety
       }
else
       {
       menu shape m2 !gridx !gridy 30 30 6 6 10 %­4 7 %­4
       goto endDOoG
       }
if %0 > 7
       {
       for !button 8 %0
               {
               set %­7 %­7 , % . !button
               }
       }
menu font bgcolor %­4
menu font color %­5
menu button %­7 !gridx !gridy 21 21 %­6
menu font color black
menu font bgcolor btnface
endDOoG:
namespace clear
namespace Pop
Return

;****SUB FINDFORGES*****
Sub FindForges
if %­showforge
       {
       set %forgeNum 0
       FindForgesLoop:
       finditem %forgetypes G_ , %­SmeltDist
       if #findkind = -1
               goto EndForgeSearch
       set %ForgeNum %ForgeNum + 1
       set %forge . %forgeNum #findid
       gosub DrawObjectOnGrid button #findx #findy black red F forge , %forgenum
       ignoreitem #findid Forges
       goto FindForgesLoop
       EndForgeSearch:
       ;static forgesearch
       if %­staticForgeCheck
               {
               namespace push
               namespace local findforges
               set !dist %­smeltdist
               if %­smeltDist > 4
                       set !dist 4
               set !negDist !dist * -1
                for !x !negdist !dist
                       {
                             for !y !negdist !dist
                                     {
                                       set !actualX #charposx + !x
                                       set !actualY #charposy + !y
                                       tile cnt !actualX !actualY #curskind
                                       if #tileCnt > 1
                                               {
                                                 for !i 2 #tileCnt
                                                         {
                                                           tile get !actualX !actualY !i #curskind
                                                           if _ , #tileType , _ in %­STA_TotalForge
                                                                   {
                                                       set %forgenum %forgenum + 1
                                                       gosub drawObjectOnGrid button !actualx !actualy black red F Forge %forgenum
                                                       set %forge . %forgenum !actualx , _ , !actualy , _ , #tilez , _ , #tiletype
                                                                   }
                                                         }
                                               }
                                     }
                           }
               namespace clear
               namespace pop
               }
       ignoreitem reset Forges
       }
Return

;*****SUB CONVERTXxX******
sub ConvertXxX
set %1 %1 / %­3 * %­3
set %2 %2 / %­3 * %­3
return %1 , _ , %2

;*****SUB COLORCHECK*****
sub colorcheck
set %­index 2
set %color %default_color
if | , #tiletype , | notin %digable
       {
       str len #tilename
       if #strres = 0
               set %color %­noname_color
       if stone in #tilename
               set %color %­stone_color
       if water in #tilename || | , #tiletype , | in %­water
               set %color %­water_color
       if sand in #tilename
               {
               set %color %­sand_color
               if | , #tiletype , | in %­sand && %­mine_sand
                       set %dighere #true
               }
       if dirt in #tilename || | , #tiletype , | in %dirt || wood in #tilename || #tilename = embank
               set %color %dirt_color
       if jungle in #tilename || grass in #tilename || | , #tiletype , | in %forest || forest in #tilename
               set %color %­GFJ_color
       if snow in #tilename || marble in #tilename
               set %color %­snow_color
       if void in #tilename || nodraw in #tilename || unused in #tilename || #tilename = cave_exit || | , #tiletype , | in %­void
               set %color %­void_color
       }
if | , #tiletype , | in %digable
       {
       set %dighere #true
       set %color %­rock_color
       }
if #tilename = rock && #tilecnt > 1
       {
       for %cnt 2 #tilecnt
               {
               tile get %coordx %coordy %cnt
               if cave in #tilename && | , #tiletype , | in %digable
                       {
                       set %coordz #tilez
                       set %color %cave_color
                       set %­index 3
                       set %dighere #true
                       }
               }
       }
if %coordx < 0 || %coordy < 0
       set %color btnface
gosub SpecialCases
if %dig_all
       set %dighere #true
return

;*****SUB DIG*****
sub dig
if %­record
       menu delete reset
menu delete options
menu font bgcolor red
menu font color yellow
menu button stop 172 240 50 20 Stop
menu font bgcolor btnface
menu font color black
gosub string exp % . #menubutton | dig
;set %dig3 1000
menu set digx %dig1
menu set digy %dig2
menu set digz %dig3
menu set tileT %dig4
menu set LTK %dig5
gosub ShardCheck
gosub IgnoreGargs
if %­TrackOreTypes
       {
       set %CurrentOreType 0
       set %­TrackThisSpot #false
       set %facet #curskind + 1
       gosub convertXxX %dig1 %dig2 %­shardtype
       set %currentLoc #result , _ , %facet
       if % . %currentLoc = 0
               {
               gosub DBarea %dig1 %dig2 %facet
               gosub getGlobalVar Color_ , #result CPMR SAME %currentLoc NOLOCK
               if ! #result
                       set % . %currentloc 0
               }
       if _ notin % . %currentloc && % . %currentLoc <> 0
               set %CurrentOreType % . %currentLoc
       if % . %currentLoc <= 1
               set %­TrackThisSpot #true
       if _ in % . %currentloc
               set %currentOreType 1
       }
menu set status DIGGING
OpenStatusDig:
if #weight = n/a
       {
       event macro 8 2
       wait 20
       if #weight = n/a
               goto OpenStatusDig
       }
set %­Jstart #jindex
dig:
if %autosmelt && #weight > %­SmeltWeight
       {
       finditem %forgetypes G_ , %­smeltDist
       if %­smeltonFB
               finditem %forgetypes , _ , %FireBeetleID G_ , %­smeltDist
       if #findkind <> -1
               gosub SmeltonObject #findid
       }
if #menubutton = firebeetleID || forge in #menubutton
       gosub SmeltOnObject % . #menubutton
finditem WWF_TWF_QPF_NPF c
if #findkind = -1
       {
       menu delete stop
       menu font color black
       menu font bgcolor btnface
       if %­trackoretypes && %­TrackThisSpot && %CurrentOreType > 1
                       {
                       if %­record
                               menu button reset 172 240 50 20 Reset
                       gosub TrackOreColor
                       gosub cleargrid
                       gosub drawgrid
                       }
       menu set status NO DIGGING TOOL FOUND
       menu button options 172 262 50 20 Options
       display ok You do not have any digging tools,
               +$please get some and continue
       return
       }
set #lobjectid #findid
set #ltargetkind %dig5
set #ltargetx %dig1
set #ltargety %dig2
set #ltargetz %dig3
set #ltargettile %dig4
event macro 17
target
event macro 22
wait %­mine_delay
gosub journalcheck
menu get prospect
if #menures && %­useProTool && #menubutton <> stop && ! %­TrackOreTypes
       {
       set %­useProTool #false
       prospect:
       finditem GBG c
       if #findkind <> -1
               {
               event property #findid
               if prospect notin #property
                       {
                       ignoreitem #findid
                       goto prospect
                       }
               set #lobjectid #findid
               event macro 17
               target
               event macro 22
               wait %­mine_delay
               set %­ProToolUsed #true
               }
       }
if #menubutton = stop
       {
       menu set status Mining Halted
       if %­trackoretypes && %­TrackThisSpot && %CurrentOreType > 1
               {
               gosub TrackOreColor
               gosub cleargrid
               gosub drawgrid
               }
       menu delete stop
       menu font color black
       menu font bgcolor btnface
       if %­record
               menu button reset 172 240 50 20 Reset
       menu button options 172 262 50 20 Options
       Return
       }
if #result
       goto dig
else
       {
       set %­ProToolUsed #false
       menu font bgcolor btnface
       menu font color black
       menu delete stop
       if %­record
               menu button reset 172 240 50 20 Reset
       menu button options 172 262 50 20 Options
       return
       }

;*****SUB JOURNALCHECK*****
sub journalcheck
JournalCheckLoop:
set %­jstart %­jstart + 1
scanjournal %­jstart
if %­mount_error in #journal
       {
       menu set status Dismount and Continue
       return #false
       }
if %cantsee_error in #journal
  {
   if %dig3 <> 1000
      {
      menu set status Adjusting Z-Axis
      set %dig3 1000
      menu set digz 1000
      return #true
      }
   else
       {
             menu set status Cannot Reach that Tile
             return #false
             }
  }
if %­too_far_error in #journal ||  %cantsee_error3 in #journal || %cantsee_error2 in #journal
       {
       menu set status Cannot Reach that Tile
       return #false
       }
if %­unminable_error in #journal || %­unminable_error2 in #journal
       {
       menu set status Not Mineable, report TileType
       return #false
       }
if %­NoOre_error in #journal || %­NoSand_error in #journal
       {
       menu set status Tile out of resources.
       if %­trackoretypes && %­TrackThisSpot && %CurrentOreType <> 0
               {
               gosub TrackOreColor
               If ! %­record
                       {
                       gosub ClearGrid
                       gosub DrawGrid
                       }
               }
       if %­record && %­NoSand_error notin #journal
               {
               gosub convertXxX %dig1 %dig2 %­shardtype
               set %­recorded_tiles %­recorded_tiles , #result , |
               gosub ClearGrid
               gosub DrawGrid
               }
       return #false
       }
if %Full1_error in #journal || %Full2_error in #journal
       {
       menu set status You are too full of ore or sand!!
       if %­trackoretypes && %­TrackThisSpot && %CurrentOreType > 1
               {
               gosub TrackOreColor
               gosub Cleargrid
               gosub Drawgrid
               }
       return #false
       }
if ( %­TrackOreTypes || %DisplayColorOnTile || %DisplayTextOnTile ) && ( %CurrentOreType <= 1 || %CurrentOreType = n/a ) && ! %­ProToolUsed && %­PreOre in #journal && %­PostOre in #journal
       {
       set %CurrentOreType 0
       gosub DetermineOreType
       for %­oresearch 1 %­Number_of_OreTypes
               {
               if #result = %­NameOreType . %­oresearch
                       {
                       if %­oresearch > 1 && %­HaltOnColor
                               set #menubutton stop
                       set %CurrentOreType %­oresearch
                       if _ in % . %currentLoc && %­oresearch = 1
                               set %­TrackThisSpot #false
                       if _ in % . %currentLoc && %­oresearch > 1
                               {
                               set %­TrackThisSpot #true
                               menu set status Ore Type Upgraded!!!
                               set %­upgrade #true
                               str pos % . %currentloc _
                               str del % . %currentloc 1 #strres
                               set %­UpgradeLoc #strres
                               set % . %currentLoc %­oresearch
                               }
                       if %­TrackThisSpot && _ notin % . %currentLoc && ! %­upgrade
                               set % . %currentLoc %­oresearch
                       set %dispOre %­NameOreType . %­oresearch
                       if _ in %dispOre && ! %­upgrade
                               {
                               gosub replace %dispOre _ #spc
                               set %dispore #strres
                               }
                       if ! %­upgrade
                               menu set status DIGGING , #spc , %dispOre
                       }
               }
       if %currentoretype = 0
               {
               menu set status Unknown Ore: #result
               set %­TrackThisSpot #false
               }
       }
if %­jstart >= #jindex
  {
  set %­jstart #jindex
        return #true
        }
goto JournalcheckLoop

****SUB IGNOREGARGS************
Sub IgnoreGargs
if ! %­TrackOreTypes
       {
       ignoreitem reset GargAxe
       Return
       }
FindGargAxe:
finditem QPF_NPF c
if #findkind = -1
       {
       ignoreitem reset NormAxe
       Return
       }
event property #findid
if garg in #property
       ignoreitem #findid GargAxe
else
       ignoreitem #findid NormAxe
goto FindGargAxe

****SUB TRACKORECOLOR***********
sub TrackOreColor
menu set status Recording Location Data
if %­upgrade
       {
       set %­LocIndex %­UpgradeLoc / 300 + 1
       set %­Loc . %­UpgradeLoc %currentloc , _ , % . %currentloc
       set %­upgradedLoc #true
       gosub putGlobalVar Loc_ , %­shard , 1 CPMR SAME UpgradedLoc NOLOCK
       gosub putGlobalVar Loc_ , %­shard , %­LocIndex CPMR SAME Loc , %­UpgradeLoc NOLOCK
       gosub getGlobalVar CPMR_Export CPMR %­shard lastwrite NOLOCK
       if #result
               {
               set %expUpgrade #true
               gosub putGlobalVar CPMR_Export CPMR %­shard ExpUpgrade NOLOCK
               }
       set %expupgrade #false
       set %­upgrade #false
       goto savecolor
       }
gosub getGlobalVar Loc_ , %­shard , 1 CPMR SAME NumLoc NOLOCK
if ! #result
       {
       set %­NumLoc 1
       set %­Loc1 %currentloc , _ , % . %currentloc
       gosub putGlobalVar Loc_ , %­shard , 1 CPMR SAME NumLoc NOLOCK
       gosub putGlobalVar Loc_ , %­shard , 1 CPMR SAME Loc1 NOLOCK
       }
else
       {
       set %­NumLoc %­NumLoc + 1
       set %­LocIndex %­NumLoc / 300 + 1
       set %­Loc . %­NumLoc %currentloc , _ , % . %currentloc
       gosub putGlobalVar Loc_ , %­shard , 1 CPMR SAME NumLoc NOLOCK
       gosub putGlobalVar Loc_ , %­shard , %­LocIndex CPMR SAME Loc , %­NumLoc NOLOCK
       }
if % . %currentloc = 1
               set % . %currentloc 1_ , %­numloc
savecolor:
gosub DBarea %dig1 %dig2 %facet
set %­temp %­shard , %facet
if *DBW_ . %­temp = n/a
       set *DBW_ . %­temp |
if | , %DBwrite , | notin *DBW_ . %­temp
       set *DBW_ . %­temp *DBW_ . %­temp , %DBwrite , |
gosub putGlobalVar Color_ , #result CPMR SAME %currentLoc NOLOCK
menu set status -
Return

*****SUB DETERMINEORETYPE*****
sub DetermineOreType
str len %­PreOre
str del #journal 1 #strres
set %DOTstring #strres
str pos %DOTstring %­PostOre
set %del #strres
str len %DOTstring
str del %DOTstring %del #strres
return #strres

;*****SUB SPECIALCASES*****
sub SpecialCases
;Marble Island Cave
if %coordx >= 1983 && %coordx =< 1992 && %coordy >= 2059 && %coordy =< 2074
       gosub CheckForCave
;Jhelom Fighting Pit
if %coordx >= 1407 && %coordx =< 1421 && %coordy >= 3718 && %coordy =< 3758
       gosub CheckForCave
;Buccaneer's Den
set %bucsarea1 ( %coordx <= 2870 && %coordx >= 2607 && %coordy >= 2238 && %coordy <= 2295 ) && ( #charposz <= -20 )
set %bucsarea2 ( %coordx <= 2657 && %coordx >= 2591 && %coordy >= 2047 && %coordy <= 2238 ) && ( #charposz <= -20 )
set %bucsarea3 ( %coordx <= 2774 && %coordx >= 2657 && %coordy >= 2047 && %coordy <= 2102 ) && ( #charposz <= -20 )
if %bucsarea1 || %bucsarea2 || %bucsarea3
       gosub CheckForCave

;non rock tiles that might have cave tiles
if | , #tiletype , | in %cavesearch && #tilecnt > 1
       gosub CheckForCave

if %coordx >= 2569 && %coordx <= 2573 && %coordy >= 476 && %coordy <= 482 && %color <> %cave_color
       gosub checkForCave
return

;*****SUB CHECKFORCAVE*****
sub CheckForCave
for %­tile 1 #tilecnt
               {
               tile get %coordx %coordy %­tile #curskind
               if cave in #tilename && | , #tiletype , | in %digable
                       {
                       set %coordz #tilez
                       set %dighere #true
                       set %color %cave_color
                       set %­index 3
                       }
               }
Return

;*****SUB CLEARGRID*****
sub ClearGrid
if %button > 0
       {
       for %del 1 %button
               {
               menu delete button , %del
               }
       }
if %forgenum > 0
       {
       for %del 1 %forgenum
               {
               menu delete forge , %del
               }
       }
menu delete firebeetleID
set %­lastbeetleloc n/a
menu delete line
menu delete m2
Return

;****SUB SHARDCHECK*******
sub ShardCheck
if %­lshard = #shard
       return
str len #shard
if #shard = n/a || #strres = 0
       {
       display ok You must be logged-in to use this script.$
               +Please log in and restart this script.$$
               +Thanks,$
               +CyberPope
       Halt
       }
set %­shard #shard
if #spc in %­shard
       {
       gosub replace %­shard #spc _
       set %­shard #strres
       }
gosub delBadCharacters ?`~@$^&()-+={}[]|\;:'"<.>/ shard
gosub getGlobalvar MiningSetup CPMR %­shard finished NOLOCK
if ! #result
       gosub SetupMenu
else
       gosub GetSavedSetup
set %­lshard #shard
gosub OldDBCheck
gosub initmenu
Return

;*****SUB DELBADCHARACTERS***
Sub DelBadCharacters
namespace push
namespace local DBC
str len %1
set !badtemp %1
for !del 1 #strres
       {
       str left !badtemp 1
       set !curChar #strres
       recheckChar:
       if !curChar in % . %2
               {
               str pos % . %2 !curChar
               str del % . %2 #strres 1
               set % . %2 #strres
               goto recheckChar
               }
       str del !badtemp 1 1
       set !badtemp #strres
       }
namespace clear
namespace pop
Return

;*****SUB SETUPMENU*****
sub SetupMenu
menu font transparent #true
menu window title Mining Radar Setup ( , %­shard , )
set #menubutton n/a
menu clear
menu window size 350 280
menu window color btnface
menu font bgcolor btnface
menu font color blue
menu font size 12
menu font style b
menu text m1 25 3 Welcome to CyberPope's Mining Radar.
menu text m1 60 170 Thank you for trying my script$
               +and don't forget to vote for it!
menu font color black
menu text m1 220 220 CyberPope
menu font size 10

menu text m1 5 40 Settings for %­shard shard were not found.$
               +Options must be set before you can use this script.$$
menu text m1 5 90 Once you have set these options you shouldn't have$
               +to see this menu again for this shard. Instead if you$
               +want to change your options you will be able to do so $
               +by going to the Options section of the main script.
menu button Next 280 250 60 25 Next>>
menu show 200 100
gosub NextLoop
set #menubutton n/a
menurestart:
menu clear
menu font style b
menu button Next 280 250 60 25 Next>>
menu window size 350 280
menu font size 14
menu text m1 5 5 Setup Options
menu font size 11
menu text m1 5 30 Do you wish to make sand tiles digable?:
menu font bgcolor white
menu font size 8
menu list create sand 300 23 30 32
menu list add sand Yes
menu list add sand No
menu list select sand 1
menu list create record 300 200 30 32
menu list add record Yes
menu list add record No
gosub getGlobalVar MiningSetup CPMR SAME record NOLOCK
if ! #result || #record
       menu list select record 1
else
       menu list select record 2
menu font size 11
menu font bgcolor btnface
menu font color blue
menu text m1 5 60 Grid Drawing Delay:
menu text m1 5 120 Mining Delay:
menu text m1 5 175 Record Depleted Tiles?
menu font color black
menu font size 8
menu text m1 150 63 (In Seconds)
menu text m1 105 123 (20 = 1 second)
menu text m1 5 75 This the amount of time you must stand still
               +$before the grid will draw.
menu text m1 5 138 This is the amount of time that you want $to wait between each dig.
menu text m1 5 193 By selecting 'Yes' the script will highlight
               +$previously depleted resources a
               +$designated color. They can be unhighlighted
               +$by pressing the RESET button.
menu font color red
menu text m1 5 100 NOTE: A delay of 0 or 1 will most likely cause lag
menu font color black
menu font size 10
menu font bgcolor white
gosub getGlobalVar MiningSetup CPMR SAME delay NOLOCK
if ! #result
       menu edit delay 300 73 25 2
else
       menu edit delay 300 73 25 %delay
menu edit mine_delay 300 132 25 35
menu font bgcolor btnface
gosub NextLoop
menu delete next
menu get sand
if #menures = 1
       set %­mine_sand #true
else
       set %­mine_sand #false
menu get delay
set %delay #menures
menu get mine_delay
set %­mine_delay #menures
menu get record
if #menures = 1
       set %­record #true
else
       set %­record #false
menu clear
set #menubutton n/a
menu font style b
menu button Next 280 250 60 25 Next>>
menu font size 14
menu text m1 5 5 Tracking Ore Colors
menu font size 12
menu font color green
menu font style bu
menu text m1 5 30 Do You Wish To Track Ore Colors?
menu font size 8
menu font style b
menu font color black
menu text m1 5 50 Enabling Ore Tracking will record each location$
               +you mine and store that information as a persistant$
               +variable. The corresponding tiles will then highlight$
               +a corresponding hue according to the ore type that$
               +is dug up in a previously recorded spot. This script$
               +will not use Prospecting Tools or Gargoyle Pickaxes
menu text m1 5 135 while tracking to better insure proper ore tracking.$$
               +Freesharders, please note that only the 9 standard$
               +ore types on OSI are able to be tracked. If your shard$
               +has other types of ore you can follow my tutorial in the$
               +script's thread on how to add new ores.
menu font bgcolor white
menu font size 8
menu list create track 300 35 30 32
menu list add track Yes
menu list add track No
menu list select track 1
gosub Nextloop
menu delete next
menu get track
if #menures = 1
       set %­TrackOreTypes #true
else
       {
       set %­TrackOreTypes #false
       set %DisplayTextOnTile #true
       set %DisplayColorOnTIle #true
       }
menu clear
set #menubutton n/a
menu font style b
menu button Next 280 250 60 25 Next>>
if %­TrackOreTypes
       {
       menu font size 14
       menu text m1 5 5 Tracking Ore (Options)
       menu font size 12
       menu font color Blue
       menu font style bu
       menu text m1 5 30 Display Text on Tiles?
       menu text m1 5 120 Display Color on Tiles?
       menu font size 8
       menu font style b
       menu font color black
       menu text m1 5 50 This option will add a corresponding letter to each$
                        +digable tile denoting the ore type or a "?" if unknown.$$
                        +Examples:
       menu text m1 5 140 This option will hue the Tile a simiar color based on$
                        +the ore type for that tile.$$
                        +Examples:
       menu font bgcolor gray
       menu font color blue
       set %Bx 70
       menu button n/a %bx 85 21 21 ?
       menu button n/a %bx 198 21 21 ?
       menu font color gray
       menu button n/a %bx 175 21 21 ?
       for %­menu 1 9
               {
               set %Bx %bx + 23
               menu font bgcolor gray
               menu font color black
               menu button n/a %Bx 85 21 21 %­TextOreType . %­menu
               menu font bgcolor %colorOreType . %­menu
               menu font color %ColorOreType . %­menu
               menu button n/a %Bx 175 21 21 -
               menu font color %­TextColorOreType . %­menu
               menu button n/a %Bx 198 21 21 %­TextOreType . %­menu
               }
       menu font bgcolor white
       menu font size 8
       menu list create Dtxt 310 35 30 32
       menu list add Dtxt Yes
       menu list add Dtxt No
       menu list select Dtxt 1
       menu list create Dclr 310 125 30 32
       menu list add Dclr Yes
       menu list add Dclr No
       menu list select Dclr 1
       gosub NextLoop
       menu delete next
       menu get Dtxt
       if #menures = 1
               set %DisplayTextOnTile #true
       else
               set %DisplayTextOnTile #false
       menu get Dclr
       if #menures = 1
               set %DisplayColorOnTile #true
       else
               set %DisplayColorOnTile #false
       menu clear
       set #menubutton n/a
       menu font style b
       menu button Next 280 250 60 25 Next>>
       }
menu font size 14
menu text m1 5 5 More Options
menu font size 12
menu font color green
menu font style bu
menu text m1 5 30 Select Resource Grid
menu text m1 5 165 Select Depleted Tile Color
menu font color blue
menu font style b
menu font color black
menu font size 8
menu text m1 5 50 This will highlight the entire resource grid
               +$after a spot it depleted or an Ore Type has
               +$been tracked. On OSI shards and most Freeshards
               +$this is on an 8x8 basis. Some Freeshards are
               +$different and can be 1x1, 4x4, etc. etc.
menu text m1 5 120 You will have to play around on your Freeshard
               +$to figure out your resource grid area.

menu font color blue
menu text m1 5 185 Only the following color names are valid:
menu font color black
menu text m1 5 198 Aqua, black, blue, fuchsia, gray, green, lime,
               +$maroon, navy, olive, purple, red, silver, teal,
               +$white, yellow or btnface. You can also use a
               +$hexidecimal descriptor. See the EasyUO Docs
               +$for an example.
menu font bgcolor white
menu font size 10
menu combo create ShardStyle 264 50 75
for %­temp 1 12
       {
       menu combo add ShardStyle %­temp , x , %­temp
       }
menu combo select ShardStyle 8
gosub getGlobalVar MiningSetup CPMR SAME record_color NOLOCK
if ! #result
       menu edit record_color 262 210 75 Red
else
       menu edit record_color 262 210 75 %­record_color
gosub Nextloop
menu delete next
menu get ShardStyle
set %­ShardType #menures
menu get record_color
set %­record_color #menures
menu clear
set #menubutton n/a
menu font style b
menu button Next 280 250 60 25 Next>>
menu font size 14
menu text m1 5 5 More Options
menu font size 12
menu font color blue
menu font style bu
menu text m1 5 30 Use Z-Axis Testing?
menu font style b
menu text m1 110 200 (End of Options)
menu font size 8
menu font color black
menu text m1 5 50 On many Freeshards, if the tile you want to dig has$
                +a Z-Axis that is 19 more or less than your current$
               +location, most of the time you will get the message$
               +that you cannot mine that location.
menu text m1 5 110 By selecting YES the script will check each tile as it$
               +draws the radar for tiles that are outside this acceptable$
               +Z-Axis range and will appear as non-digable locations.
menu font bgcolor white
menu list create Axis 310 35 30 32
menu list add Axis Yes
menu list add Axis No
menu list select Axis 1
gosub nextloop
menu delete next
menu get axis
if #menures = 1
       set %­TestZAxis #true
else
       set %­TestZAxis #false
menu clear
menu window title Setup for ( , %­shard , )
menu window size 240 255
menu font size 14
menu font style bu
menu font color red
menu text m1 5 2 Setup Confirmation
menu font style b
menu font size 10
menu font color black
menu text m1 5 30 Sand Tiles are Minable:
menu text m1 5 45 Draw Grid Delay:
menu text m1 5 60 Mining Delay:
menu text m1 5 75 Record Depleted Tiles:
menu text m1 5 90 Track Ore Colors:
if ! %­trackoretypes
       {
       menu font color Gray
       menu text m1 15 105 -Display Text on Tile:
       menu text m1 15 120 -Display Color on Tile:
       menu text m1 190 105 Yes
       menu text m1 190 120 Yes
       menu font color black
       }
else
       {
       menu text m1 15 105 -Display Text on Tile:
       menu text m1 15 120 -Display Color on Tile:
       gosub YesNo %DisplayTextOnTile 190 105
       gosub YesNo %DisplayColorOnTIle 190 120
       menu font color black
       }
menu text m1 5 135 Shard Type:
menu font color blue
menu text m1 190 135 %­shardtype , x , %­shardtype
menu font color black
menu text m1 5 150 Test Z-Axis:
menu text m1 5 173 Depleted Tile Color:
menu shape m2 185 165 30 30 6 6 10 %­record_color 7 %­record_color
gosub YesNo %­mine_sand 190 30
gosub YesNo %­record 190 75
gosub YesNo %­trackOreTypes 190 90
gosub YesNo %­testZAxis 190 150
menu font color blue
menu text m1 190 45 %delay
menu text m1 190 60 %­mine_delay
menu font color Red
menu font size 10
menu text m1 5 200 Do you wish to save these settings?
menu font color black
menu button NO 170 225 60 25 NO
menu button YES 10 225 60 25 YES
finishedLoop:
wait 0
if #menubutton = yes
       {
       menu clear
       menu font color red
       menu font size 10
       menu font style b
       menu window size 225 60
       menu window title Saving Settings
       Menu text m1 5 5 Saving Settings for:
       menu text m1 5 40 Saving:
       menu font color blue
       Menu text m1 5 20 %­shard
       menu text save 55 40 NumShard
       set %finished #true
       gosub getGlobalVar MiningSetup CPMR SAME NumShard NOLOCK
       if ! #Result
               set %­NumShard 1
       else
               set %­NumShard %­NumShard + 1
       gosub putGlobalVar MiningSetup CPMR SAME Numshard NOLOCK
       set %­shard . %­numShard %­shard
       set % . %­shard %­numshard
       menu set save shard , %­Numshard
       gosub putGlobalVar MiningSetup CPMR SAME shard , %­NumShard NOLOCK
       menu set save %­shard
       gosub putGlobalVar MiningSetup CPMR SAME %­shard NOLOCK
       menu set save Mine_Sand
       gosub putGlobalVar MiningSetup CPMR %­shard mine_sand NOLOCK
       menu set save Delay
       gosub putGlobalVar MiningSetup CPMR SAME delay NOLOCK
       menu set save Mine_Delay
       gosub putGlobalVar MiningSetup CPMR %­shard mine_delay NOLOCK
       menu set save Record
       gosub putGlobalVar MiningSetup CPMR SAME record NOLOCK
       menu set save TrackOreTypes
       gosub putGlobalVar MiningSetup CPMR %­shard TrackOreTypes NOLOCK
       menu set save DisplayTextOnTile
       gosub putGlobalVar MiningSetup CPMR %­shard DisplayTextOnTile NOLOCK
       menu set save DisplayColorOnTile
       gosub putGlobalVar MiningSetup CPMR %­shard DisplayColorOnTile NOLOCK
       menu set save ShardType
       gosub putGlobalVar MiningSetup CPMR %­shard ShardType NOLOCK
       menu set save RecordColor
       gosub putGlobalVar MiningSetup CPMR SAME record_color NOLOCK
       menu set save TestZAxis
       gosub putGlobalVar MiningSetup CPMR %­shard TestZAxis NOLOCK
       gosub getGlobalVar MiningSetup CPMR SAME HaltOnColor NOLOCK
       if ! #result
               {
               set %­haltoncolor #false
               gosub putGlobalVar MiningSetup CPMR SAME HaltOnColor NOLOCK
               }
       gosub SmeltingOptions
       menu set save Finished!
       gosub putGlobalVar MiningSetup CPMR %­shard finished NOLOCK
       return
       }
if #menubutton = no
       goto menurestart
if #menubutton = closed
       halt
goto finishedLoop

sub NextLoop
Nextloop:
wait 0
if #menubutton = Next
       return
if #menubutton = Closed
       halt
goto Nextloop

;*****SUB YESNO*****
sub YesNo
if %1
       {
       menu font color green
       menu text m1 %2 %­3 Yes
       }
else
       {
       menu font color red
       menu text m1 %2 %­3 No
       }
Return

;*****SUB GETSAVEDSETUP*****
sub GetSavedSetup
gosub getGlobalVar MiningSetup CPMR %­shard mine_sand NOLOCK
gosub getGlobalVar MiningSetup CPMR SAME delay NOLOCK
gosub getGlobalVar MiningSetup CPMR %­shard mine_delay NOLOCK
gosub getGlobalVar MiningSetup CPMR SAME record NOLOCK
gosub getGlobalVar MiningSetup CPMR SAME record_color NOLOCK
gosub getGlobalVar MiningSetup CPMR %­shard ShardType NOLOCK
if %­shardtype = OSI
       {
       set %­shardtype 8
       gosub putGlobalVar MiningSetup CPMR %­shard ShardType NOLOCK
       }
if %­shardtype = FS
       {
       set %­shardtype 1
       gosub putGlobalVar MiningSetup CPMR %­shard ShardType NOLOCK
       }
gosub getGlobalVar MiningSetup CPMR %­shard TrackOreTypes NOLOCK
gosub getGlobalVar MiningSetup CPMR %­shard DisplayTextOnTile NOLOCK
gosub getGlobalVar MiningSetup CPMR %­shard DisplayColorOnTile NOLOCK
gosub getGlobalVar MiningSetup CPMR %­shard TestZAxis NOLOCK
gosub getGlobalVar MiningSetup CPMR SAME HaltOnColor NOLOCK
if ! #result
       {
       set %­haltoncolor #false
       gosub putGlobalVar MiningSetup CPMR SAME HaltOnColor NOLOCK
       }
gosub SmeltingOptions
Return

;*****SUB SmeltingOptions******
sub SmeltingOptions
gosub getGlobalVar CPMR_Smelt CPMR %­shard SmeltDist NOLOCK
if ! #result
       {
       set %­smeltDist 2
       gosub putGlobalVar CPMR_Smelt CPMR %­shard SmeltDist NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR SAME AutoSmelt NOLOCK
if ! #result
       {
       set %Autosmelt #false
       gosub putGlobalVar CPMR_Smelt CPMR SAME AutoSmelt NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR #CharID SmeltWeight NOLOCK
if ! #result
       {
       set %­SmeltWeight 375
       gosub putGlobalVar CPMR_Smelt CPMR #CharID SmeltWeight NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR #CharID SmeltOnFB NOLOCK
if ! #result
       {
       set %­SmeltOnFB #false
       gosub putGlobalVar CPMR_Smelt CPMR #charID SmeltOnFB NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR #charid ShowFB NOLOCK
if ! #result
       {
       set %­ShowFB #false
       gosub putGlobalVar CPMR_Smelt CPMR #charid ShowFB NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR #CharID FireBeetleID NOLOCK
if ! #result
       {
       set %FireBeetleID n/a
       gosub putGlobalVar CPMR_Smelt CPMR #charID FireBeetleID NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR SAME ShowForge NOLOCK
if ! #result
       {
       set %­ShowForge #false
       gosub putGlobalVar CPMR_Smelt CPMR Same ShowForge NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR SAME ForgeTypes NOLOCK
if ! #result
       {
       set %ForgeTypes JBG_SOJ_ROJ_AUJ_ZTJ_CUJ_BUJ_WTJ_VTJ_KUJ_JUJ_EUJ_DUJ_
                       +GUJ_FUJ_QUJ_PUJ_OUJ_NUJ_YUJ_XUJ_AVJ_ZUJ_UUJ_TUJ_IVJ_
                       +HVJ_CVJ_BVJ_EVJ_DVJ_OVJ_NVJ
       gosub putGlobalVar CPMR_Smelt CPMR Same ForgeTypes NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR SAME OreTypes NOLOCK
if ! #result
       {
       set %­OreTypes TVJ_EWJ_DWJ_GWJ
       gosub putGlobalVar CPMR_Smelt CPMR Same OreTypes NOLOCK
       }
gosub getGlobalVar CPMR_Smelt CPMR SAME StaticForgeCheck NOLOCK
if ! #result
       {
       set %­StaticForgeCheck #false
       gosub putGlobalVar CPMR_Smelt CPMR Same StaticForgeCheck NOLOCK
       }
Return

;*****SUB OPSBUTTONS*****
sub OpsButtons
menu window title CyberPope's Mining Radar , %­space , #spc , #spc , #spc , #spc , #spc , #spc , Options
menu font transparent #true
menu font bgcolor btnface
menu font style b
menu font size 8
menu font color black
menu delete options
menu delete reset
menu delete submit
menu button OpsExit 172 262 50 20 Exit
menu button OpsKey 250 262 55 20 Legend
menu button OpsSettings 310 262 55 20 Settings
menu button OpsImport 310 240 55 20 Import
menu button OpsSmelt 250 240 55 20 Smelt
if exec notin #opts
       {
       menu font color yellow
       menu font bgcolor red
       }
menu button OpsUOAM 370 262 50 20 UOAM
menu button OpsExport 370 240 50 20 Export
menu font size 11
menu font bgcolor btnface
menu font color blue
menu text Select1 270 100 Select A Catagory
menu font size 8
menu font color black
set #menubutton n/a
Return

;***SUB DELETEBUTTONS*****
sub DeleteButtons
menu delete opssettings
menu delete opsUOAM
menu delete opsExport
menu delete opsKey
menu delete opsImport
menu delete opsSmelt
Return

;*****SUB OPTIONS*****
Sub Options
gosub OpsButtons
menu window size 420 285
OpsLoop:
wait 0
if button in #menubutton
       {
       set #menubutton n/a
       display ok You cannot mine until you Exit the Options.
       }
if Ops in #menubutton
       {
       if ! ( ( #menubutton = OpsUOAM || #menubutton = OpsExport ) && exec notin #opts )
               menu delete Select1
       gosub DeleteButtons
       goto #menubutton
       }
goto OpsLoop
;*****SMELT******
OpsSmelt:
menu window title CyberPope's Mining Radar , %­space , Smelt
set #menubutton n/a
menu text OpSm1 225 5 Maximum Smelting Range
menu text OpSm1 225 158 Forge Types
menu text OpSm1 225 183 Add Forge Type
menu text OpSm1 225 208 Ore Types
menu text OpSm1 225 233 Add Ore Type
if ! %autoSmelt
       {
       menu font color gray
       menu text OpSm4 240 40 Weight at Which to Smelt
       menu font color black
       }
else
       menu text OpSm4 240 40 Weight at Which to Smelt
if ! %­SmeltonFB
       {
       menu font color gray
       menu text OpSm8 240 100 Fire Beetle ID
       menu edit OpSm9 370 96 45 %firebeetleid
       menu font color black
       }
else
       {
       menu text OpSm8 240 100 Fire Beetle ID
       menu font bgcolor white
       menu edit OpSm9 370 96 45 %firebeetleid
       menu font color black
       menu font bgcolor btnface
       }
menu button OpSm10 318 97 45 20 Assign
menu button OpSm13 318 181 30 20 Add
menu button OpSm16 318 229 30 20 Add
menu check OpSm3 225 20 300 20 %AutoSmelt Auto Smelt Ore
menu check OpSm6 225 60 300 20 %­SmeltOnFB Smelt on Fire Beetle
menu check OpSm11 225 120 300 20 %­ShowForge Show Forges on Radar
menu check OpSm18 225 135 300 20 %­StaticForgeCheck Check for Static Forges
if ! %­smeltOnFB
       {
       menu font color gray
       menu check OpSm7 240 77 300 20 %­ShowFB Show Fire Beetle on Radar
       menu font color black
       }
else
       menu check OpSm7 240 77 300 20 %­ShowFB Show Fire Beetle on Radar

menu font bgcolor white
menu edit OpSm2 390 1 25 %­smeltDist
menu list Create OpSm12 350 157 65  20
menu edit OpSm14 350 180 65
menu list Create OpSm15 350 205 65  20
menu edit OpSm17 350 228 65
if ! %autosmelt
       {
       menu font bgcolor btnface
       menu font color gray
       menu edit OpSm5 390 36 25 %­smeltWeight
       menu font color black
       menu font bgcolor white
       }
else
       menu edit OpSm5 390 36 25 %­smeltWeight
namespace push
namespace local OpSmelt
set !forgetypes %forgetypes
gosub string exp !forgetypes _ forges #true
for !temp 1 #result
       {
       menu list add OpSm12 !forges . !temp
       }
set !oretypes %­oretypes
gosub string exp !oretypes _ ores #true
for !temp 1 #result
       {
       menu list add OpSm15 !ores . !temp
       }
set !autosmelt %autosmelt
set !smeltOnFB %­smeltOnFB
set !showforge %­showforge
set !showFB %­showFB
set !StaticForgeCheck %­StaticForgeCheck
OpSmeltLoop:
wait 0
if #menubutton = OpsExit
       {
       if !forgetypes <> %forgetypes
               {
               set %ForgeTypes !forgetypes
               gosub putGlobalVar CPMR_Smelt CPMR Same ForgeTypes NOLOCK
               }
       if !oretypes <> %­oretypes
               {
               set %­oreTypes !oretypes
               gosub putGlobalVar CPMR_Smelt CPMR Same OreTypes NOLOCK
               }
       menu getnum OpSm2
       str Len #menures
       if #menures <> %­SmeltDist && #strres <> 0 && #menures < 8
               {
               set %­smeltDist #menures
               gosub putGlobalVar CPMR_Smelt CPMR %­shard SmeltDist NOLOCK
               set %change #true
               }
       menu get OpSm3
       if #menures <> !autosmelt
               {
               set %AutoSmelt #menures
               gosub putGlobalVar CPMR_Smelt CPMR Same AutoSmelt NOLOCK
               }
       menu getnum OpSm5
       str Len #menures
       if #menures <> %­SmeltWeight && #strres <> 0
               {
               set %­smeltWeight #menures
               gosub putGlobalVar CPMR_Smelt CPMR #CharID SmeltWeight NOLOCK
               }
       menu get OpSm6
       if #menures <> !SmeltOnFB
               {
               set %­smeltOnFB #menures
               gosub putGlobalVar CPMR_Smelt CPMR #CharID SmeltOnFB NOLOCK
               }
       menu get OpSm9
       if #menures <> %FireBeetleID
               {
               set %FireBeetleID #menures
               gosub putGlobalVar CPMR_Smelt CPMR #CharID FireBeetleID NOLOCK
               }
       menu get OpSm7
       if #menures <> !ShowFB
               {
               set %­showFB #menures
               gosub putGlobalVar CPMR_Smelt CPMR #CharID ShowFB NOLOCK
               }
       menu get OpSm11
       if #menures <> !showForge
               {
               set %­showforge #menures
               gosub putGlobalVar CPMR_Smelt CPMR Same ShowForge NOLOCK
               }
       menu get OpSm18
       if #menures <> !StaticForgeCheck
               {
               set %­staticForgeCheck #menures
               gosub putGlobalVar CPMR_Smelt CPMR Same StaticForgeCheck NOLOCK
               }
       for !x 1 18
               {
               menu delete OpSm , !x
               }
       namespace clear
       namespace pop
       menu delete opsexit
       gosub OpsButtons
       goto OpsLoop
       }
menu get OpSm7
if #menures <> %­showFB
       {
       set %­showFB #menures
       If %­showFB && %­SmeltonFB
               {
               Finditem %firebeetleID
               if #findkind <> -1 && #finddist < 5 && %­lastBeetleLoc <> #findx , _ , #findy
                       {
                       menu delete FireBeetleID
                       gosub DrawObjectOnGrid button #findx #findy $008cff black FB FirebeetleID
                       set %­lastBeetleloc #findx , _ , #findy
                       }
               if #findkind <> -1 && #findbagid = #charid
                       {
                       menu delete firebeetleID
                       set %­lastBeetleLoc n/a
                       }
               }
       if ! %­smeltonFB || ! %­showFB
               {
               menu delete firebeetleID
               set %­lastBeetleLoc n/a
               }
       }
menu get OpSm11
if #menures <> %­showforge
       {
       set %­showforge #menures
       if %­showforge
               gosub FindForges
       if ! %­showforge && %forgenum > 0
               {
               for !del 1 %forgenum
                       {
                       menu delete forge , !del
                       }
               }
       }
menu get OpSm18
if #menures <> %­StaticForgeCheck
       {
       set %­staticForgeCheck #menures
       if %­staticForgeCheck
               {
               if %forgenum > 0
                       {
                       for !del 1 %forgenum
                               {
                               menu delete forge , !del
                               }
                       }
               gosub findforges
               }
       if ! %­staticForgeCheck && %forgenum > 0
               {
               for !del %forgenum 1
                       {
                       if _ in %forge . !del
                               {
                               menu delete forge , !del
                               set %forgenum %forgenum - 1
                               }
                       }
               }
       }
menu get OpSm3
if #menures <> %autosmelt
       {
       menu delete OpSm4
       menu delete OpSm5
       set %autosmelt #menures
       if ! %autoSmelt
               {
               menu font color gray
               menu text OpSm4 240 40 Weight at Which to Smelt
               menu font bgcolor btnface
               menu edit OpSm5 390 36 25 %­smeltWeight
               menu font color black
               menu font bgcolor white
               }
       else
               {
               menu edit OpSm5 390 36 25 %­smeltWeight
               menu text OpSm4 240 40 Weight at Which to Smelt
               }
       }
menu get OpSm6
if #menures <> %­SmeltOnFB
       {
       menu delete OpSm7
       menu delete OpSm8
       menu delete OpSm9
       set %­smeltOnFB #menures
       if ! %­SmeltonFB
               {
               menu font color gray
               menu font bgcolor btnface
               menu text OpSm8 240 100 Fire Beetle ID
               menu edit OpSm9 370 96 45 %firebeetleid
               menu check OpSm7 240 77 300 20 %­ShowFB Show Fire Beetle on Radar
               menu font color black
               }
       else
               {
               menu text OpSm8 240 100 Fire Beetle ID
               menu font bgcolor btnface
               menu check OpSm7 240 77 300 20 %­ShowFB Show Fire Beetle on Radar
               menu font bgcolor white
               menu edit OpSm9 370 96 45 %firebeetleid
               }
       If %­showFB && %­SmeltonFB
               {
               Finditem %firebeetleID
               if #findkind <> -1 && #finddist < 5 && %­lastBeetleLoc <> #findx , _ , #findy
                       {
                       menu delete FireBeetleID
                       gosub DrawObjectOnGrid button #findx #findy $008cff black FB FirebeetleID
                       set %­lastBeetleloc #findx , _ , #findy
                       }
               if #findkind <> -1 && #findbagid = #charid
                       {
                       menu delete firebeetleID
                       set %­lastBeetleLoc n/a
                       }
               }
       if ! %­smeltonFB || ! !showFB
               {
               menu delete firebeetleID
               set %­lastBeetleLoc n/a
               }
       }
if #menubutton = OpSm13
       {
       menu get OpSm14
       str Len #menures
       if #strres = 0
               {
               display ok You must enter a valid forge type to add!
               set #menubutton n/a
               goto OpSmeltLoop
               }
       if #menures in !forgetypes
               {
               display ok That forge type is already accounted for!
               set #menubutton n/a
               menu delete OpSm14
               menu edit OpSm14 350 170 65
               goto OpSmeltLoop
               }
       set !forgetypes !forgetypes , _ , #menures
       menu list add OpSm12 #menures
       set #menubutton n/a
       menu delete OpSm14
       menu edit OpSm14 350 170 65
       }
if #menubutton = OpSm16
       {
       menu get OpSm17
       str Len #menures
       if #strres = 0
               {
               display ok You must enter a valid ore type to add!
               set #menubutton n/a
               goto OpSmeltLoop
               }
       if #menures in !oretypes
               {
               display ok That ore type is already accounted for!
               set #menubutton n/a
               menu delete OpSm17
               menu edit OpSm17 350 218 65
               goto OpSmeltLoop
               }
       set !oretypes !oretypes , _ , #menures
       menu list add OpSm15 #menures
       menu delete OpSm17
       menu edit OpSm17 350 218 65
       }
If #menubutton = OpSm10
       {
       set #menubutton n/a
       display ok Please Target your Fire Beetle now
       retargetbeetle:
       set #ltargetid a
       event macro 13 3
       target
       if #targcurs <> 1
               {
               wait 40
               goto retargetbeetle
               }
       set !timeout #scnt + 5
       TargetFBLoop:
       wait 0
       if !timeout > #scnt && #ltargetid = a && #targcurs = 0
               {
               display ok Failed to Identify FireBeetle. $
                       +If you'd like to try again, press the Assign Button.
               goto OpsmeltLoop
               }
       if #ltargetid <> a
               {
               finditem #ltargetid
               if #findtype <> jj || ( #findtype = jj && #findcol <> 1161 )
                       {
                       event property #findid
                       display YesNoCancel #property , #spc , $Does not appear to be a Fire Beetle.$
                               +If you are sure this is a fire beetle press Yes to use that ID.$
                               +Otherwise press No to re-target your firebeetle or press Cancel $
                               +to return to the menu.
                       if #dispres = no
                               goto retargetBeetle
                       if #dispres = cancel
                               goto OpSmeltLoop
                       menu set OpSm9 #findid
                       goto OpSmeltLoop
                       }
               menu set OpSm9 #findid
               goto OpSmeltLoop
               }
       goto TargetFBLoop
       }
if #menubutton = closed
       halt
goto OpSmeltLoop
halt

;***EXPORT*****
OpsExport:
menu window title CyberPope's Mining Radar , %­space , Export
set #menubutton n/a
if exec notin #opts
       {
       display ok You cannot use the Export Functions$
               +until you allow EUO to Execute.$$
               +1) Go to the Tools Menu and select Options,$
               +2) Go to the Permissions Tab.$
               +3) Make sure "Disable Execute" is UN-Checked.
       gosub OpsButtons
       goto OpsLoop
       }
gosub getGlobalVar CPMR_Export CPMR SAME EXPORTID NOLOCK
if ! #result
       {
       menu font size 10
       menu font color blue
       menu text exp1 225 3 Export ID
       menu font size 8
       menu font color black
       menu button Next 370 262 50 20 Next >>
       menu text exp1 225 20 Before you can export your data$
                               +you will need to select an ID that $
                               +will Identify who you are to the $
                               +person importing your data.
       menu text exp1 225 80 Your ID should be something the$
                               +person importing would recognize$
                               +like your Easy UO handle.
       menu text exp1 225 125 Your ID name should not contain$
                               +any unusual characters. Stick to$
                               +letters and numbers.
       menu text exp1 225 180 Once set you cannot change your$
                               +Export ID so choose a good one.
       menu font color blue
       menu text exp1 240 227 Enter your desired ID below
       menu font color black
       menu font bgcolor white
       menu edit ID 225 240 180


CODICE
IDLoop:
       Wait 0
       if #menubutton = Opsexit
               {
               menu delete exp1
               menu delete next
               menu delete ID
               gosub opsButtons
               goto OpsLoop
               }
       if #menubutton = closed
               halt
       if #menubutton = next
               {
               menu get ID
               set %ExportID #menures
               gosub replace %exportid #spc _
               set %exportid #strres
               gosub delBadCharacters ?`~@$^&()-+={}[]|\;:'"<.>/ exportid
               str len %exportid
               if #strres = 0
                       {
                       menu delete ID
                       menu edit ID 225 240 180
                       set #menubutton n/a
                       goto IDloop
                       }
               if %exportid <> #menures
                       {
                       Display YesNo Your ID contained unsuitable characters. $
                                       +Your Entry: , #spc , #menures $
                                       +Suggested Entry: , #spc , %ExportID $$
                                       +To use the suggested entry press Yes. $
                                       +To choose a different ID press No.
                       if #dispres = no
                               {
                               menu delete id
                               menu edit ID 225 240 180
                               set #menubutton n/a
                               goto IDloop
                               }
                       }
               menu delete id
               menu delete exp1
               menu delete next
               gosub putGlobalVar CPMR_Export CPMR SAME EXPORTID NOLOCK
               goto ContExport
               }
       goto IDLoop
       }
ContExport:
set #menubutton n/a
gosub getGlobalVar CPMR_Export CPMR SAME ExpPath NOLOCK
if ! #result
       {
       set %ExpPath #Pathdat
       gosub putGlobalVar CPMR_Export CPMR Same ExpPath NOLOCK
       }
gosub getGlobalVar CPMR_Export CPMR %­shard lastFile NOLOCK
if ! #result
       {
       set %­lastfile Import_ , %­shard , .txt
       gosub putGlobalVar CPMR_Export CPMR %­shard lastFile NOLOCK
       }
menu font color black
menu text exp1 225 5 Export ID:
menu text exp1 225 110 Shard
menu text exp1 225 135 Number of Locations:
menu text exp1 225 150 Last Location Written:
menu font style bu
menu text exp1 225 20 Export Path
menu text exp1 225 60 File Name
menu font style b
menu font color blue
menu text exp1 280 5 %ExportID
menu text exp5 350 135 -
menu text exp6  350 150 -
menu font color black
menu font bgcolor white
menu edit Exp2 225 35 190 %ExpPath
menu edit Exp3 225 75 190 %­lastFile
gosub getGlobalVar MiningSetup CPMR SAME NumShard NOLOCK
gosub getGlobalVar MiningSetup CPMR SAME %­shard NOLOCK
menu Combo Create Exp4 260 105 157
gosub FillShardCombo %­numshard % . %­shard Exp4
gosub FillExportData % . %­shard
menu get exp4
set %curExp4 #menures
ExportLoop:
wait 0
if #menubutton = OpsExit
       {
       menu get exp2
       if %ExpPath <> #menures
               {
               set %ExpPath #menures
               gosub putGlobalVar CPMR_Export CPMR SAME ExpPath NOLOCK
               }
       menu get exp4
       set %­temp #menures
       menu get exp3
       if %­lastfile <> #menures
               {
               set %­lastfile #menures
               gosub putGlobalVar CPMR_Export CPMR %­shard . %­temp lastfile NOLOCK
               }
       for %del 0 9
               {
               menu delete Exp , %del
               }
       menu delete opsexit
       gosub OpsButtons
       goto OpsLoop
       }
menu get exp4
if #menures <> %curExp4
       {
       set %curExp4 #menures
       gosub FillExportData #menures
       gosub getGlobalVar CPMR_Export CPMR %­shard . #menures lastfile NOLOCK
       if ! #result
               {
               menu set exp3 IMPORT_ , %­shard . #menures , #dot , TXT
               }
       if #result
               menu set exp3 %­lastfile
       }
if #menubutton = closed
       halt
if #menubutton = exp9
       gosub WriteExportFile
if #result = AddShardData
       {
       menu get exp4
       gosub FillExportData #menures
       set #result n/a
       }
goto ExportLoop

;***IMPORT******
OpsImport:
set #menubutton n/a
namespace push
namespace local Imports
menu window title CyberPope's Mining Radar , %­space , Import
menu shape Opim1 225 107 190 100 4 7 1 black 7 black
menu font color black
menu font style bu
menu text OpIm1 225 5 Last Import Path
menu text OpIm1 225 45 Last File Name
menu font style b
menu font align right
menu font color yellow
menu text OpIm1 295 110 File From:
menu text OpIm1 295 120 Shard:
menu font align left
menu text OpIm1 230 130 Shard Type:
menu text OpIm1 230 140 Last Imported Loc:
menu font color black
menu button OpIm4 225 85 190 20 Get File Data
menu font bgcolor white
menu edit OpIm2 225 20 190
menu edit OpIm3 225 60 190
menu font bgcolor btnface
menu font color lime
menu text OpIm5 300 110 -
menu text OpIm6 300 120 -
menu text OpIm7 300 130 -
menu text OpIm8 340 140 -
menu font color $008cff
menu text OpIm9 240 160 Pease choose a file path and $
                               +file name then press the $
                               +Get File Data button.
gosub getGlobalVar CPMR_Import CPMR SAME ImpPath NOLOCK
if ! #result
       {
       set %­ImpPath #Pathdat
       gosub putGlobalVar CPMR_Import CPMR Same ImpPath NOLOCK
       }
menu set OpIm2 %­ImpPath
gosub getGlobalVar CPMR_Import CPMR SAME lastFile NOLOCK
if ! #result
       {
       set %­lastfile Import_ , %­shard , .txt
       gosub putGlobalVar CPMR_Import CPMR SAME lastFile NOLOCK
       }
menu set OpIm3 %­lastfile
namespace push
namespace Local Import
ImportLoop:
if #menubutton = OpIm4
       gosub GetImportData
if #menubutton = OpIm12
       {
       gosub ImportData
       if #menubutton = OpsImport || #menubutton = OpsExit
               {
               namespace clear
               namespace pop
               goto #menubutton
               }
       }
if #menubutton = closed
       halt
if #menubutton = OpsExit
       {
       menu get OpIm2
       if #menures <> %­impPath
               {
               set %­ImpPath #menures
               gosub putGlobalVar CPMR_Import CPMR Same ImpPath NOLOCK
               }
       menu get OpIm3
       if #menures <> %­lastfile
               {
               set %­lastfile #menures
               gosub putGlobalVar CPMR_Import CPMR SAME lastFile NOLOCK
               }
       for !del 0 12
               {
               menu delete OpIm , !del
               }
       namespace clear
       namespace pop
       menu delete opsexit
       gosub OpsButtons
       goto OpsLoop
       }
wait 0
Goto ImportLoop
;***LEGEND*****
OpsKey:
menu window title CyberPope's Mining Radar , %­space , Legend
menu font size 7
if %displayTextOnTile || %DisplayColorOnTile
       {
       for %­key 0 9
               {
               menu font size 7
               gosub replace %­nameOreType . %­key _ $
               set %­text #strres
               if $ notin %­text
                       set %­texty %­key * 23 + 10
               if $ in %­text
                       set %­texty %­key * 23 + 5
               menu font color black
               menu font bgcolor btnface
               menu text n/a 360 %­Texty %­text
               menu font size 8
               set %buttony %­key * 23 + 5
               if ! %DisplayTextOnTile && %DisplayColorOnTile
                       {
                       menu font bgcolor %colorOreType . %­key
                       menu font color %colorOreType . %­key
                       }
               if %displayTextOnTile && %displayColorOnTile
                       {
                       menu font color %­TextColorOreType . %­key
                       menu font bgcolor %ColorOreType . %­key
                       }
               if %displayTextOnTile && ! %displayColorOnTile
                       menu font color black
               menu button n/a 335 %buttony 21 21 %­textOreType . %­key
               }
       }
if ! %displayTextOnTile && ! %displayColorOnTile
       {
       menu font color %­rock_color
       menu font bgcolor %­rock_color
       menu button n/a 335 5 21 21 -
       menu font color black
       menu font size 7
       menu text n/a 360 5 MINABLE$LOCATION
       }
if %displayTextOnTile
       menu font color blue
else
       menu font color %cave_color
menu font bgcolor %cave_color
menu button n/a 225 5 21 21 ?
if %­mine_sand
       {
       menu font bgcolor %­sand_color
       menu font color %­sand_color
       menu button n/a 225 28 21 21 -
       }
else
       menu shape n/a 220 23 30 30 6 6 10 %­sand_color 7 %­sand_color
menu font bgcolor black
menu font color red
menu button n/a 335 235 21 21 F
menu font bgcolor $008cff
menu font color black
menu button n/a 335 258 21 21 FB
menu font size 7
menu font color black
menu font bgcolor btnface
menu text n/a 250 10 CAVE
menu text n/a 250 33 SAND
menu text n/a 250 56 SNOW
menu text n/a 250 79 DIRT / WOOD
menu text n/a 250 102 WATER
menu text n/a 250 125 STONE
menu text n/a 250 143 VOID / NODRAW$UNUSED
menu text n/a 250 166 GRASS / FOREST$JUNGLE
menu text n/a 250 194 NONAME , #spc , TILE
menu text n/a 250 212 UNDEFINED$TILE , #spc , TYPE
menu text n/a 360 240 FORGE
menu text n/a 360 258 FIRE $BEETLE
If #charname <> n/a
       menu text n/a 250 240 #charname
Else
       menu text n/a 250 240 YOU
menu shape n/a 220 46 30 30 6 6 10 %­snow_color 7 %­snow_color
menu shape n/a 220 69 30 30 6 6 10 %dirt_color 7 %dirt_color
menu shape n/a 220 92 30 30 6 6 10 %­water_color 7 %­water_color
menu shape n/a 220 115 30 30 6 6 10 %­stone_color 7 %­stone_color
menu shape n/a 220 138 30 30 6 6 10 %­void_color 7 %­void_color
menu shape n/a 220 161 30 30 6 6 10 %­GFJ_color 7 %­GFJ_color
menu shape n/a 220 184 30 30 6 6 10 %­noname_color 7 %­noname_color
menu shape n/a 220 207 30 30 6 6 10 %default_color 7 %default_color
menu shape n/a 220 230 30 30 6 6 10 %center_tile 7 %center_tile


menu font size 8
KeyLoop:
wait 0
if #menubutton = OpsExit
       {
       menu delete n/a
       menu delete Opsexit
       gosub OpsButtons
       goto OpsLoop
       }
if button in #menubutton
       {
       display ok You cannot Mine until you Exit $the Options Menu.
       set #menubutton n/a
       goto KeyLoop
       }
goto KeyLoop
;****SETTINGS*******
OpsSettings:
menu window title CyberPope's Mining Radar , %­space , Settings
menu font color Blue
menu font style bu
menu font size 10
menu font style b
menu font size 9
menu font color black
menu delete Opsexit
menu check Op2 225 1 300 20 %­mine_sand Make Sand Tiles Minable
menu check Op3 225 18 300 20 %­record Record Depleted Tiles
menu check Op4 225 86 300 20 %­testZAxis Test Z-Axis
menu check Op5 225 69 300 20 %displayColorOnTile Display Color on Tiles
menu check Op6 225 52 300 20 %displayTextOnTile Display Text on Tiles
menu check Op7 225 35 300 20 %­TrackOreTypes Track Ore Types
menu check Op12 225 103 300 20 %­haltonColor Halt On Colored Ore
menu text Op1 225 124 Grid Drawing Delay:
menu text Op1 225 148 Mining Delay:
menu text Op1 225 172 Select Shard Style:
menu text Op1 225 195 Depleted Color:
menu text Op1 225 219 Lines Per Cycle:
menu font bgcolor white
menu font size 8
menu combo create Op8 345 169 60
for %­temp 1 12
       {
       menu combo add Op8 %­temp , x , %­temp
       }
menu combo select Op8 %­shardtype
menu edit Op9 380 121 25 %delay
menu edit Op10 380 145 25 %­mine_delay
if %­record_color = n/a
       set %­record_color red
menu edit Op11 345 192 60 %­record_color
menu edit Op13 375 216 30 %­lpc
menu font bgcolor %­record_color
menu font color %­record_color
menu button Op14 320 192 21 21 -
set %change #false
set #menubutton n/a
menu font color black
menu font bgcolor btnface
menu button Submit 172 262 50 20 Submit
set %change #false
SettingsLoop:
wait 0
if #menubutton = closed
       halt
if button in #menubutton
       {
       display ok You cannot Mine until you have $submitted your Options.
       set #menubutton n/a
       goto SettingsLoop
       }
if #menubutton = Op14
       {
       menu delete op14
       menu get op11
       menu font color #menures
       menu font bgcolor #menures
       menu button Op14 320 192 21 21 -
       set #menubutton n/a
       goto settingsloop
       }
if #menubutton <> submit
       goto SettingsLoop
menu get Op2
if %­mine_sand <> #menures
       {
       set %change #true
       if %­mine_sand
               set %­mine_sand #False
       Else
               set %­mine_sand #True
       gosub putGlobalVar MiningSetup CPMR %­shard mine_sand NOLOCK
       }
menu get Op3
if %­record <> #menures
       {
       set %change #true
       if %­record
               set %­record #False
       Else
               set %­record #True
       gosub putGlobalVar MiningSetup CPMR SAME record NOLOCK
       }
menu get Op7
if %­TrackOreTypes <> #menures
       {
       if %­TrackOreTypes
               set %­TrackOreTypes #false
       Else
               set %­trackOreTypes #true
       menu delete prospect
       if ! %­TrackOreTypes
               menu check prospect 5 268 75 17 #true Prospect
       else
               {
               menu font color red
               menu text prospect 5 270 ++Track Ore++
               menu font color black
               }
       gosub putGlobalVar MiningSetup CPMR %­shard TrackOreTypes NOLOCK
       }
menu get Op6
if %DisplayTextOnTile <> #menures
       {
       set %change #true
       if %displayTextOnTile
               set %displayTextOnTile #false
       else
               set %displayTextOnTile #true
       gosub putGlobalVar MiningSetup CPMR %­shard DisplayTextOnTile NOLOCK
       }
menu get Op5
if %DisplayColorOnTile <> #menures
       {
       set %change #true
       if %displayColorOnTile
               set %displayColorOnTile #false
       else
               set %displayColorOnTile #true
       gosub putGlobalVar MiningSetup CPMR %­shard DisplayColorOnTile NOLOCK
       }
menu get Op4
if %­testZAxis <> #menures
       {
       set %change #true
       if %­TestZAxis
               set %­TestZAxis #false
       else
               set %­TestZAxis #true
       gosub putGlobalVar MiningSetup CPMR %­shard TestZAxis NOLOCK
       }
menu get Op8
if %­ShardType <> #menures
       {
       Display yesno Changing Shard Style will cause any of your$
                        +previously saved tiles for this shard to be lost. $$
                        +Do you still wish to change the Shard Style??
       if #dispres = No
               goto skipShard
       set %change #true
       set %­recorded_tiles |
       gosub getGlobalVar loc_ , %­shard , 1 CPMR SAME NumLoc NOLOCK
       gosub ChangeShardType %­numloc
       set %­shardtype #menures
       gosub putGlobalVar MiningSetup CPMR %­shard ShardType NOLOCK
       }
skipShard:
menu getnum Op9
if #menures <> %delay
       {
       set %delay #menures
       gosub putGlobalVar MiningSetup CPMR SAME delay NOLOCK
       }
menu getnum Op10
if #menures <> %­mine_delay
       {
       set %­mine_delay #menures
       gosub putGlobalVar MiningSetup CPMR %­shard mine_delay NOLOCK
       }
menu get Op11
if #menures <> %­record_color
       {
       set %change #true
       set %­record_color #menures
       gosub putGlobalVar MiningSetup CPMR SAME record_color NOLOCK
       }
menu get Op12
if #menures <> %­HaltOnColor
       {
       set %­HaltonColor #menures
       gosub putGlobalVar MiningSetup CPMR SAME HaltOnColor NOLOCK
       }
menu get Op13
if #lpc <> #menures
       {
       set %­lpc #menures
       set #lpc %­lpc
       gosub putGlobalVar MiningSetup CPMR SAME LPC NOLOCK
       }
menu font color black
menu font bgcolor btnface
set #menubutton n/a
for %del 1 14
       {
       menu delete Op , %del
       }
menu delete submit
gosub OpsButtons
goto OpsLoop
;****UOAM SETTINGS****
OpsUOAM:
if exec notin #opts
       {
       display ok You cannot use the UOAM functions$
               +until you allow EUO to Execute.$$
               +1) Go to the Tools Menu and select Options,$
               +2) Go to the Permissions Tab.$
               +3) Make sure "Disable Execute" is UN-Checked.
       set #menubutton n/a
       gosub OpsButtons
       goto OpsLoop
       }
menu window title CyberPope's Mining Radar , %­space , Loading UOAM Settings
menu text UOAM0 225 3 Path for UOAM File
menu text UOAM0 225 50 Select Icon Type:
menu text UOAM0 225 85 UOAM Style:
menu text UOAM0 225 113 Icon Offsets:
menu text UOAM0 225 113 Icon Offsets:
menu text UOAM0 225 145 Shard
menu text UOAM0 225 170 Number of Locations:
menu text UOAM0 225 185 Last Location Written:
menu font color blue
menu text UOAM0 325 113 X:
menu text UOAM0 375 113 Y:
menu text UOAM7 350 170 -
menu text UOAM8 350 185 -
menu font color black
gosub getGlobalVar MiningSetup CPMR UOAM Path NOLOCK
If ! #result
       set %­path C:\PROGRA~1\UOAM\
menu font bgcolor white
menu edit UOAM1 225 15 190 %­path
menu list create UOAM2 355 40 60 32
menu list add UOAM2 Terrain
menu list add UOAM2 Ore Type
gosub getGlobalVar MiningSetup CPMR UOAM IconType NOLOCK
if ! #result
       menu list select UOAM2 1
else
       menu list select UOAM2 %­IconType
menu list create UOAM3 355 75 60 32
menu list add UOAM3 Tilted
menu list add UOAM3 Square
gosub getGlobalVar MiningSetup CPMR UOAM UOAMStyle NOLOCK
if ! #result
       menu list select UOAM3 1
else
       menu list select UOAM3 %­UOAMStyle
gosub getGlobalVar MiningSetup CPMR UOAM Off_X NOLOCK
if ! #result
       {
       set %­off_x 4
       set %­off_y 4
       gosub putGlobalVar MiningSetup CPMR UOAM Off_X NOLOCK
       gosub putGlobalVar MiningSetup CPMR UOAM Off_Y NOLOCK
       }
gosub getGlobalVar MiningSetup CPMR UOAM Off_Y NOLOCK
offsets:
menu font bgcolor white
menu edit UOAM4 340 110 25 %­off_x
menu edit UOAM5 390 110 25 %­off_y
menu shape UOAM0 225 135 190 2 3 7 5 red 3 red
gosub getGlobalVar MiningSetup CPMR SAME NumShard NOLOCK
gosub getGlobalVar MiningSetup CPMR SAME %­shard NOLOCK
menu Combo Create UOAM6 260 140 157
gosub FillShardCombo %­numshard % . %­shard UOAM6
menu get UOAM6
gosub FillShardStats #menures
menu window title CyberPope's Mining Radar , %­space , UOAM Settings
menu get UOAM2
set %curUOAM2 #menures
menu get UOAM3
set %curUOAM3 #menures
menu get UOAM6
set %curUOAM6 #menures
OpsUOAMLoop:
wait 0
if #menubutton = OpsExit
       {
       gosub SaveUOAMSettings
       for %del 0 11
               {
               menu delete UOAM , %del
               }
       gosub OpsButtons
       goto OpsLoop
       }
menu get UOAM6
if %curUOAM6 <> #menures
       {
       set %curUOAM6 #menures
       gosub FillShardStats #menures
       }
if #menubutton = UOAM11
       Gosub WriteUOAMFile
if #result = RestartUOAM
       goto OpsUOAM
goto OpsUOAMLoop
;***Exit*********
OpsExit:
menu window title CP's Mining Radar
if %­record
       menu button reset 172 240 50 20 Reset
menu button options 172 262 50 20 Options
menu delete OpsUOAM
menu delete OpsExit
menu delete OpsKey
menu delete OpsSettings
menu delete select1
menu window size 225 285
if ! %change
       Return
gosub cleargrid
gosub drawgrid
set %change #false
Return

;****SUB WRITEUOAMFILE*********
sub WriteUOAMFile
set #menubutton n/a
menu get UOAM1
if ( #dot in #menures || #spc in #menures || \ notin #menures ) && %­PathCheck
       {
       Display ok Invalid Path for UOAM File. Please Make Sure$
               +you are using DOS folder names. There should$
               +be no spaces. $$
               +Also there is no need to denote a file name. This$
               +script will name the file for you. Only enter the$
               +destination path.$ Example: C:\PROGRA~1\UOAM\
       Return
       }
str right #menures 1
if #strres <> \
       {
       Display YesNo Your UOAM File Path must end with a Backslash ( \ ).$$
                         +Would you like to append one to the end of your current path?$$
                         +Yes = #menures , \ $
                         +No = Will not write to file until you change UOAM file Path.
       if #dispres = yes
               {
               set %­path #menures , \
               menu set UOAM1 %­path
               }
       if #dispres = no
               Return
       }
gosub SaveUOAMSETTINGS
menu get UOAM6
set %­shardIndex #menures
set #menures n/a
menu get UOAM10
if #menures = n/a || #menures = 1
       {
       set %append #false
       set %­startUOAM 1
       }
else
       set %append #true
set %filename %­shard . %­shardindex , _Ore , #dot , map
if %­UOAMStyle = 1
       set %filename %­shard . %­shardindex , _Ore_Tilt , #dot , map
menu window title CyberPope's Mining Radar , %­space , Writing UOAM File
set %­locRemain %­numloc + 1 - %­startUOAM
menu delete UOAM9
menu delete UOAM10
menu delete UOAM11
menu font color red
menu text writeStatus 230 225 -
menu font color black
gosub open UOAM %­path , %filename
if ! %append
               {
               menu set writestatus Adding Header
               gosub wipe UOAM
               gosub write UOAM 3
               gosub dump UOAM
               if %­upgradedloc
                       {
                       gosub delGlobalVar Loc_ , %­shard . %_1 , 1 CPMR SAME UpgradedLoc NOLOCK
                       set %­upgradedLoc n/a
                       }
               }
For %­map %­startUOAM %­numloc
       {
       set %­LocIndex %­map / 300 + 1
       gosub getGlobalVar LOC_ , %­shard . %­shardindex , %­LocIndex CPMR SAME loc , %­map NOLOCK
       gosub string exp %­loc . %­map _ map
       set %­map1 %­map1 + %­off_x
       set %­map2 %­map2 + %­off_y
       if %­map4 = n/a
               goto skipentry
       gosub replace %­nameOreType . %­map4 _ #spc
       set %­iconDesc #strres
       if shadow in %­iconDesc
               set %­iconDesc shadow
       set %­Icon terrain
       if %­icontype = 2
               set %­Icon %­IconDesc
       menu set writestatus Adding Location , #spc , %­map to Buffer.
       gosub write UOAM + , %­Icon , : , #spc , %­map1 , #spc , %­map2 , #spc , %­map3 , #spc , %­IconDesc
       skipentry:
       set %­lastrec %­map
       menu set UOAM8 %­lastrec
       if #menubutton = OpsExit || #menubutton = closed
               goto EndUOAMWritting
       }
EndUOAMWritting:
gosub dump UOAM
gosub putGlobalVar loc_ , %­shard . %­shardindex , 1 CPMR SAME LastRec NOLOCK
menu delete writestatus
if #menubutton = closed
       halt
set #menubutton n/a
Return RestartUOAM

;****SUB WRITEEXPORTFILE*******
sub WriteExportFile
set #menubutton n/a
menu get Exp2
if ( #dot in #menures || #spc in #menures || \ notin #menures ) && %­PathCheck
       {
       Display ok Invalid Path for Export File. Please Make Sure$
               +you are using DOS folder names. There should$
               +be no spaces. $$
               +Also there is no need to denote a file name. $This
               + will be done in the File Name Box. $Only enter the
               + destination path.$Example: C:\PROGRA~1\EXPORT\
       Return
       }
str right #menures 1
if #strres <> \
       {
       Display YesNo Your Export File Path must end with a Backslash ( \ ).$$
                         +Would you like to append one to the end of your current path?$$
                         +Yes = #menures , \ $
                         +No = Go back and change the path by hand.
       if #dispres = yes
               {
               set %exppath #menures , \
               menu set Exp2 %Exppath
               }
       if #dispres = no
               Return
       }
menu get Exp3
if #dot notin #menures
       {
       Display YesNo Your Export File name must end with a file extension.$$
                         +Would you like to append one to the end of your current path?$$
                         +Yes = #menures , #dot , TXT $
                         +No = Go back and change the file name by hand.
       if #dispres = yes
               {
               set %­lastfile #menures , #dot , txt
               menu set exp3 %­lastfile
               }
       if #dispres = no
               Return
       }
namespace push
namespace local WriteExpFile
menu font color red
menu text writeStatus 230 185 Saving Settings
menu font color black
menu get exp2
set %expPath #menures
gosub putGlobalVar CPMR_Export CPMR SAME ExpPath NOLOCK
menu get Exp4
set !shardindex #menures
menu get Exp3
set %­lastfile #menures
gosub putGlobalVar CPMR_Export CPMR %­shard . !shardindex lastfile NOLOCK
gosub getGlobalVar CPMR_Export CPMR %­shard . !shardindex lastwrite NOLOCK
if #result
       set !startExp %­lastwrite + 1
set !exptemp %­shardtype
gosub getGlobalVar MiningSetup CPMR %­shard . !shardindex shardtype NoLock
set !expShardtype %­shardtype
set %­shardtype !exptemp
set #menures n/a
menu get exp8
if #menures = n/a || #menures = 1
       {
       set !append #false
       set !startExp 1
       }
else
       set !append #true
menu delete exp7
menu delete exp8
menu delete exp9
gosub open Exp %expPath , %­lastfile
if ! !append
       {
       menu set writeStatus Adding Test Code.
       gosub wipe Exp
       gosub write Exp SET ! , EXPORTID %exportid
       gosub write Exp SET ! , ExpShard %­shard . !shardindex
       gosub write Exp Set ! , ExpShardType !expshardtype
       gosub write Exp IF % , 1 = TEST 2
       gosub write Exp SET # , RESULT #true
       gosub write exp EXIT
       gosub dump Exp
       gosub delGlobalVar CPMR_Export CPMR %­shard . !shardindex ExpUpgrade NOLOCK
       set %ExpUpgrade n/a
       }
menu set writestatus Checking for File
gosub findfile %expPath %­lastfile
if ! #result
       {
       menu set write status Failed to Find Export File
       Display ok Failed to find your export file!!!!$$
               +Possible reasons for this include:$
               +1) Improper Path Name. (Path name must be DOS Format).$
               +2) The Data Path Must Already Exist.$
               +3) Improper File Name.$$
               +Make the nessecary changes and try again.
       menu delete writestatus
       namespace clear
       namespace pop
       Return AddShardData
       }
gosub getGlobalvar Loc_ , %­shard . !shardindex , 1 CPMR SAME NumLoc NOLOCK
for !exp !startExp %­numloc
       {
       menu set writestatus Adding Location , #spc , !exp , #spc , to Buffer.
       set !locIndex !exp / 300 + 1
       gosub getGlobalVar Loc_ , %­shard . !shardindex , !locIndex CPMR SAME loc , !exp NOLOCK
       gosub write Exp set ! , loc , !exp %­loc . !exp
       set %­lastwrite !exp
       menu set exp6 !exp
       if #menubutton = OpsExit || #menubutton = closed
               goto EndExportWriting
       }
EndExportWriting:
menu delete writestatus
gosub dump exp
gosub putGlobalVar CPMR_Export CPMR %­shard . !shardindex lastwrite NOLOCK
if #menubutton = closed
       halt
set #menubutton n/a
namespace clear
namespace pop
Return AddShardData

;****SUB GETIMPORTDATA**********
sub GetImportData
set #menubutton n/a
namespace clear
menu delete OpIm12
menu delete OpIm9
menu delete OpIm11
menu delete OpIm10
menu get OpIm2
if ( #dot in #menures || #spc in #menures || \ notin #menures ) && %­PathCheck
       {
       Display ok Invalid Path for Import File. Please Make Sure$
               +you are using DOS folder names. There should$
               +be no spaces. $$
               +Also there is no need to denote a file name. $This
               + will be done in the File Name Box. $Only enter the
               + destination path.$Example: C:\PROGRA~1\IMPORT\
       Return
       }
str right #menures 1
if #strres <> \
       {
       Display YesNo Your Import File Path must end with a Backslash ( \ ).$$
                         +Would you like to append one to the end of your current path?$$
                         +Yes = #menures , \ $
                         +No = Go back and change the path by hand.
       if #dispres = yes
               menu set OpIm2 #menures , \
       if #dispres = no
               Return
       }
menu get OpIm3
if #dot notin #menures
       {
       Display YesNo Your Import File name must end with a file extension.$$
                         +Would you like to append one to the end of your current path?$$
                         +Yes = #menures , #dot , TXT $
                         +No = Go back and change the file name by hand.
       if #dispres = yes
               menu set OpIm3 #menures , #dot , txt
       if #dispres = no
               Return
       }
menu get Opim2
set %­imppath #menures
menu get OpIm3
set %­lastfile #menures
menu set OpIm9 Checking for File
gosub findfile %­imppath %­lastfile
if ! #result
       {
       menu delete OpIm9
       menu font color $008cff
       menu text OpIm9 240 160 File Not Found!!!!!!$
                                       +Please check your path name &$
                                       +your file name and try again.
       menu font color black
       Return
       }
gosub putGlobalVar CPMR_Import CPMR Same ImpPath NOLOCK
gosub putGlobalVar CPMR_Import CPMR Same LastFile NOLOCK
menu delete OpIm9
menu font color lime
menu text OpIm9 240 160 File Found!   Getting Data!$
                               +Please wait until data is $retrieved.
menu set OpIm5 !ExportId
menu set OpIm6 !ExpShard
menu set OpIm7 !ExpShardType , x , !ExpShardType
set !addextras #false
gosub getGlobalvar CPMR_Import !ExportId !ExpShard LastImp NOLOCK
if ! #result
       menu set OpIm8 None
else
       {
       menu set OpIm8 %­LastImp
       set !ImpStart %­lastimp + 1
       set !addextras #true
       }
;Make sure !ExpShardType Matches %­shardtype
; and if Shard is not previously recorded add it to list.
gosub getGlobalVar MiningSetup CPMR SAME !ExpShard NOLOCK
If ! #result
       {
       gosub getGlobalVar MiningSetup CPMR SAME NumShard NOLOCK
       set %­numshard %­numshard + 1
       gosub putGlobalVar MiningSetup CPMR SAME NumShard NOLOCK
       set % . !ExpShard %­numshard
       gosub putGlobalVar MiningSetup CPMR SAME !ExpShard NOLOCK
       set %­shard . %­numshard !ExpShard
       gosub putGlobalVar MiningSetup CPMR SAME shard . %­numshard NOLOCK
       }
Else
       {
       set !TempShardType %­shardtype
       gosub getGlobalVar MiningSetup CPMR !ExpShard shardtype NOLOCK
       if %­shardtype <> !ExpShardType && #result
               {
               menu font color $008cff
               menu delete OpIm9
               menu text OpIm9 240 160 The Import File Uses !ExpShardType , x , !ExpShardType $
                                               +for this shard and you use %­shardtype , x , %­shardtype $
                                               +Can't Import These Locations!
               menu font color black
               set %­shardtype !TempShardType
               Return
               }
       if ! #result
               gosub putGlobalVar MiningSetup CPMR !ExpShard shardtype NOLOCK
       set %­shardtype !TempShardType
       }
wait 0
call %­ImpPath , %­lastfile
if !addextras && !loc . !impstart = n/a
       {
       menu font color $008cff
       menu delete Opim9
       menu text OpIm9 240 160 No New Locations to Import.$
                                       +However you can still check$
                                       +for Iron Ore Upgrades.
       set !addextras #false
       }
else
       {
       menu font color $d1ce00
       menu delete Opim9
       menu text OpIm9 240 160 Data Recieved!! Select your
                               +$Options and Press the Import $
                               +Locations button to Continue.
       }
menu font color black
if !addextras
       {
       menu font bgcolor white
       menu list create OpIm10 225 210 190 32
       menu list add OpIm10 Start with Location 1
       menu list add OpIm10 Start with Location , #spc , !ImpStart
       menu list select OpIm10 1
       menu font bgcolor btnface
       }
gosub getGlobalvar CPMR_Import !ExportID !expShard ImpUpgrade NOLOCK
if ! #result
       {
       set %chkUpg #true
       gosub putGlobalvar CPMR_Import !ExportID !expShard ImpUpgrade NOLOCK
       }
menu check OpIm11 225 243 190 17 %­impUpgrade Check for Iron Ore Upgrades
menu button Opim12 225 262 190 20 Import Locations from File
Return

;****SUB FINDFILE**********
sub FindFile
set #result #false
call %1 , %2 test
if #result
       Return #true
Return #false

;****SUB IMPORTDATA***********
sub ImportData
set %change #false
set !CurImpLoc 1
menu get OpIm10
if #menures = 2
       set !CurImpLoc !ImpStart
menu get OpIm11
If #menures <> %­impUpgrade
       {
       set %­impUpgrade #menures
       gosub putGlobalvar CPMR_Import !ExportID !expShard ImpUpgrade NOLOCK
       }
for !del 1 12
       {
       menu delete OpIm , !del
       }
menu shape im1 225 15 190 40 4 7 1 black 7 black
menu shape im1 225 70 190 85 4 7 1 black 7 black
menu shape im1 225 170 190 65 4 7 1 black 7 black
menu font color $2d52a0
menu font style b
menu text Im1 235 2 STATUS
menu text Im1 235 56 CURRENT DATA
menu text Im1 235 156 IMPORT STATISTICS
menu font size 8
menu font color $008cff
menu text im3 300 195 0
menu text im13 240 205 0
menu text im12 240 215 0
menu font color lime
menu text ImpStatus1 235 20 -
menu text ImpStatus2 235 33 -
menu text im2 300 175 0
menu text im5 300 185 0
menu text im14 295 75 !exportID
menu text im15 295 85 !expShard
menu text im7 295 95 -
menu text im8 295 105 -
menu text im9 295 115 -
menu text im10 295 125 -
menu text im11 295 135 -
menu font color yellow
menu text im1 285 75 :
menu text im1 285 85 :
menu text im1 285 95 :
menu text im1 285 105 :
menu text im1 285 115 :
menu text im1 285 125 :
menu text im1 285 135 :
menu text im1 235 75 From
menu text im1 235 85 Shard
menu text im1 235 95 Location
menu text im1 235 105 X
menu text im1 235 115 Y
menu text im1 235 125 Facet
menu text im1 235 135 Ore
menu text Im1 235 195 SKIPPED
menu text Im1 235 185 UPGRADED
menu text Im1 235 175 ADDED
menu font style bi
menu text im1 260 205 ALREADY IN DATABASE
menu text im1 260 215 INVALID ENTRY
menu font style b
menu font color black
ImportDataLoop:
if !loc . !CurImpLoc = n/a
       {
       menu set impstatus1 No more locations to Process
       menu set impstatus2 Press a button below to Exit.
       goto ImportContinue
       }
menu set im7 !CurImpLoc
gosub Import !loc . !CurImpLoc !ExpShard !ExpShardType
if #menubutton = OpsExit || #menubutton = closed
       {
       set %­lastImp !CurImpLoc
       gosub putGlobalvar CPMR_Import !ExportId !ExpShard LastImp NOLOCK
       menu delete impstatus1
       menu delete impstatus2
       for !w 1 15
               {
               menu delete im , !w
               }
       return
       }
set !CurImpLoc !CurImpLoc + 1
goto ImportDataLoop
ImportContinue:
menu button OpsImport 225 240 190 20 Return to Import Menu
menu button OpsExit 225 262 190 20 Return to Mining Radar
ImpContLoop:
wait 0
If Ops in #menubutton || #menubutton = closed
       {
       set %­lastImp !CurImpLoc - 1
       gosub putGlobalvar CPMR_Import !ExportId !ExpShard LastImp NOLOCK
       menu delete impstatus1
       menu delete impstatus2
       for !w 1 15
               {
               menu delete im , !w
               }
       menu delete OpsExit
       menu delete OpsImport
       menu button OpsExit 172 262 50 20 Exit
       Return
       }
goto ImpContLoop


;****SUB SAVEUOAMSETTINGS****
sub SaveUOAMSettings
gosub UOAMSettingCheck 1 path
gosub UOAMSettingCheck 2 IconType
gosub UOAMSettingCheck 3 UOAMStyle
gosub UOAMSettingCheck 4 off_x
gosub UOAMSettingCheck 5 off_y
Return

;****SUB UOAMSETTINGCHECK
sub UOAMSettingCheck
menu get UOAM , %1
if % . %2 <> #menures
       {
       set % . %2 #menures
       gosub putGlobalVar MiningSetup CPMR UOAM %2 NOLOCK
       }
Return

;****SUB FILLEXPORTDATA*****
sub fillexportdata
menu delete exp7
menu delete exp8
menu delete exp9
set %_1 %1
gosub getGlobalVar MiningSetup CPMR SAME shard , %1 NOLOCK
gosub getGlobalVar Loc_ , %­shard . %_1 , 1 CPMR SAME numloc NOLOCK
if ! #result
       {
       set %­numloc 0
       menu set exp5 None
       }
else
       menu set exp5 %­numloc
gosub getGlobalVar CPMR_Export CPMR %­shard . %_1 lastwrite NOLOCK
if ! #result
       {
       set %­lastwrite 0
       set %­startExp 1
       menu set exp6 None
       }
else
       {
       set %­startExp %­lastwrite + 1
       menu set Exp6 %­lastwrite
       }
gosub getGlobalVar CPMR_Export CPMR %­shard . %_1 ExpUpgrade NOLOCK
if #result && %ExpUpgrade
       {
       menu font color red
       menu text Exp7 230 175 One or more of your mining$
                               +locations have been upgraded.$$
                               +You must rewrite your Export $
                               +file to include this new data. $
       goto ExpUpgrade1
       }
if %­lastwrite = %­numloc || %­numloc = 0
       {
       menu font color red
       if %­numloc = 0
               {
               menu text Exp7 230 165 You have not recorded any$
                               +mining locations yet!!!$$
                               +You must mine at least one $
                               +location before you can export $
                               +your location data.$$
               Return
               }
       menu text exp7 230 205 No New Locations to Export.
       ExpUpgrade1:
       menu font color black
       menu font bgcolor btnface
       set %­startExp 1
       menu button exp9 225 262 190 20 Re-Write Export File
       Return
       }
if %­startExp > 1
       {
       menu text Exp7 225 215 Create New File
       menu text Exp7 225 230 Apppend to Old File
       menu font color red
       menu text Exp7 320 215 Or
       menu font color black
       menu font bgcolor white
       menu list create Exp8 345 213 70 32
       menu list add Exp8 New File
       menu list add Exp8 Append Old
       menu list select Exp8 2
       }
menu font bgcolor btnface
menu font color black
menu button exp9 225 262 190 20 Write Export File
Return

;****SUB FILLSHARDCOMBO*****
Sub FillShardCombo
namespace push
namespace local Fillshard
set !_2 %2
set !_3 %­3
for !uoam 1 %1
       {
       gosub getGlobalVar MiningSetup CPMR SAME shard . !uoam NOLOCK
       if _ in %­shard . !uoam
               {
               gosub replace %­shard . !uoam _ #spc
               set !temp #strres
               menu Combo Add !_3 !temp
               }
       else
               menu Combo Add !_3 %­shard . !uoam
       }
menu combo select !_3 !_2
namespace clear
namespace pop
Return

;****SUB FILLSHARDSTATS***
sub FillShardStats
menu delete UOAM9
menu delete UOAM10
menu delete UOAM11
set %_1 %1
gosub getGlobalVar MiningSetup CPMR SAME shard , %1 NOLOCK
gosub getGlobalVar loc_ , %­shard . %_1 , 1 CPMR SAME NumLoc NOLOCK
if ! #result
       {
       set %­numloc 0
       menu set UOAM7 None
       }
Else
       menu set UOAM7 %­numloc
gosub getGlobalVar loc_ , %­shard . %_1 , 1 CPMR SAME LastRec NOLOCK
If ! #result
       {
       set %­lastRec 0
       set %­startUOAM 1
       menu set UOAM8 None
       }
else
       {
       set %­startUOAM %­lastRec + 1
       menu set UOAM8 %­lastRec
       }
gosub getGlobalVar Loc_ , %­shard . %_1 , 1 CPMR SAME UpgradedLoc NOLOCK
if #result && %­upgradedLoc
       {
       menu font color red
       menu text UOAM9 225 200 One or more locations have
       menu text UOAM9 225 210 been upgraded since the last
       menu text UOAM9 225 220 file was written. The map will
       menu text UOAM9 225 230 need to be re-recorded to keep
       menu text UOAM9 225 240 from placing overlapping markers.
       menu font color black
       goto write1
       }
if %­lastRec = %­numloc || %­numloc = 0
       {
       menu font color red
       menu text UOAM9 245 225 No New Locations to Write
       menu font color black
       if %­lastRec = %­numloc && %­numloc <> 0
               {
               write1:
               set %­startUOAM 1
               menu font bgcolor btnface
               menu button UOAM11 225 262 190 20 Re-Write UO Auto Map File
               }
       Return
       }
if %­startUOAM > 1
       {
       menu text UOAM9 225 215 Create New Map
       menu text UOAM9 225 230 Apppend to Old Map
       menu font color red
       menu text UOAM9 320 215 Or
       menu font color black
       menu font bgcolor white
       menu list create UOAM10 345 213 70 32
       menu list add UOAM10 New Map
       menu list add UOAM10 Append Old
       menu list select UOAM10 2
       }
menu font bgcolor btnface
menu button UOAM11 225 262 190 20 Write to UO Auto Map File
Return

;*****SUB ENDING*****
sub ending
if *cyberpope_Mining_radar_vote = ThankYou
       halt
menu hideeuo
menu window title CyberPope's Mining Radar
set #menubutton n/a
menu clear
if exec in #opts
       menu window size 240 310
else
       menu window size 240 290
menu window title -!!-----PLEASE VOTE-----!!-
menu window color black
menu font bgcolor black
menu font color yellow
menu show
menu font size 12
menu text m1 5 5 Thank you for using CyberPope's
               +$Mining Radar. Now that you have
               +$had a chance to check it out.
               +$please take the time to give me
               +$your thoughts. All that I am
               +$asking for is for you to take a
               +$couple minutes of your time and
               +$vote for this script.
menu text m1 5 170 If you encountered any problems
               +$with this script please post what
               +$the problem was in this script's
               +$thread.
menu font size 14
menu font color red
menu text m1 100 230 CyberPope
if exec in #opts
       {
       menu font size 12
       menu font color lime
       menu text m1 15 260 Click the button below to vote!
       menu font color white
       menu button vote 5 280 230 25 Push this button to be Awesome
       vote:
       if #menubutton = vote
               {
               execute http://www.easyuo.com/rate.php?id=1196
               set *cyberpope_Mining_radar_vote ThankYou
               halt
               }
       if #menubutton = closed
               {
               display yesno Come on man! Hook the Pope up!
                              +$I spent a lot of time working on this
                              +$script and all I am asking for is your vote!
               if #dispres = yes
                       {
                       execute http://www.easyuo.com/rate.php?id=1196
                       set *cyberpope_Mining_radar_vote ThankYou
                       }
               if #dispres = no
                       display ok You are not awesome! $ =(
               Halt
               }
       goto vote
       }
else
       {
       menu font color lime
       menu font size 8
       menu edit edit1 5 260 230 http://www.easyuo.com/rate.php?id=1196
       }
halt

;***SUB DBAREA***************
sub DBarea
set %1 %1 / %­shardtype * %­shardtype / ( %­shardtype * 17 )
set %2 %2 / %­shardtype * %­shardtype / ( %­shardtype * 17 )
set %DBwrite %1 , _ , %2
return %­shard , _ , %DBwrite , _ , %­3

;***SUB CHANGESHARDTYPE*******
sub ChangeShardType
namespace push
namespace local erase
For !temp 1 5
       {
       Menu set status ERASING , #spc , %facet . !temp
       set !st %­shard , !temp
       if *DBW_ . !st = n/a || *DBW_ . !st = |
               goto enderase
       str del *DBW_ . !st 1 1
       set !del #strres
       eraseloop:
       str pos !del |
       set !pos #strres
       set !keep #strres - 1
       str left !del !keep
       set !ct %­shard , _ , #strres , _ , !temp
       set *color_ . !ct n/a
       str del !del 1 !pos
       set !del #strres
       str len !del
       if #strres = 0
               goto enderase
       goto eraseloop
       enderase:
       set *DBW_ . !st |
       }
set !num %1 / 300 + 1
for !i 1 !num
       {
       set !st %­shard , !i
       set *Loc_ . !st n/a
       }
menu set status Finished erasing locations.
namespace clear
namespace pop
Return

;***SUB ODBMenu************
Sub ODBMenu
menu font transparent #true
menu window title Database Update!!!
set #menubutton n/a
menu clear
menu window size 300 200
menu window color btnface
menu font bgcolor btnface
menu font color red
menu font style b
menu font size 12
menu text m1 5 5 NOTICE!
menu text m1 5 158 Would you like to...
menu font size 10
menu font color blue
menu text m1 5 25 Due to an issue with the old database system,$
                             +Your database for this shard needs to be $
                       +updated or deleted.$$
                             +The update may take several minutes based$
                       +on the speed of your PC and Number of $locations.$
menu font color black
menu font bgcolor lime
menu button update 155 138 140 20 Update Now!
menu font bgcolor red
menu font color yellow
menu button delete 155 158 140 20 Delete Old Database
menu button closed 155 178 140 20 Quit/Update Later
menu show 100 100
DBU:
wait 0
if #menubutton = closed
       {
       Display ok You will not be able to run this script until you update or delete the database.
       halt
       }
if #menubutton = delete
       {
       set *backup_Loc_ . %­shard *Loc_ . %­shard
       set *backup_Color_ . %­shard *Color_ . %­shard
       set *loc_ . %­shard n/a
       set *color_ . %­shard n/a
       return exit
       }
If #menubutton = n/a
       goto DBU
RETURN

;***SUB OLDDBCHECK***********
sub OldDBCheck
if *Loc_ . %­shard = n/a && *color_ . %­shard = n/a
       Return
gosub ODBMenu
if #result = exit
       Return
menu clear
menu window title Updating Database...
menu window size 225 285
menu window color btnface
menu font bgcolor btnface
menu font color maroon
menu font style b
menu text Im1 5 5 STATUS
menu font size 8
menu font color red
menu text im2 70 145 0
menu text im3 70 215 0
menu text im4 70 250 0
menu text im5 70 180 0
menu text ImpStatus1 5 20 -
menu text ImpStatus2 5 30 -
menu font color blue
menu text im6 90 65 -
menu text im7 90 80 -
menu text im8 90 90 -
menu text im9 90 100 -
menu text im10 90 110 -
menu text im11 90 120 -
menu text Im1 5 250 MISSING :
menu text Im1 5 215 SKIPPED :
menu text Im1 5 180 UPGRADED:
menu text Im1 5 145 ADDED :
menu font color black
menu text im1 5 55 Locations
menu text im1 5 65 Remaining :
menu text im1 5 80 Current Loc  :
menu text im1 5 90 Current X  :
menu text im1 5 100 Current Y  :
menu text im1 5 110 Current Facet:
menu text im1 5 120 Current Ore#  :
menu text Im1 5 190 Iron locations upgraded to
menu text Im1 5 200 a higher grade of ore.
menu text Im1 5 260 Not found in the
menu text Im1 5 270 LOC_ , %­shard , #spc database.
menu text Im1 5 225 Already recorded in the new
menu text Im1 5 235 database or had an error.
menu text Im1 5 155 Transfered from the old
menu text Im1 5 165 database to the new one.
namespace push
namespace local ODB
set *backup_Loc_ . %­shard *Loc_ . %­shard
set *backup_Color_ . %­shard *Color_ . %­shard
gosub getGlobalVar Loc_ , %­shard CPMR SAME NumLoc NOLOCK
set !oldNumLoc %­NumLoc
for !i !oldNumLoc 1
       {
       menu set im6 !i
       gosub getGlobalVar Loc_ , %­shard CPMR SAME Loc , !i NOLOCK
       if ! #result
               {
               set !missing !missing + 1
               menu set impstatus1 Location , #spc , !i , #spc Missing.
               menu set im4 !missing
               goto endentry
               }
       menu set im7 %­loc . !i
       gosub Import %­loc . !i %­shard %­shardtype
       endentry:
       }
set *loc_ . %­shard n/a
set *color_ . %­shard n/a
namespace clear
namespace pop
RETURN

;***SUB IMPORT************
sub Import
menu set impstatus1 Checking Variable Ranges.
set !FacetXMax1 6143 - %­3 + 1
set !FacetYMax1 4095 - %­3 + 1
set !FacetXMax2 6143 - %­3 + 1
set !FacetYMax2 4095 - %­3 + 1
set !FacetXMax3 2303 - %­3 + 1
set !FacetYMax3 1599 - %­3 + 1
set !FacetXMax4 2559 - %­3 + 1
set !FacetYMax4 2047 - %­3 + 1
set !FacetXMax5 1447 - %­3 + 1
set !FacetYMax5 1447 - %­3 + 1
set !LocID %1
set !shard %2
for !s 1 3
       {
       str pos %1 _
       set !position #strres
       set !end #strres - 1
       str left %1 !end
       set !Import . !s #strres
       str del %1 1 !position
       set %1 #strres
       }
set !import4 %1
set !colorID !import1 , _ , !import2 , _ , !import3
menu set im8 !import1
menu set im9 !import2
menu set im10 %facet . !import3
menu set im11 %­nameoretype . !import4

;----Check to see if X/Y/Facet/Ore are acceptable
if !import3 < 1 || !import3 > 5 || !import3 = n/a
       {
       menu set impstatus2 Facet Variable out of Range
       set !InvEnt !InvEnt + 1
       menu set im12 !InvEnt
       goto skip
       }
if !import1 > !facetxmax . !import3 || !import1 < 0 || !import1 = n/a
       {
       menu set impstatus2 X Coordinate Out of Range.
       set !InvEnt !InvEnt + 1
       menu set im12 !InvEnt
       goto skip
       }
if !import2 > !facetymax . !import3 || !import2 < 0 || !import2 = n/a
       {
       menu set impstatus2 Y Coordinate out of Range
       set !InvEnt !InvEnt + 1
       menu set im12 !InvEnt
       goto skip
       }
if !import4 > %­Number_of_ore_Types || !import4 < 1 || !import4 = n/a
       {
       menu set impstatus2 Ore Color out of Range
       set !InvEnt !InvEnt + 1
       menu set im12 !InvEnt
       goto skip
       }
if ( !import1 % %­3 ) <> 0 || ( !import2 % %­3 ) <> 0
       {
       menu set impstatus2 Invalid coordinate!
       set !InvEnt !InvEnt + 1
       menu set im12 !InvEnt
       goto skip
       }
;----Check to See if Location is already in the new database.
menu set Impstatus1 Looking for location in Database
gosub DBarea !import1 !import2 !import3
set !AreaGrid !shard , _ , %dbwrite , _ , !import3
gosub getGlobalVar Color_ , !areagrid CPMR SAME !colorid NOLOCK
if #result
       {
       ;Check to see if ore type matches
       if % . !colorid = !import4 || ( _ in % . !colorid && !import4 = 1 )
               {
               menu set impstatus2 Location previously recorded.
               set !adb !adb + 1
               menu set im13 !adb
               wait 0
               goto skip
               }
       ;Check to see if ore type needs to be upgraded.
       if _ in % . !colorid && !import4 > 1 && %­ImpUpgrade
               {
               menu set impstatus2 Upgrading Ore Type!
               ;upgrade ore type
               str pos % . !colorid _
               str del % . !colorid 1 #strres
               set !UpgradeLoc #strres
               set % . !colorid !import4
               set %­upgradedLoc #true
               set !LocIndex !upgradeLoc / 300 + 1
               set %­Loc . !upgradeLoc !locid
               gosub putGlobalVar Loc_ , !shard , 1 CPMR SAME UpgradedLoc NOLOCK
               gosub putGlobalVar CPMR_Export CPMR !shard ExpUpgrade NOLOCK
               gosub putGlobalVar Loc_ , !shard , !LocIndex CPMR SAME Loc , !UpgradeLoc NOLOCK
               set !imtemp !shard , !import3
               if *DBW_ . !imtemp = n/a
                       set *DBW_ . !imtemp |
                if | , %DBwrite , | notin *DBW_ . !imtemp
                       set *DBW_ . !imtemp *DBW_ . !imtemp , %DBwrite , |
               gosub putGlobalVar Color_ , !AreaGrid CPMR SAME !colorid NOLOCK
               set !upgrd !upgrd + 1
               menu set im5 !upgrd
               set %change #true
               Return
               }

       goto skip
       }
;Add Location to the database
menu set impstatus1 Importing Location to Database
menu set impstatus2 -
gosub getGlobalVar Loc_ , !shard , 1 CPMR SAME NumLoc NOLOCK
if ! #result
       set %­numloc 0
set %­numloc %­numloc + 1
set %­Loc . %­numloc !locid
set !locIndex %­numloc / 300 + 1
gosub putGlobalVar Loc_ , !shard , 1 CPMR SAME numloc NOLOCK
gosub putGlobalVar Loc_ , !shard , !locindex CPMR SAME Loc , %­numloc NOLOCK
set !imtemp !shard , !import3
if *DBW_ . !imtemp = n/a
       set *DBW_ . !imtemp |
if | , %DBwrite , | notin *DBW_ . !imtemp
       set *DBW_ . !imtemp *DBW_ . !imtemp , %DBwrite , |
set % . !colorid !import4
if !import4 = 1
       set % . !colorid 1_ , %­numloc
gosub putGlobalVar Color_ , !AreaGrid CPMR SAME !colorid NOLOCK
set !added !added + 1
menu set im2 !added
menu set impstatus1 -
set %change #true
Return
skip:
set !skipped !skipped + 1
menu set im3 !skipped
menu set impstatus2 -
Return


;===End of My Code=================
;==================================
;==================================
;==================================
;==================================
;==================================
;==================================
;==================================
;==================================
;==================================
; Script Name:  CEO's * variable management subs (pseudo filesystem)
; Author: CEO
; Version: 1.01
; Client Tested with: 4.0.1b
; EUO version tested with: 1_41_103
; Shard OSI / FS: OSI
; Revision Date: 040219
; Public Release: 040219
; Globals Used: User specified (2 total)
; Purpose: Allows you to use a * variable as a pseudo-filesystem
;=======================================
; CEO's global variable management subs:
;      getGlobalVar  . putGlobalVar  . delGlobalVar
;=======================================
Sub getGlobalVar
;ver 1.1
;changed the lock file to use *variablename_lock so it'll work with any named *variable
;
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to store multiple variables in one global variable unique to
;             each player and script. getGlobaVar retrieves a value from a global variable.
;@returns: #result = #false if variable not found, #true if found
;            % . %­3 contains variable value
;%1 is the global/persistant variable to use ( %1 + 1 is used for locking)
;%2 is the script identifer or pseudo filename
;%­3 is #charid or pseudo filename
;%­4 is the variable to search for and return in %. %­3  
;%­5 is for lock control. By default getGlobalVar uses a lock to return a value. In some cases you may want to
;       retrieve a variable (mostly for speed) without needing a lock as long as you are aware of
     any potentional conflicts, that very rarely may occur. Set this param to NOLOCK to access
     global storage without a lock.
;sample usage:
;               gosub getGlobalVar 50 MyScript #charid backpackid
; Using global var *50 finds the variable labeled MyScript#charidbackpackid and returns it in %backpackid
;
;               gosub getGlobalVar 50 MyScript #charid clothstat NOLOCK
; Using global var *50 find the variable labeled MyScript#charidclothstat and returns it in %clothstat without using a lock
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %­3 , _ , %­4 , _ , GET
set !lock %1 , _lock
if ( %0 = 5 ) && ( %­5 = NOLOCK )
  goto getGlobalVar_skiplock
set !lockcount 0
getGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
  wait 1 4
  set !lockcount !lockcount + 1
  if !lockcount < 10
     goto getGlobalVar_waitforlock
  if * . !lock <> N/A
  {
     set !currentlock * . !lock
     if !currentlock = N/A
        goto getGlobalVar_waitforlock
     str pos !currentlock _
     set !strres #strres - 1
     str left !currentlock !strres
     set !systime #systime - #strres
     if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
     {
        set !lockcount 0
        goto getGlobalVar_waitforlock
     }
  }
}
set * . !lock #nsname
wait 3 2
if  * . !lock <> #nsname
{
  set !lockcount 0
  goto getGlobalVar_waitforlock
}
getGlobalVar_skiplock:
set !global * . %1
set !varName %2 , ^ , %­3 , ^ , %­4 , |
str pos !global !varName
set #result #strres <> 0
if #result
{
  set !varNamePos #strres
  str len !varName
  set !delString !varNamePos + #strres - 1
  str del !global 1 !delString
  set !global #strres
  str pos !global |
  set !varNamePos #strres - 1
  str left !global !varNamePos
  set % . %­4 #strres
}
if ( %0 < 5 || %­5 <> NOLOCK ) && * . !lock = #nsname
  set * . !lock N/A
nameSpace Clear
nameSpace Pop
return #result

Sub putGlobalVar
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to store multiple variables in one global variable unique to
;             each player and script. putGlobaVar stores a value into a global variable.

;@returns: #result = #false if variable not found, #true if found
;            % . %­3 contains variable
;%1 is the global/persistant variable to use
;%2 is the script identifer or pseudo filename
;%­3 #charid or other identifier
;%­4 is the variable name of the variable to save into the* variable identified in %1
;sample usage:
;               gosub putGlovalVar 50 MyScript #chardid backpackid
; Using global var *50 stores/updates the variable labeled MyScript#charidbackpackid  with %backpackid
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %­3 , _ , %­4 , _  , PUT
set !lock %1 , _lock
set !lockcount 0
putGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
  wait 1 4
  set !lockcount !lockcount + 1
  if !lockcount < 10
     goto putGlobalVar_waitforlock
  if * . !lock <> N/A
  {
     set !currentlock * . !lock
     if !currentlock = N/A
        goto putGlobalVar_waitforlock
     str pos !currentlock _
     set !strres #strres - 1
     str left !currentlock !strres
     set !systime #systime - #strres
     if !systime < 10000 ; if over 10 seconds assume a hung lock and take it
     {
        set !lockcount 0
        goto putGlobalVar_waitforlock
     }
  }
}
set * . !lock #nsname
wait 4
set !global * . %1
set !varName %2 , ^ , %­3 , ^ , %­4 , |
str pos !global !varName
if #strres = 0
{
  if  * . !lock <> #nsname
  {
     set !lockcount 0
     goto putGlobalVar_waitforlock
  }
  if  |CEO*FILESYSTEM| notin !global
     set !global |CEO*FILESYSTEM|
  set * . %1 !global , !varName , % . %­4 , |
  set * . !lock N/A
  nameSpace clear
  nameSpace pop
  return #true
}
set !varNamePos #strres
str len !varName
set !splitString !varNamePos + #strres - 1
str left !global !splitstring
set !globalPart1 #strres
str del !global 1 !splitString
set !global #strres
str len !global
set !globalLen #strres
str pos !global |
set !splitString !globalLen - #strres + 1
str right !global !splitstring
set !global #strres
if  * . !lock <> #nsname
{
  set !lockcount 0
  goto putGlobalVar_waitforlock
}
set * . %1 !globalPart1 , % . %­4 , !global
set * . !lock N/A
nameSpace clear
nameSpace pop
return #true


Sub delGlobalVar
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to delete a variable out of the globalvar pool unique to
;             each player and script. delGlobaVar deletes a global variable in a * variable.

;@returns: #result = #false if variable not found, #true if  deleted
;
;%1 is the global/persistant variable to use
;%2 is the script identifer or pseudo filename
;%­3 is #charid or other identifier
;%­4 is the variable name of the variable to save into the* variable identified in %1
;sample usage:
;               gosub delGlovalVar 50 MyScript #charid backpackid
; Using global var *50 deletes  the variable label MyScript#charidbackpackid  and it's associated value.
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %­3 , _ , %­4 , _ , DEL
set !lock %1 , _lock
set !lockcount 0
delGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
  wait 1 4
  set !lockcount !lockcount + 1
  if !lockcount <  10
     goto delGlobalVar_waitforlock

  if * . !lock <> N/A
  {
     set !currentlock * . !lock
     if !currentlock = N/A
        goto delGlobalVar_waitforlock
     str pos !currentlock _
     set !strres #strres - 1
     str left !currentlock !strres
     set !systime #systime - #strres
     if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
     {
        set !lockcount 0
        goto delGlobalVar_waitforlock
     }
  }

}
set * . !lock #nsname
wait 4
set !global * . %1
set !varName %2 , ^ , %­3 , ^ , %­4 , |
str pos !global !varName
set #result #strres <> 0
if #result
{
  set !varNamePos #strres
  str len !varName
  set !splitString !varNamePos + #strres - 1
  set !delString !varNamePos - 1
  str left !global !delString
  set !globalPart1 #strres
  str del !global 1 !splitString
  set !global #strres
  str pos !global |
  set !delString #strres
  str del !global 1 !delString
  if  * . !lock <> #nsname
  {
     set !lockcount 0
     goto delGlobalVar_waitforlock
  }
  set * . %1 !globalPart1 , #strres
}
if  * . !lock = #nsname
  set * . !lock N/A
nameSpace clear
nameSpace pop
return #result

;========================================
; Script Name: Replace Sub from: some Useful String Subs
; Author: Janus
; Version: 1.2
; Client Tested with: 4.0.3e client
; EUO version tested with: 1.42 B0096
; Shard OSI / FS: Local POL
; Revision Date: 09-10-04
; Public Release: 09-10-04
; Purpose: some useful string subs, new ones being added from time to time...
;========================================
sub replace
namespace push
namespace local rep
for !i 1 1000
  {
  str len %2
  set !par2len #strres
  set !s %1
  str len %1
  set !len #strres
     str pos %1 %2
  if #strres = 0
     {
     str lower %1
     namespace clear
     namespace pop
     return
     }
  else
     {
     set !p #strres
     str del %1 !p !len
     set %1 #strres
     set !p !p + !par2len - 1
     str del !s 1 !p
     set %1 %1 , %­3 , #strres
     }
  }

;==================================
; WAS: Smelt On Firebeetle sub (Edited for this script)
; Original Author: snicker7
; Version: 1.0b
; Client Tested with: 4.0.5b
; EUO version tested with: 1.42.009B
; Shard OSI / FS:  OSI
; Revision Date: 11/9/04
; Public Release: 11/6/05
; Global Variables Used: N/A
; Purpose: Smelts ore on your firebeetle.
;==================================
sub SmeltOnObject
set #menubutton n/a
if _ in %1
       {
       gosub string exp %1 _ smelt
       set #ltargetx %­smelt1
       set #ltargety %­smelt2
       set #ltargetz %­smelt3
       set #ltargettile %­smelt4
       set #ltargetkind 3
       goto smeltonbeetle
       }
else
       {
       set #ltargetid %1
       set #ltargetkind 1
       }
ignoreitem reset oreIgnored
finditem %1 G_ , %­smeltDist
if #findkind = -1
       {
       if %1 = %firebeetleID
               {
               msg all follow me$
               wait 40
               finditem %1 G_4
               if #findkind = -1
                       {
                       menu set status FireBeetle Is too far away!
                       set #targcurs 0
                       set %­jstart #jindex
                       return
                       }
               }
       if %1 <> %firebeetleid
               return
       }
smeltonbeetle:
finditem %­oretypes C_ , #backpackid
if #findkind = -1
       {
       set %­jstart #jindex
           return
       }
if #findtype = TVJ && #findstack < 2
          {
       ignoreitem #findid oreIgnored
       goto smeltonbeetle
           }
set #lobjectid #findid
event macro 17
target
if %1 = %firebeetleid
       {
       findbeetle:
       finditem %1 G_ , %­smeltdist
       if #findkind = -1
                  {
                     msg all follow me$
                     wait 40
                     finditem %1 G_4
                     if #findkind = -1
                                 {
                       menu set status FireBeetle Is too far away!
                       set #targcurs 0
                       set %­jstart #jindex
                       return
                       }
                      goto findbeetle
                   }
       }
event macro 22 0
wait 15
goto smeltonbeetle
return


;==================================
; Script Name: filesubs.txt (import version)
; Author: Kal In Ex
; Version: 1.09
; Client Tested with: 4.0.6a
; EUO version tested with: 1.42.009d
; Shard OSI / FS: OSI
; Revision Date: December 23, 2004
; Public Release: November 16, 2004
; Global Variables Used:
; Purpose: writing to files in EUO
; Copyright 2004 Kal In Ex
;==================================

; subs open, GetOSFileCmd, wipe, fwipe, write and dump
; are all a part of filesubs.txt only use this script
; in its entirety and do not modify it!

sub open ; <identifier> <filename>
       namespace push
       namespace local _filebuffers
       set !_filename %1 , _filename
       set !_buffer %1 , _buffer
       set !_dirop %1 , _dirop
       set ! . !_filename %2
       set ! . !_buffer
       set ! . !_dirop >>
       if !_filesub = n/a
               {
               gosub GetOSFileCmd _
               if #result = command.com
                       {
                       set !_filesub _filesubsW1
                       set !_filecmd command.com
                       }
               if #result = cmd.exe
                       {
                       set !_filesub _filesubsW2
                       set !_filecmd cmd.exe
                       }
               }
       namespace pop
       return

;==================
;**
;* @name GetOSFileCmd
;* @ver 1.0 9May04
;* @author Roadkill
;* @purpose check the OS and set @%1 to cmd.exe or command.exe if win98/2000xp
;* @params %1 the varname to hold the return command
;* @returns @%1 and #result hold cmd.exe for win2k and xp, or command.exe for 98/me
;* @example call rksubs.txt GetOSFileCmd filecmd
;* @status done
sub GetOSFileCmd
       str Left #osver 1
       set % . %1 cmd.exe
       if #strRes = 1
               set % . %1 command.com
       return % . %1
;==================

sub wipe ; <identifier>
       namespace push
       namespace local _filebuffers
       set !_buffer %1 , _buffer
       set !_dirop %1 , _dirop
       set ! . !_buffer
       set ! . !_dirop >
       namespace pop
       return

sub fwipe ; <identifier>
       namespace push
       namespace local _filebuffers
       set !_filename %1 , _filename
       set !_buffer %1 , _buffer
       set ! . !_buffer
       execute !_filecmd /c type > ! . !_filename
       namespace pop
       return

sub write ; <identifier> <text> <text> <text...>
       namespace push
       namespace local _filebuffers
       if %0 > 2
               {
               for !_ 3 %0
                       {
                       set %2 %2 , #spc , % . !_
                       }
               }
       goto !_filesub
       namespace pop
       return

_filesubsW1:
       set !_filename %1 , _filename
       set !_dirop %1 , _dirop
       execute !_filecmd /c echo %2 ! . !_dirop ! . !_filename
       set ! . !_dirop >>
       namespace pop
       return

_filesubsW2:
       str len %2
       for !_ #strres 1
               {
               str mid %2 !_ 1
               if #strres in &|()^<>
                       {
                       str ins %2 ^ !_
                       set %2 #strres
                       }
               }
       set !_filename %1 , _filename
       set !_buffer %1 , _buffer
       set !_dirop %1 , _dirop
       str len ! . !_buffer
       set !_ #strres
       str len %2
       if !_ + #strres >= 1900
               {
               execute !_filecmd /c ! . !_buffer
               set ! . !_buffer
               }
       str len ! . !_buffer
       if #strres = 0 || ! . !_dirop = >
               set ! . !_buffer echo , #spc , %2 , #spc , ! . !_dirop , #spc , ! . !_filename
       else
               set ! . !_buffer ! . !_buffer , #spc , && , #spc , echo , #spc , %2 , #spc , ! . !_dirop , #spc , ! . !_filename
       set ! . !_dirop >>
       namespace pop
       return

sub dump ; <identifier>
       namespace push
       namespace local _filebuffers
       set !_filename %1 , _filename
       set !_buffer %1 , _buffer
       str len ! . !_buffer
       if #strres > 0
               {
               execute !_filecmd /c ! . !_buffer
               set ! . !_buffer
               }
       namespace pop
       return
;==================================
; end of filesubs.txt
;==================================

;==================================
; Script Name: Gravisoft's String Implode/Explode SUB
; Author: Gravix
; Version: 1.1
; Client Tested with: 4.0.6a
; EUO version tested with: 1.42.009F
; Shard OSI / FS: Both
; Revision Date: 1/19/04
; Public Release: 1/01/04
; Global Variables Used: None
; Purpose: Implode: Take an array and link into a string separated by a value/char
; Explode: Take a string and break into array based on dividers
;==================================

;SUB string exp %­str %div %arry
SUB String
if %­5 <> #true
       {
       namespace push
       namespace local Implode-Explode
       }
IF %1 = exp
        {
         SET !c 0
         SET !s %2
       break:
           IF %­3 in !s
                   {
                    SET !c !c + 1
                     STR POS !s %­3
                     SET !p0 #STRRES
                     SET !p1 !p0 - 1
                     STR LEFT !s !p1
                     if %­5 <> #true
                       SET % . %­4 , !c #STRRES
               if %­5
                       SET ! . %­4 , !c #STRRES
                     STR DEL !s 1 !p0
                     SET !s #STRRES
                     GOTO break
                   }
           ELSE
                   {
                   SET !c !c + 1
               if %­5
                             SET ! . %­4 , !c !s
                     Set #result !c
               if %­5 <> #true
                             {
                             SET % . %­4 , !c !s
                       Namespace clear
                             Namepsace pop
                       }
               RETURN #result
                   }
         }
RETURN #FALSE
 
Top
Floran^.^
view post Posted on 22/8/2010, 23:44




O_O ettore... questo è il primo pezzo??
 
Top
EttoreR
view post Posted on 23/8/2010, 02:33




è tutto intero, ci sono però due sezioni "CODICE"
 
Top
Gold Rogers
view post Posted on 5/9/2010, 13:12




meglio metterlo in spoiler
 
Top
EttoreR
view post Posted on 5/9/2010, 22:41




c'ho provato, mi da un sacco d'errori
 
Top
Tekkiru Masashi
view post Posted on 16/11/2010, 14:05




ciao! ho provato a farlo partire, mi dice che aggiorno il database o cancello il vecchio che faccio? grazie mille
 
Top
EttoreR
view post Posted on 17/11/2010, 17:11




Cancella tanto è vuoto all'inizio
 
Top
Tekkiru Masashi
view post Posted on 17/11/2010, 18:29




Ok grazie mille!
 
Top
7 replies since 22/8/2010, 23:37   76 views
  Share