set %ver V1.1
set %bank #false
set %hideme #true ;set to false if you do not wish to hide at your house/
set %stops 100s ;set to zero or lees to not wait after end of book

gosub ids
gosub setup
gosub booksetup

sub setup
set %asd 30
set %asa 10
set %stop 0
Menu Clear
Menu hide
Menu Window size 320 40
Menu Window Color $D9D0C8
Menu Font bgcolor $D9D0C8
Menu Font Color Black
Menu Font Style b
Menu font size 12
Menu Font Name tahoma
Menu Window Title Jebbits Cotton Picker
Menu Text txt 10 10 Please Rate This Script If You Use It
menu show 270 0
wait 60
menu hide

Menu Clear
Menu hide
Menu Window size 235 210
Menu Window Color $D9D0C8
Menu Font bgcolor $D9D0C8
Menu Font Color Black
Menu Font Name tahoma
Menu Window Title Jebbits Cotton Picker
Menu Text txt 10 10 Initializing
Menu Font Color red
Menu Text txt1 5 30 Ver %ver OSI/Some Free Shards 9/19/04
Menu Font Color black
menu show 0 0
menu show 0 0
menu hideeuo
wait 60
menu delete txt1
Menu Text txt 10 %asa Initializing.
Menu Text txt1 10 %asd Opening Paperdoll
Event macro 8 1
wait 20
contpos 650 0
event macro 8 7
wait 20
Menu Font Color red
Menu Text txt2 150 %asd Passed
Menu Font Color black
set %asd %asd + 15
Menu Text txt 10 10 Initializing..
Menu Text txt1 10 %asd Opening Status
event macro 8 2
wait 20
contpos 200 200
wait 20
CLICK 596 358
Menu Font Color red
Menu Text txt2 150 %asd Passed
Menu Font Color black
menu delete txt
set %asd %asd + 15
Menu Text txt 10 10 Initializing...
Menu Text txt1 10 %asd Opening Backpack
event macro 8 7
      wait 20
contpos 615 330
wait 10
set %backpackid #contid
wait 10
Menu Font Color red
Menu Text txt2 150 %asd Passed
menu delete txt
set %asd %asd + 15
Menu Font Color black
Menu Text txt 10 10 Initializing.......
Menu Text txt1 10 %asd Locating Secure
wait 30
Menu Font Color Green
if %bank = #true || %mark = 15
{
Menu Text txt2 150 %asd Bank
msg bank $
wait 20
set %secureid #contid
}
else
{
Menu Text txt2 150 %asd House
finditem jif_kif_iif_HIF_bud G_2
wait 10
set #LOBJECTID #findid
     event macro 17 0
set %secureid #findid
wait
}
if #findid = x && %bank = #false
{
set %stop 2
Menu Font Color red
Menu Text txt2 150 %asd Failed
}
Menu Font Color black
if #findid <> x
{
Menu Font Color red
Menu Text txt2 150 %asd Passed
}
Menu Font Color black
if #findid = x && %bank = #true
{
Menu Font Color red
Menu Text txt2 150 %asd Passed
}
Menu Font Color black
wait 20
menu delete txt
set %asd %asd + 15
Menu Text txt 10 10 Initializing........
Menu Text txt1 10 %asd Locating Storage Box
WAIT 10
if %bank = #true || %mark = 15
finditem cud_hkf_hif c_
else
finditem cud_hkf c_ , %secureid
wait 25
if #findid = x
{
set %stop 2
Menu Font Color red
Menu Text txt2 150 %asd Failed
}
if #findid <> x
{
Menu Font Color red
Menu Text txt2 150 %asd Passed
}
Menu Font Color black
wait 20
set #LOBJECTID #findid
set %orebagid #findid
wait 10
set %asd %asd + 15
Menu Text txt 10 10 Initializing........
Menu Text txt1 10 %asd Book Gump
WAIT 10
finditem ZBN c_ , %backpackid
wait 20
if #findid = x
Display msg Not finding any rune books
else
{
set %scnt #scnt + 5
set #lobjectid #findid
set %drag #contkind
event macro 17 0
hang:
wait 35
if %drag = #contkind && %scnt > #scnt
goto hang
else
{
if #contkind = %drag
set %smoke yes
set %drag #contkind
}
click 345 281 r
}
if %smoke = yes
{
set %stop 2
Menu Font Color red
Menu Text txt2 150 %asd Failed
}
if %smoke <> yes
{
Menu Font Color red
Menu Text txt2 150 %asd Passed
}
Menu Font Color black
set %asd %asd + 15
Menu Text txt 10 10 Initializing........
Menu Text txt1 10 %asd Setting Books
WAIT 10
gosub booksetup
if %_runebook1 = 0
{
set %stop 2
Menu Font Color red
Menu Text txt2 150 %asd Failed
}
else
{
Menu Font Color red
Menu Text txt2 150 %asd Passed
}

menu delete txt
set %asd %asd + 20
Menu Font Color red
Menu Text txt 10 10 Initializing.........
if %stop <> 2 2
Menu Text txt1 10 %asd Done And Ready For Action
wait 60
if %stop = 2 3
Menu Font Color red
Menu Text txt1 10 %asd Please Fix Failed Tests And Restart
halt

menu hide
CLICK 128 192 R
hide easyuo
msg $

SET %cx #charposx
SET %cy #charposy
set %cz #charposz
return

sub ids
;********DONT CHANGE ANYTHING PAST HERE*****************
set %Totalmana #mana - 5
set %alloreid nff
set %delay 30
set %runebook 1
set %runenum 1
set %weight #weight
set %weighttotal 0
set %targetfirst 0
set %alreadymade1 0
set %doublecheck 0
set %counterstarted 0
set %_runebook1 0
set %_runebook2 0
set %maxweight #maxweight - 10
set %set 0
set %scnt 0
set %magery #true
if %magery = #true
set %spot 345
else
set %spot 381
return

sub booksetup
runebook1:
finditem ZBN c_ , %backpackid
if #findid = x
set %stop 2
event property #findid
IF cotton in #property
{
set #lobjectid #findid
set %_runebook1 #lobjectid
gosub rune
set %first %qqq
set %number %qqq
}
ignoreitem #findid
if %_runebook1 = 0
goto runebook1
ignoreitem reset

homebook:
finditem ZBN c_ , %backpackid
event property #findid
wait 10
if home in #property 4
set #lobjectid #findid
set %_runebook2 #lobjectid
gosub rune
set %houserune %qqq
ignoreitem #findid
if #findid = x 2
ignoreitem reset
goto homebook
if %_runebook2 = 0
goto homebook
ignoreitem reset
return

sub rune
set %qqq 16
up:
if %qqq < 1
{
set %stop 2
goto qqq
}
if %qqq notin #property
{
set %qqq %qqq - 1
goto up
}
qqq:
return

;****************MAIN MENU**********************

;******PRE-SHOVEL CHECK***********
loop1:
menu hide
finditem %shovelid c_ , %backpackid
if #findkind <> 0
gosub shovell

;***********MAIN LOOP****************

loop:
gosub recall
gosub digger
gosub check
goto loop
;**********DIGGING SUBROUTINE***********
sub digger
cotton:
finditem hpe_voe_cpe_gpe_FPE_IPE_nff G_7
if #findkind = 1
{
move #findx #findy 0 2s
set #lobjectid #findid
if #findtype = %alloreid
gosub bale
else
event macro 17 0
ignoreitem #findid
wait 30
gosub check
goto cotton
}
WAIT %DigWait
return

;
;**************CHECK SUBROUTINE****************
sub check
if #weight > %maxweight || Your_backpack_is_full in #journal
{
;set %move 1
;DELETEJOURNAL
set %runenum2 %runenum
set %runebook2 %runebook
set %runebook 2
set %runenum %houserune
gosub house
houserecall:
set %runebook %runebook2
set %runenum %runenum2
}
if #findid = x
{
DELETEJOURNAL
set %runenum %runenum + 1
set %counterstarted 0
if %runenum = %number + 1
{
set %runenum 1
set %stopper 1
set %runenum2 %runenum
set %runebook2 %runebook
set %runebook 2
set %runenum %houserune
gosub house
houserecall:
set %runebook %runebook2
set %runenum %runenum2
set %stopper 0
}
}
set %x + 1
return

;***********HOUSE SUBROUTINE************
sub house
gosub recall
wait 20
;***********WALKING TO SECURE*************
set %scnt #scnt
movingtime:
if #scnt - %scnt > 4
{
set %scnt #scnt
event pathfind %cx %cy %cz
wait 2s
}
move %cx %cy 0 1s
if #charposx <> %cx || #charposy <> %cy
goto movingtime
set %x + 1
set %counter 0
;***************************HIDING********************
if %hideme = #true
event macro 13 21
wait 5
;****************FIND AND OPEN CHEST*************
opensecure:
;Find chest
if %bank = #true 2
msg Bank $
goto skip
FINDITEM %SECUREID
IF #FINDKIND = -1
{
GOTO OPENSECURE:
}
skip:
;Open chest
set #LOBJECTID %secureid
set #findmod 0_0
set #NEXTCPOSX 27
set #NEXTCPOSY 49
event macro 17 0
WaitSecureToOpen:
finditem %orebagid
if #findid <> %orebagid
goto WaitSecureToOpen
IgnOREITEM RESET
;---------------------------------------------Ore routine-------------------------------------------------
finditem %alloreid c_ , %backpackid
finditem %alloreid
if #findkind = 1
{
IGNOREITEM #findid
goto ore
}

if #findkind = 0
{
event drag #findid
wait 5
msg $
wait 5
finditem %orebagid
set #findmod 20_10
stillinhand:
click #findx #findy
wait 5
if #LLIFTEDKIND = 1
goto stillinhand
goto ore
}
mana:
IF %manaset = #false
{

return
}
if #mana < %Totalmana
{
event macro 13 46
wait 10s
goto mana
}
if %stopper = 1
wait %stops
return
;--------------------------------------GET SHOVEL---------------------------------------------------------

;**********************RUNEBOOK SUBROUTINE**********************************
sub Recall
set %x 0
set %sss = 0
recallagain:
     set %_runebooknum %runebook
     set %_runenumber %runenum
     set %_style 0
     set %_time 10

     set %_oldx #charposx
     set %_oldy #charposy

     set %_page 0
     set %_side 0
     set %_num %_runenumber / 2
     set %_page %_runenumber + 1
     set %_page %_page / 2
     set %_num %_num * 2
recallselectbook:
     if %_runebooknum = 1
          set %_runebookid %_runebook1
     if %_runebooknum = 2
          set %_runebookid %_runebook2
     if %_runebooknum = 3
          set %_runebookid %_runebook3
recallopenagain:
wait 5
     set #LOBJECTID %_runebookid
     event macro 17 0
wait 5
     set #SCNT 0
recallwaitforbook:
     if #SCNT > 10
          goto recallopenagain
;Next line changes with patch
;-----------------------------------------------------------------------------------------------------------------------------------------
     if #CONTKIND <> %Drag
          goto recallwaitforbook
     deletejournal
set %spot2 #contposy + 195
set %spot #contposy + 145

     if %_num = %_runenumber
          set %_side 1
     set %_runex #contposx + 139
if %_side = 1
set %_runex #contposx + 299
     set %_pagexmod %_page * 34
     set %_pagex #contposx + 104
     set %_pagex %_pagex + %_pagexmod
     if %_page > 4
          set %_pagex %_pagex + 31
WAIT 5
     click %_pagex %spot2
WAIT 5
     click %_runex %spot
     set #SCNT 0
recallwaitforrecall:
     if #SCNT > 10
          goto recallagain
     scanjournal 1
if tithing_points in #journal 2
set %spot 345
display msg You have run out of Tithing points. Script has been reset for Magery. Press ok to continue with magery or Tith and restart.
if too_encumbered in #journal
gosub dragit
     if something_is_blocking_the_location in #journal
     goto nextrune2
     if for_this_spell in #journal 2
          event macro 13 46
          wait 30
     if %_oldx = #charposx
     {
          if %_oldy = #charposy
          {
               goto recallwaitforrecall
          }
     }
wait 1s
     return

;------------------------OVERWEIGHT ORE DRAG-----------------------------
sub dragit
SET %ST 300
SET %SY 215
SET %SS 0
set %maxweight %MAXWEIGHT - 5
drop:
if #weight < #maxweight
return
WAIT 15
SET %SS %SS + 1
IF %SSS = 5
RETURN
IF %SS = 2
SET %SY %SY + 30
IF %SS = 3
SET %ST %ST + 30
IF %SS = 4
SET %SY %SY - 30
FINDdwj:
finditem nff c_ , %backpackid
If #findcol <> 0 && #FINDID <> X
{
ignoreitem #findid
goto FINDdwj
}
if #FindCol = 0
{
if #findkind = 0
{
IF #LLIFTEDKIND = 0
Event Drag #Findid
wait 5
msg 1 $
wait 20
click %ST %SY P
}
GOTO drop
return

sub bale
event drag #findid
ignoreitem #findid
wait 10
wai:
IF #LLIFTEDKIND = 1
{
click 787 222 p
click 787 222 p
wait 10
}
if #lliftedkind = 1
goto wai
return