Back to "b" tags

Boat Bot v4.1a by Brozan (Syal)

Description: To view full description:

https://discord.com/channels/290936867199909888/907657216025313331/950433861437915177

1#Part of the attack routine is to call a Razor Dress routine named "bow".  Create it if you want it.  Will not break script if it does not exist
2
3#Target Lock:
4#0=default behavior (Let the script try to be intelligent)
5#1=Area discord -- kill one thing at a time (Good for things that do not want to spread damage.  
6#2=Single target discord -- switch target after every round of skill usages (SPECIAL NOTE: Bosses will switch target type to this on purpose so you kill NPC spawns with bot and target disco boss)
7@setvar targetLockType 2 
8
9#Summon Type Selector.  Having Necromancy skill will still summon necro version.  We will always use Summon Creature as 5th slot.  Still requires 80 SS or Necro to trigger
10#MAKE SURE you only select two here.  Selecting more will break stuff.  
11#Valid Values are 0, 1, or 2 and it will summon that many of that type: Example setting fireElem to 2 will summon 2 fire elems.  Setting earthEleme to 1 and waterElem to 1 will summon 1 earth elemental and 1 waterElem
12@setvar fireElem 2
13@setvar earthElem 0
14@setvar airElem 0
15@setvar waterElem 0
16@setvar daemonSum 0
17
18#Repair Priority Queue.  Set these as 1/2/3.  If you fail to put one for each of these it will break shit.  Just leave it alone if you do not care
19@setvar repairHullOrder 3
20@setvar repairGunsOrder 1
21@setvar repairSailsOrder 2
22
23#Dynamic Boss Repair - Switches to hull priority on bosses.  Set to 1 to turn on.  Have to restart script to reset after bosses
24@setvar dynamicBossRepair 1
25
26#Set this to 1 if you do not  want to select your own tillerman (useful for recall or if you switch boats a lot.  Causes issues sometimes if it finds a friends dynamically)
27@setvar dynamicTiller 0
28
29#Set this to 1 if you want to throw self overboard if a ship repair kit is on the deck
30@setvar triggerOverboard 0
31
32#Set this to 1 to attempt to keep the bot from repairing within the combat repair window (only repairs 60-120s after boarding an NPC ship)
33@setvar repairLockdown 0
34
35#Set this to 1 to slow down repairs by 30s on bosses so you aren't always repairing
36@setvar slowRepairsBosses 1
37
38#Set this to 1 if you want to keep up buffs for Reactive Armour and Magic Reflect
39@setvar buffRA 0
40@setvar buffMR 0 
41
42#Set this to 1 to cast Mass Curse on first new enemy  
43@setvar massCurseToggle 1
44
45#Set this to 1 if you want to simulate always being boarded on NPC ship for testing reasons
46@setvar alwaysBoarded 0
47
48#Set this to 0 if you want to keep my super awesome say commands (1 mutes the bot except important stuff like food or fighting party)
49@setvar sayLess 0
50
51#Set this to 1 if you want to be a super fucking awesome pirate
52@setvar sayMore 0
53
54#Set this to 1 if you want bot to defuse close by bombs and reembark
55@setvar defuseBombs 1
56
57#Set this to 1 to have bot reload right after embarking
58@setvar reloadCannons 0
59
60#Set this to 1 if you want to upgrade greater poison casts
61@setvar upgradePoison 1
62
63#Set this if you want to have bot recall on dock.  Must have a book in pack named Home and first rune be the house to recall to if not magery.  If magery make home the default rune
64#IF YOU TURN THIS ON YOU MUST GO TO THE SECTION NAMED "WALK THIS WAY" AND SET UP DIRECTIONS INTO YOUR HOUSE FROM RECALL LOCATION
65@setvar goHomeBotYouAreDrunk 1
66
67#Set this to 1 if you want the bot to try to loot holds using RESTOCK-2 restock agent.  Update the ship hue list below if you are using this. 
68@setvar stealTheBooty 1
69
70#push your ship hues to this list for dynamic looting
71createlist shipHues
72clearlist shipHues
73pushlist shipHues 2933
74
75
76##################################################################################
77##################################################################################
78##################################################################################
79##############                                                 ###################
80##############              No setup below here                ###################
81##############                                                 ###################
82##################################################################################
83##################################################################################
84##################################################################################
85
86clearsysmsg 
87clearignore
88
89if 'sayMore' = 1
90    say "YO HO MATEY AWAY!" 33
91    wait 500
92endif
93
94#Timers.  We used to do these on an if exists basis, but it fubard too much stuff if you leave client open forever
95createtimer 'petAttack' 
96settimer 'petAttack' 0
97createtimer 'discoTimer'
98settimer 'discoTimer' 5000
99createtimer 'repairBoat'
100settimer 'repairBoat' 8000
101createtimer "shroomy"
102settimer "shroomy" 61000
103createtimer 'buffDisco'
104settimer 'buffDisco' 300000
105createtimer 'buffProvo'
106settimer 'buffProvo' 300000
107createtimer 'buffPeace'
108settimer 'buffPeace' 300000
109createtimer 'buffBeg'
110settimer 'buffBeg' 300000 
111createtimer 'bardLock'
112settimer 'bardLock' 0
113createtimer "aid time"
114settimer "aid time" 8000
115createtimer 'RepairHull'
116settimer 'RepairHull' 0
117createtimer 'buffTaste'
118settimer 'buffTaste' 15000
119createtimer 'newTargetCheck'
120settimer 'newTargetCheck' 15000
121createtimer 'spiritSpeakCheck'
122settimer 'spiritSpeakCheck' 15000
123createtimer 'foodCheck'
124settimer 'foodCheck' 120000
125createtimer 'crookCheck'
126settimer 'crookCheck' 120000
127createtimer 'crewHealing'
128settimer 'crewHealing' 120000
129createtimer 'onBoard'
130settimer 'onBoard' 120000
131createtimer 'painSpkeTimer'
132settimer 'painSpkeTimer' 120000
133createtimer 'poisonStrikeTimer'
134settimer 'poisonStrikeTimer' 120000
135createtimer 'vampTimer'
136settimer 'vampTimer' 120000
137createtimer 'dressTimer'
138settimer 'dressTimer' 120000
139createtimer 'provkeBossTimer' 
140settimer 'provkeBossTimer' 1500000
141createtimer 'goHomeBotYouAreDrunkTimer'
142settimer 'goHomeBotYouAreDrunkTimer' 100000
143createtimer 'scriptRunning'
144settimer 'scriptRunning' 100000
145createtimer 'singSeaShanties'
146settimer 'singSeaShanties' 70000
147createtimer 'sanityEmbarkCheck'
148settimer 'sanityEmbarkCheck' 0
149createtimer "walkingTooMuch" 
150settimer "walkingTooMuch" 0
151
152#Clear lastt t arget from last run - this can cause a weird bug
153unsetvar 'lastserial' 
154
155#Create list of instrument types and dclick if found
156removelist 'instrumentTypes'
157createlist 'instrumentTypes'
158pushlist 'instrumentTypes' 10245
159pushlist 'instrumentTypes' 3762
160pushlist 'instrumentTypes' 3740
161pushlist 'instrumentTypes' 3742
162pushlist 'instrumentTypes' 3763
163
164#Create list of reagents
165createlist regTypes
166clearlist regTypes
167@pushlist 'regTypes' 3963
168@pushlist 'regTypes' 3962
169@pushlist 'regTypes' 3973
170@pushlist 'regTypes' 3972
171@pushlist 'regTypes' 3980
172@pushlist 'regTypes' 3981
173@pushlist 'regTypes' 3976
174@pushlist 'regTypes' 3974
175
176#create list of food types since tray does not work any more
177createlist foodTypes 
178clearlist foodTypes
179@pushlist 'foodTypes' 28879
180@pushlist 'foodTypes' 28888
181@pushlist 'foodTypes' 28885
182@pushlist 'foodTypes' 29774
183@pushlist 'foodTypes' 28883
184@pushlist 'foodTypes' 28880
185@pushlist 'foodTypes' 29773
186@pushlist 'foodTypes' 28881
187
188#create list of tillermen
189createlist tillerMenList
190clearlist tillerMenList
191@pushlist 'tillerMenList' 15952
192@pushlist 'tillerMenList' 15955
193@pushlist 'tillerMenList' 15950
194@pushlist 'tillerMenList' 15947
195
196unsetvar 'tillerDude'
197if dynamicTiller = 0
198    overhead "Target Tillerman"
199    @setvar tillerDude 
200else
201    #try to find tillerman    
202	foreach tillerMenVar in tillerMenList
203		if findtype tillerMenVar ground as found
204			overhead "Tillerman Set"
205			setvar 'tillerDude' 'found'
206			dclick 'tillerDude'
207			wait 500
208		endif
209	endfor
210endif
211
212#Hold IDs
213createlist holdIDs
214clearlist holdIDs
215pushlist holdIDs 16019
216pushlist holdIDs 16046
217pushlist holdIDs 15973
218pushlist holdIDs 16057
219
220
221#NPC Ship Hues
222createlist NPCshipHues
223clearlist NPCshipHues
224#druid
225pushlist NPCshipHues 2845
226#Vile
227pushlist NPCshipHues 2841
228#Ossurary 
229pushlist NPCshipHues 2840
230#pirate
231pushlist NPCshipHues 2269
232#merchant
233pushlist NPCshipHues 2766
234#ghost
235pushlist NPCshipHues 2955
236#orc reaver
237pushlist NPCshipHues 2141
238#raider
239pushlist NPCshipHues 2927
240#tradesman
241pushlist NPCshipHues 2347
242#Lizardman
243pushlist NPCshipHues 2363
244#explorer
245pushlist NPCshipHues 2845
246#fisherman
247pushlist NPCshipHues 2076
248#daemon
249pushlist NPCshipHues 2740
250#submerged
251pushlist NPCshipHues 2826
252
253#Set up walking list for dymanic loot
254createlist walking
255clearlist walking
256
257#list for dump stuff
258createlist lootTypes
259clearlist lootTypes
260@pushlist 'lootTypes' 'muffins'
261@pushlist 'lootTypes' 'gold coin'
262@pushlist 'lootTypes' 'cooked fish'
263@pushlist 'lootTypes' 'Crab SOUTH'
264@pushlist 'lootTypes' 'Lobster SOUTH'
265@pushlist 'lootTypes' 'raw fish steak%s%'
266@pushlist 'lootTypes' 'Blood Moss'
267@pushlist 'lootTypes' 'Black Pearl%s%'
268@pushlist 'lootTypes' 'Ginseng'
269@pushlist 'lootTypes' 'Garlic'
270@pushlist 'lootTypes' 'Sulfurous Ash'
271@pushlist 'lootTypes' "Spider's Silk" 
272@pushlist 'lootTypes' 'Nightshade'
273@pushlist 'lootTypes' 'Mandrake Root%s%' //MR
274@pushlist 'lootTypes' 'cut%s% of raw ribs'
275@pushlist 'lootTypes' 'cut up leather'
276@pushlist 'lootTypes' 'clean bandage%s%'
277@pushlist 'lootTypes' 'arrow'
278@pushlist 'lootTypes' 'crossbow bolt'
279# ' for formatting reasons
280
281createlist ItemTypes
282clearlist ItemTypes
283//martial manual
284@pushlist 'ItemTypes' 22187
285//Shields
286@pushlist 'ItemTypes' 0x1b72 //BronzeShields
287@pushlist 'ItemTypes' 0x1b73 //Buckler
288@pushlist 'ItemTypes' 0x1b7b //MetalShield
289@pushlist 'ItemTypes' 0x1b74 //MetalKiteShield
290@pushlist 'ItemTypes' 0x1b79 //TearKiteShield
291@pushlist 'ItemTypes' 0x1b7a //WoodenShield
292@pushlist 'ItemTypes' 0x1b76 //HeaterShield
293@pushlist 'ItemTypes' 0x1b77 //HeaterShield
294//Platemail
295@pushlist 'ItemTypes' 0x1408 //CloseHelmet
296@pushlist 'ItemTypes' 0x1410 //PlatemailArms
297@pushlist 'ItemTypes' 0x1417 //PlatemailArms
298@pushlist 'ItemTypes' 0x1411 //PlatemailLegs
299@pushlist 'ItemTypes' 0x1412 //PlateHelm
300@pushlist 'ItemTypes' 0x1413 //PlateGorget
301@pushlist 'ItemTypes' 0x1418 //PlatemailGloves
302@pushlist 'ItemTypes' 0x1415 //PlateChest
303@pushlist 'ItemTypes' 0x140a //Helmet
304@pushlist 'ItemTypes' 0x140c //Bascinet
305@pushlist 'ItemTypes' 0x140e //NorseHelm
306//Chainmail
307@pushlist 'ItemTypes' 0x13bb //ChainmailCoif
308@pushlist 'ItemTypes' 0x13c3 //ChainmailLeggins
309@pushlist 'ItemTypes' 0x13c4 //ChainmailChest
310@pushlist 'ItemTypes' 0x13c0 //ChainmailHelm
311//Ringmail
312@pushlist 'ItemTypes' 0x13ef //RingmailArms
313@pushlist 'ItemTypes' 0x13f2 //RingmailGloves
314@pushlist 'ItemTypes' 0x13ed //RingmailChest
315@pushlist 'ItemTypes' 0x13f1 //RingmailLeggins
316@pushlist 'ItemTypes' 0x140b //RingmailHelm
317//Studded
318@pushlist 'ItemTypes' 0x1dba //Studdedcap
319@pushlist 'ItemTypes' 0x13e1 //StuddedLeggings
320@pushlist 'ItemTypes' 0x13db //StuddedTunic
321@pushlist 'ItemTypes' 0x13d5 //StuddedGloves
322@pushlist 'ItemTypes' 0x13d6 //StuddedGorget
323@pushlist 'ItemTypes' 0x13dc //StuddedSleeves
324//Leather
325@pushlist 'ItemTypes' 0x13ce //LeatherGloves
326@pushlist 'ItemTypes' 0x13cd //LeatherSleeves
327@pushlist 'ItemTypes' 0x13d3 //LeatherChest
328@pushlist 'ItemTypes' 0x13cb //LeatherPants
329@pushlist 'ItemTypes' 0x13c7 //LeatherGorget
330@pushlist 'ItemTypes' 0x1db9 //LeatherCap
331@pushlist 'ItemTypes' 0x13c5 //LeatherArms
332//FemaleArmor
333@pushlist 'ItemTypes' 0x1c04 //FemalePlate
334@pushlist 'ItemTypes' 0x1c09 //FemalePlateSkirt
335@pushlist 'ItemTypes' 0x1c0c //FemaleStuddedBustier
336@pushlist 'ItemTypes' 0x1c02 //FemaleStuddedArmor
337@pushlist 'ItemTypes' 0x1c09 //FemaleRingmailSkirt
338@pushlist 'ItemTypes' 0x1c00 //FemaleLeatherShorts
339@pushlist 'ItemTypes' 0x1c09 //FemaleLeatherSkirt
340@pushlist 'ItemTypes' 0x1c06 //FemaleLeatherArmor
341@pushlist 'ItemTypes' 0x1c0b //FemaleLeatherBustier
342@pushlist 'ItemTypes' 0x1c09 //FemaleBoneSkirt
343//Fencing
344@pushlist 'ItemTypes' 0xf62  //Spear
345@pushlist 'ItemTypes' 0x1403 //ShortSpear
346@pushlist 'ItemTypes' 0xe87  //Pitchfork
347@pushlist 'ItemTypes' 0x1405 //Warfork
348@pushlist 'ItemTypes' 0x1401 //Kryss
349@pushlist 'ItemTypes' 0xf52  //Dagger
350//Macing
351@pushlist 'ItemTypes' 0x13b0 //Waraxe
352@pushlist 'ItemTypes' 0xdf0  //BlackStaff
353@pushlist 'ItemTypes' 0x1439 //WarHammer
354@pushlist 'ItemTypes' 0x1407 //WarMace
355@pushlist 'ItemTypes' 0xe89  //QuarterStaff
356@pushlist 'ItemTypes' 0x143d //HammerPick
357@pushlist 'ItemTypes' 0x13b4 //Club
358@pushlist 'ItemTypes' 0xe81  //ShepherdsCrook
359@pushlist 'ItemTypes' 0x13f8 //GnarledStaff
360@pushlist 'ItemTypes' 0xf5c  //Mace
361@pushlist 'ItemTypes' 0x143b //Maul
362//Swords
363@pushlist 'ItemTypes' 0x13b9 //VikingSword
364@pushlist 'ItemTypes' 0xf61  //Longsword
365@pushlist 'ItemTypes' 0x1441 //Cutlass
366@pushlist 'ItemTypes' 0x13b6 //Scimitar
367@pushlist 'ItemTypes' 0xec4  //SkinningKnife
368@pushlist 'ItemTypes' 0x13f6 //ButcherKnife
369@pushlist 'ItemTypes' 0xf5e  //Broadsword
370@pushlist 'ItemTypes' 0x13ff //Katana
371@pushlist 'ItemTypes' 0xec3  //Cleaver
372//Axes
373@pushlist 'ItemTypes' 0xf43 //Hatchet
374@pushlist 'ItemTypes' 0xf45 //ExecutionersAxe
375@pushlist 'ItemTypes' 0xf4d //Bardiche
376@pushlist 'ItemTypes' 0xf4b  //DoubleAxe
377@pushlist 'ItemTypes' 0x143e //Halberd
378@pushlist 'ItemTypes' 0x13fb //LargeBattleAxe
379@pushlist 'ItemTypes' 0x1443 //TwoHandedAxe
380@pushlist 'ItemTypes' 0xf47  //BattleAxe
381@pushlist 'ItemTypes' 0xf49  //Axe
382//Bows
383@pushlist 'ItemTypes' 0x13fd //HeavyXbow
384@pushlist 'ItemTypes' 0xf50  //Xbow
385@pushlist 'ItemTypes' 0x13b2 //bow
386//Instruments
387@pushlist 'ItemTypes' 0xeb2 //Harp
388@pushlist 'ItemTypes' 0xe9c //Drums
389@pushlist 'ItemTypes' 0xeb3 //Lute
390@pushlist 'ItemTypes' 0xe9e //Tambourine
391@pushlist 'ItemTypes' 0x2805 //BambooFlute
392//Other Helmets
393@pushlist 'ItemTypes' 0x140f //NorseHelm
394//BoneArmor
395@pushlist 'ItemTypes' 0x1451 //BoneHelm
396@pushlist 'ItemTypes' 0x1457 //BoneLegs
397@pushlist 'ItemTypes' 0x1453 //BoneArms
398@pushlist 'ItemTypes' 0x1455 //BoneGloves
399//SlayerWands
400@pushlist 'ItemTypes' 0xdf2 //SlayerWands
401@pushlist 'ItemTypes' 0xdf3 //SlayerWands
402@pushlist 'ItemTypes' 0xdf4 //SlayerWands
403@pushlist 'ItemTypes' 0xdf5 //SlayerWands
404//OtherSTuff, that wasnt in list...
405@pushlist 'ItemTypes' 0xdf5 //SlayerWands
406@pushlist 'ItemTypes' 0xefa //SpellBook
407@pushlist 'ItemTypes' 0x141a //platemailleggings
408@pushlist 'ItemTypes' 0x1b7a //woodenshield
409@pushlist 'ItemTypes' 0x13e2 //studdedchets
410@pushlist 'ItemTypes' 0x1b79 //woodenkiteshield
411@pushlist 'ItemTypes' 0x26bd //harpoon
412@pushlist 'ItemTypes' 0x1c05 //Femaleplatechest
413@pushlist 'ItemTypes' 0x1c0d //studdedbrasier
414@pushlist 'ItemTypes' 0x1c01 //leathershorts
415@pushlist 'ItemTypes' 0x1b75 //metalkiteshield
416@pushlist 'ItemTypes' 0x1c07 //Femaleleather
417@pushlist 'ItemTypes' 0x1416 //platemailchest
418@pushlist 'ItemTypes' 0x13dd //studdedgloves
419@pushlist 'ItemTypes' 0x1454 //Bonechest
420@pushlist 'ItemTypes' 0x13d2 //leatherleggings
421@pushlist 'ItemTypes' 0x1409 //closehelm
422@pushlist 'ItemTypes' 0x13d4 //studdedarms
423
424
425#Loop through instruments and dclick one
426if skill "Musicianship" > 50
427    foreach instrumentType in 'instrumentTypes'
428        dclicktype instrumentType
429    endfor
430endif
431
432#open necro book
433if skill "Necromancy" > 50
434    dclicktype "8787"
435    waitforgump 3897999232
436    gumpresponse 2 3897999232
437    wait 250
438    gumpclose 3897999232
439endif   
440
441#Set boarded state - 1=boarded NPC 0=on our ship
442@setvar 'boardState' 0
443#Set up tracking sate 1=tracking 0=not
444@setvar 'trackState' 0
445#set up var to check if we have enemies in range
446@setvar 'closeEnemy' 0
447#set up blue tracking option
448@setvar 'blueSighted' 0
449#Boss Tracker
450@setvar 'bossFight' 0
451#Target Lock
452@setvar targetLock targetLockType
453#discoLock
454@setvar discoLock targetLockType
455#provoke boss
456@setvar 'provokeBoss' 0
457#set bot at home flag
458@setvar 'botAtHome' 0
459#set where we are on wellerman
460@setvar wellerManProgress 0
461#Var to track if we found hold
462@setvar stopWalking 0
463#Set up hold tracker
464@setvar holdToLoot 0
465#Set up hold tracker for own boat
466@setvar myShipHold 0
467#Variable to track NPC Hold
468@setvar npcHold 0
469
470
471#set pets if they exist
472if skill "Veterinary" > 50 and followers >= 1
473    overhead "Target pet 1" 
474    setvar! pet1
475    overhead "Target pet 2"
476    setvar! pet2
477    overhead "Target pet 3"
478    setvar! pet3 
479endif   
480
481if skill "Healing" > 50
482    say '[ShipHotbars'
483    wait 500
484endif   
485
486#do camping buff at least once regardless of buff status
487#camping buff
488if skill "Camping" > 50 
489    #cut some kindling off our boat...seriously
490    if not findtype 3553 backpack
491        dclicktype 3922
492        waitfortarget 4500
493        target 'self'
494        wait 600
495    endif
496    if not findtype 3555 true
497        dclicktype 3553 backpack
498        wait 350
499        while insysmsg "You fail to ignite"
500            wait 3000    
501            dclicktype "kindling" backpack
502            wait 350
503        endwhile
504    endif
505    wait 600
506endif
507
508     
509if followers > 1
510    say "All guard me"
511endif   
512
513
514while not dead
515    #Announce we are running
516    if timer "scriptRunning" > 15000
517        overhead "Bot is running"
518        settimer "scriptRunning" 0
519    endif
520    
521    #Dynamic Tillerman Check
522    if dynamicTiller = 1
523        if not varexist 'tillerDude'
524			foreach tillerMenVar in tillerMenList
525				if findtype tillerMenVar ground as found
526					overhead "Tillerman Set"
527					setvar 'tillerDude' 'found'
528					dclick 'tillerDude'
529					wait 500
530				endif
531			endfor
532        endif
533    endif
534    #put in a pause so we dont spam 
535    wait 100    
536    
537    if alwaysBoarded = 1
538        @setvar boardState 1
539    endif
540    
541    #Be a real pirate
542    if wellerManProgress = 0 and sayMore = 1 and timer "singSeaShanties" > 20000 and boardState = 0
543        wait 500
544        say "There once was a ship that put to sea / The name of the ship was the Billy of Tea " 45
545        wait 500
546        say "/ The winds blew up, her bow dipped down / Oh blow, my bully boys, blow" 45
547        settimer 'singSeaShanties' 0
548        @setvar wellerManProgress 1
549    elseif wellerManProgress = 1 and sayMore = 1 and timer "singSeaShanties" > 20000 and boardState = 0
550        wait 500
551        say "Soon may the Wellerman come / To bring us sugar and tea and rum " 45
552        wait 500
553        say "/ One day, when the tonguing is done / Well take our leave and go"  45
554        settimer 'singSeaShanties' 0
555        @setvar wellerManProgress 2
556    elseif wellerManProgress = 2 and sayMore = 1 and timer "singSeaShanties" > 20000 and boardState = 0
557        wait 500
558        say "Shed not been two weeks from shore / When down on her a right whale bore " 45
559        wait 500
560        say "/ The captain called all hands and swore / Hed take that whale in tow" 45
561        settimer 'singSeaShanties' 0
562        @setvar wellerManProgress 3
563    elseif wellerManProgress = 3 and sayMore = 1 and timer "singSeaShanties" > 20000 and boardState = 0
564        wait 500
565        say "Soon may the Wellerman come / To bring us sugar and tea and rum / One day, when the tonguing is done / Well take our leave and go" 45
566        settimer 'singSeaShanties' 0
567        @setvar wellerManProgress 4
568    elseif wellerManProgress = 4 and sayMore = 1 and timer "singSeaShanties" > 20000 and boardState = 0
569        wait 500
570        say "Da-da-da-da-da / Da-da-da-da-da-da-da / Da-da-da-da-da-da-da-da-da-da-da" 45 
571        settimer 'singSeaShanties' 0
572        @setvar wellerManProgress 0
573    endif
574    
575    ###############                                             ###############
576    ###############Start routines that keep us alive or set vars###############
577    ###############                                             ###############   
578    
579    #make sure a cursor does not exist from before
580    if targetexists
581        hotkey "Cancel Current Target"
582        wait 350
583    endif   
584    
585    #Check if we are on NPC ship
586    if insysmsg "You board the ship"
587        @setvar 'boardState' 1 
588        settimer "onBoard" 0
589        @setvar stopWalking 0
590        if sayLess = 0 
591            wait 500
592            say "***Lets Gooooo! (Lets Gooooo!) / If you want it you can get it let me know (let me know)**" 44
593        endif
594    endif
595    
596    #disco routine if target lock is 1 or we are on a humanoid boat
597    if discoLock = 1 or targetLockType = 1
598        if  skill "Discordance" > 50 and timer "bardLock" > 10000 and timer "discoTimer" > 5150 and closeEnemy = 1 
599            overhead "Disco Target!" 33
600            skill "Discordance" 
601            wft 500
602            target self
603            settimer "discoTimer" 0
604            settimer "bardLock" 4750
605        endif
606    endif
607    
608    #hidden check
609    if hidden and boardState = 0
610        continue
611    endif
612    
613    #dont let this guy die routine
614    if hp < 55 
615        overhead 'Drinking heal!'
616        potion "heal"
617        wait 200
618    endif
619    #Chiv Poisoned
620    if skill "Chivalry" > 50 and poisoned 
621        say "[cleansebyfire"
622    endif
623    #Magery Survival
624    if skill "Magery" > 50
625        #we cast arch here bc it probably hit whole crew
626        if poisoned 'self'
627            cast 'Arch Cure'
628            waitfortarget 1755
629            target 'self'
630            wait 666
631        endif
632        if diffhits > 18
633            cast "greater heal"
634            wft 3500
635            target self
636            wait 650 
637        endif   
638        #Eat a magic mushroom if we have 
639        #25  less mana than full
640        if mana < 70 and timer "shroomy" >= 65000
641            dclicktype '29012'
642            overhead 'Mushroom Power!'
643            settimer "shroomy" 0
644        endif
645    endif
646    # Bandage Survival
647    if skill 'Healing' > 50
648        if insysmsg 'You begin applying the bandages'
649            settimer 'aid time' 0
650        endif
651        if diffhits > 10 and timer 'aid time' > 10250 
652            hotkey 'bandage self'
653            settimer 'aid time' 0
654        endif
655        if insysmsg 'You begin applying the bandages'
656            settimer 'aid time' 0
657        endif
658    endif
659    
660    #Goes through blue gates
661    if findtype 3948 'ground' 0 1 2 as 'bluegate'
662        dclick 'bluegate'
663        waitforgump 3899019871
664        gumpresponse 2
665        wait 500
666        say "[embark"
667        wait 500
668        say "[embarkfollowers"
669        wait 500
670        @setvar botAtHome 0
671    endif
672    
673    #Pet Healing    
674    if skill "Veterinary" > 50 and followers >= 1 and diffhits <= 10
675         if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
676            dclicktype 3617
677            wft 2500
678            target pet1         
679            wait 500
680            if insysmsg 'You begin applying the bandages'
681                settimer 'aid time' 4500
682                settimer 'crewHealing' 0
683            endif
684         endif
685         if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
686            dclicktype 3617
687            wft 2500
688            target pet2       
689            wait 500 
690            if insysmsg 'You begin applying the bandages'
691                settimer 'aid time' 4500
692                settimer 'crewHealing' 0
693            endif
694         endif
695         if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
696            dclicktype 3617
697            wft 2500
698            target pet3      
699            wait 250  
700            if insysmsg 'You begin applying the bandages'
701                settimer 'aid time' 4500
702                settimer 'crewHealing' 0
703            endif
704         endif       
705        #We checked all - pause for spam
706        if timer 'crewHealing' > 5050 and skill 'Healing' <= 50
707            settimer 'crewHealing' 1000
708        endif
709    endif
710    #Crew Healing
711    if skill 'Healing' > 50 and diffhits <= 10
712        if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
713            gumpresponse 20 1722920179
714            wait 250 
715            if insysmsg 'You begin applying the bandages'
716                settimer 'aid time' 4500
717                settimer 'crewHealing' 0
718            endif
719        endif
720        if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
721            gumpresponse 21 1722920179
722            wait 250 
723            if insysmsg 'You begin applying the bandages'   
724                settimer 'aid time' 4500
725                settimer 'crewHealing' 0
726            endif
727        endif
728        if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
729            gumpresponse 22 1722920179
730            wait 250 
731            if insysmsg 'You begin applying the bandages'
732                settimer 'aid time' 4500
733                settimer 'crewHealing' 0
734            endif
735        endif
736        if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
737            gumpresponse 23 1722920179
738            wait 250 
739            if insysmsg 'You begin applying the bandages'
740                settimer 'aid time' 4500
741                settimer 'crewHealing' 0
742            endif
743        endif
744        if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
745            gumpresponse 24 1722920179
746            wait 250 
747            if insysmsg 'You begin applying the bandages'
748                settimer 'aid time' 4500
749                settimer 'crewHealing' 0
750            endif
751        endif
752        if timer 'aid time' > 10250 and timer 'crewHealing' > 5050
753            gumpresponse 25 1722920179
754            wait 250 
755            if insysmsg 'You begin applying the bandages'
756                settimer 'aid time' 4500
757                settimer 'crewHealing' 0
758            endif
759        endif  
760        #We checked all - pause for spam
761        if timer 'crewHealing' > 5050
762            settimer 'crewHealing' 1000
763        endif
764    endif
765    
766    ###############                                           ###############
767    ###############   Start buff routines                     ###############
768    ###############                                           ###############
769    #Throw self overboard if a ship repair kit is on the deck
770    if 'triggerOverboard' = 1
771        if findtype 25758 ground any any 8
772            say "So long fair world"
773            wait 500
774            say "[throwselfoverboard"
775            stop
776        endif
777    endif
778    
779    
780    #Tracking Routine - Turn it on if we have not yet
781    if skill 'Tracking' >= 20 and 'trackState' = 0
782        while not insysmsg "You will receive"
783            hotkey 'Tracking'
784            gumpresponse 6 4267467659
785            wait 500
786        endwhile    
787        gumpclose 4267467659
788        @setvar 'trackState' 1
789    endif
790    
791    #food buff routine
792    if timer 'foodCheck' > 60000 and not findbuff 'food satisfaction'
793		@setvar foundFood 0
794		foreach foodStuff in foodTypes
795			if findtype foodStuff as found
796				wait 600
797				dclick found
798				@setvar foundFood 1
799			endif
800		endfor
801		if foundFood = 0
802			wait 600
803			say "I appear to be out of food!"
804			wait 600
805			say "I appear to be out of food!"
806			wait 600
807			say "I appear to be out of food!"
808		endif
809        settimer 'foodCheck' 0
810    endif
811    
812    #Follower Routine
813    if skill "Necromancy" > 80 or skill "Spirit Speak" > 80
814        if followers < 4 and mana > 50
815            #Lost a big pet, resummon
816            settimer "bardLock" 0
817            if skill "Necromancy" > 80
818                say "[VengefulSpirit"
819                wait 1000
820            endif
821            #check for pure summons they do not require as much logic
822            if 'fireElem' = 2
823                cast 'Fire Elemental'
824            elseif 'airElem' = 2
825                cast 'Air Elemental'
826            elseif 'daemonSum' = 2
827                cast 'Summon Daemon'
828            elseif 'earthElem' = 2
829                cast 'Earth Elemental'
830            elseif 'waterElem' = 2
831                cast 'Water Elemental'
832            endif
833            
834            #Check for single summons               
835            if 'fireElem' = 1 
836                if skill "Necromancy" > 80
837                    if not findtype 24 ground any any 12 
838                        overhead "Casting one lich"
839                        say "a fire elemental release"
840                        cast 'Fire Elemental'
841                    endif
842                else
843                    if not findtype 15 ground any any 12 
844                        overhead "Casting plain fire elem"
845                        cast 'Fire Elemental' 
846                    endif
847                endif
848            endif           
849            if 'airElem' = 1 
850                if skill "Necromancy" > 80
851                    if not findtype 306 ground any any 12 
852                        say "an air elemental release"
853                        cast 'Air Elemental'
854                    endif
855                else
856                    if not findtype 13 ground any any 12 
857                        cast 'Air Elemental'
858                    endif
859                endif
860            endif       
861            if 'earthElem' = 1 
862                if skill "Necromancy" > 80
863                    if not findtype 158 ground any any 12 
864                        say "an earth elemental release"
865                        cast 'Earth Elemental'
866                    endif
867                else
868                    if not findtype 14  ground any any 12 
869                        cast 'Earth Elemental'
870                    endif
871                endif
872            endif       
873            if 'waterElem' = 1 
874                if skill "Necromancy" > 80
875                    if not findtype 740 ground any any 12 
876                        say "a water elemental release"
877                        cast 'Water Elemental'
878                    endif
879                else
880                    if not findtype 16  ground any any 12 
881                        cast 'Water Elemental'
882                    endif
883                endif
884            endif           
885            if 'waterElem' = 1 
886                if skill "Necromancy" > 80
887                    if not findtype 722 ground any any 12 
888                        say "a daemon release"
889                        cast 'Summon Daemon'
890                    endif
891                else
892                    if not findtype 9  ground any any 12 
893                        cast 'Summon Daemon'
894                    endif
895                endif
896            endif           
897            wait 6000
898            say "All Guard Me"
899            
900            #rebuff to get pet buffed
901            if mana > 15 and followers >= 4
902                cast 'Bless'
903                waitfortarget 2500
904                target 'self'
905                wait 750
906            endif
907        endif
908    endif
909    #Summon Creature Routine
910    if skill "Necromancy" > 80 or skill "Spirit Speak" > 80
911        if followers = 4 and mana > 30
912            settimer "bardLock" 0
913            if skill "Necromancy" > 80
914                say "[VengefulSpirit"
915                wait 1000
916            endif
917            cast 'Summ. Creature'
918            wait 5000
919            say "All Guard Me"
920        endif   
921    endif
922    #camping buff
923    if skill "Camping" > 50 and not findbuff "Campfire Visit"
924        if not findtype 3553 backpack
925            say "Need more kindling" 
926            wait 355
927            say "Need more kindling" 
928            wait 355
929            say "Need more kindling" 
930            wait 355
931        endif
932    
933        if not findtype 3555 true
934            dclicktype 3553 backpack
935            wait 350
936            while insysmsg "You fail to ignite"
937                wait 3000    
938                dclicktype "kindling" backpack
939                wait 350
940            endwhile
941        endif
942        wait 600
943    endif   
944    #Bot sits and waits on a gate if it has recalled recently
945    if botAtHome = 1
946        continue
947    endif
948    #spirit speak only if on own boat and corpses present.  Do not SS if we have necromancy as we have liches and this is wasted time
949    if skill "Spirit Speak" > 50 and timer "bardLock" > 10000 and timer "spiritSpeakCheck" > 30000 and 'boardState' = 0 and  skill "Necromancy" < 50
950        if findtype 8198 ground any any 12 as found
951            overhead "spirit speak"
952            hotkey 'Spirit Speak'
953            settimer "spiritSpeakCheck" 0
954            settimer "bardLock" 8000
955        endif
956    endif
957    if skill "Discordance" > 50 and timer "bardLock" > 10000 and timer "buffDisco" > 300000
958        overhead "Disco Buff"
959        skill "Discordance" 
960        wft 2500
961        targettype 3701
962        settimer "buffDisco" 0
963        settimer "bardLock" 0
964    endif
965    if skill "Begging" > 50  and timer "bardLock" > 10000 and timer "buffBeg" > 60000
966        overhead "Begging Buff"
967        skill "Begging" 
968        settimer "buffBeg" 0
969        settimer "bardLock" 5000
970    endif
971    if skill "Provocation" > 50 and timer "bardLock" > 11000 and timer "buffProvo" > 300000
972        overhead "Provo Buff"
973        skill "Provocation" 
974        wft 2500
975        targettype 3701
976        settimer "buffProvo" 0
977        settimer "bardLock" 0
978    endif
979    if skill "Peacemaking" >= 20 and timer "bardLock" > 10000 and timer "buffPeace" > 300000
980        overhead "Peace Buff"
981        skill "Peacemaking" 
982        wft 2500
983        targettype 3701
984        settimer "buffPeace" 0
985        settimer "bardLock" 0
986    endif
987    #Arch Protection
988    if boardState = 0 and mana > 50 and skill "Magery" > 50 and timer "bardLock" > 10000 and not findbuff "Protection"
989        cast 'Arch Protection'
990        waitfortarget 2500
991        target 'self'
992    endif
993    #Bless
994    if boardState = 0 and mana > 50 and skill "Magery" > 50 and timer "bardLock" > 10000 and not findbuff "Strength" 
995        overhead "Mage Buff"
996        cast 'Bless'
997        waitfortarget 2500
998        target 'self'
999        wait 750
1000        cast 'Bless'
1001        waitfortarget 2500
1002        target 'self'
1003        wait 750
1004        cast 'Bless'
1005        waitfortarget 2500
1006        target 'self'
1007        wait 750
1008    endif
1009    #I do not know why you would want to do this
1010    if findtype 3976 ground
1011        if triggerOverboard != 2
1012            @setvar defuseBombs 0
1013            say "[reload"
1014            wait 15000          
1015        endif
1016    endif    
1017    if mana > 50 and skill "Magery" > 50 and timer "bardLock" > 10000 and not findbuff "Reactive Armor" and buffRA = 1
1018        cast 'Reactive Armor'
1019        wait 750
1020    endif
1021    if mana > 50 and skill "Magery" > 50 and timer "bardLock" > 10000 and not findbuff "Magic Reflection" and buffMR = 1
1022        cast 'Magic Reflection'
1023        wait 750
1024    endif
1025
1026    if skill "Taste Identification" > 50 and timer "bardLock" > 10000 and timer "buffTaste" > 60000
1027        overhead "tasteidentification Buff"
1028        skill "tasteid"
1029        wft 2500
1030        targettype 3701 backpack
1031        settimer "buffTaste" 0
1032        settimer "bardLock" 5000
1033    endif
1034    
1035    
1036    ###############                                     ###############
1037    ###############Start dynamic walking routine on NPC ###############
1038    ###############                                     ###############   
1039    
1040    
1041    
1042    #Dynamic walk to hold
1043    if stealTheBooty = 1 and boardState = 1 and bossFight = 0 and stopWalking = 0
1044        #we are looting and we are on an NPC and we are not on a boss
1045        overhead "Move to hold" 23
1046        #ignore our own boat
1047        clearignore
1048        #ignore my own ships hold
1049        foreach holdID in holdIDs
1050            foreach shipHue in shipHues
1051                if findtype holdID ground shipHue as found                  
1052                    ignore found
1053                endif
1054            endfor
1055        endfor
1056        
1057        #Clear walklist
1058        clearlist walking        
1059        if findtype 16046 ground as foundHold
1060            @setvar npcHold foundHold
1061            pushlist walking  "Right, running"
1062            pushlist walking  "Up, running"
1063        elseif findtype 15973 ground as foundHold
1064            @setvar npcHold foundHold
1065            pushlist walking  "Down, running"
1066            pushlist walking  "Right, running"
1067        elseif findtype 16057 ground as foundHold
1068            #south
1069            @setvar npcHold foundHold
1070            pushlist walking  "Down, running"
1071            pushlist walking  "Left, running"
1072        elseif findtype 16019 ground as foundHold
1073            @setvar npcHold foundHold
1074            pushlist walking  "Up, running"
1075            pushlist walking  "Left, running"
1076        endif
1077		
1078
1079		#druid
1080		if hue npcHold =  2845
1081			wait 600
1082			say "druid BOAT!"
1083		endif
1084		#Vile
1085		if hue npcHold =  2841
1086			wait 600
1087			say "vile BOAT!"
1088		endif
1089		#ossuary 
1090		if hue npcHold =  2840
1091			wait 600
1092			say "ossuary BOAT!"
1093		endif
1094		#pirate
1095		if hue npcHold =  2269
1096			wait 600
1097			say "pirate BOAT!"
1098		endif
1099		#merchant
1100		if hue npcHold =  2766
1101			wait 600
1102			say "merchant BOAT!"
1103		endif
1104		#ghost
1105		if hue npcHold =  2955
1106			wait 600
1107			say "ghost BOAT!"
1108		endif
1109		#orc reaver
1110		if hue npcHold =  2141
1111			wait 600
1112			say "reaver BOAT!"
1113		endif
1114		#raider
1115		if hue npcHold =  2927
1116			wait 600
1117			say "raider BOAT!"
1118		endif
1119		#tradesman
1120		if hue npcHold =  2347
1121			wait 600
1122			say "tradesman BOAT!"
1123		endif
1124		#Lizardman
1125		if hue npcHold =  2363
1126			wait 600
1127			say "Lizardman BOAT!"
1128		endif
1129		#explorer
1130		if hue npcHold =  2845
1131			wait 600
1132			say "explorer BOAT!"
1133		endif
1134		#fisherman
1135		if hue npcHold =  2076
1136			wait 600
1137			say "fisherman BOAT!"
1138		endif
1139		#daemon
1140		if hue npcHold =  2740
1141			wait 600
1142			say "daemon BOAT!"
1143		endif
1144		#submerged
1145		if hue npcHold =  2826
1146			wait 600
1147			say "submerged BOAT!"
1148		endif
1149                
1150        #start actual walking
1151        while stopWalking = 0
1152            foreach walkDir in walking
1153                #reset walk timer
1154                settimer "walkingTooMuch" 0
1155                while timer "walkingTooMuch" < 2500 and stopWalking = 0 
1156                    #Roam the boat
1157                    walk walkDir
1158                    #are we by a hold?
1159                    foreach holdID in holdIDs
1160                        if findtype holdID ground any any 2 as found
1161                            @setvar stopWalking 1
1162                            @setvar holdToLoot found
1163                        endif
1164                        if findtype 5188 ground 
1165                            dclicktype '5188'  
1166                            say "[embark"
1167                            wait 600
1168                            say "[embarkfollowers"
1169                            wait 600
1170                            @setvar stopWalking 1
1171                            @setvar boardState 0
1172                        endif
1173                    endfor
1174                endwhile
1175                settimer "walkingTooMuch" 0
1176            endfor
1177        endwhile
1178        
1179        if stopWalking = 1 and sayLess = 0
1180            wait 500
1181            say "Yarr we got the hold.  Lets loot this sucker dry.  Just kill tha crew now!" 33
1182        endif   
1183    #End of dynamic loot routine
1184    endif   
1185    
1186    
1187    ###############                                                   ###############
1188    ###############    Start routines that do not require target      ###############
1189    ###############                                                   ###############   
1190
1191
1192    
1193    #Check if we are on NPC ship AGAIN
1194    if insysmsg "You board the ship"
1195        @setvar 'boardState' 1 
1196        settimer "onBoard" 0
1197        @setvar stopWalking 0
1198        if sayLess = 0 
1199            wait 500
1200            say "***Lets Gooooo! (Lets Gooooo!) / If you want it you can get it let me know (let me know)**" 44
1201        endif
1202    endif
1203
1204    #Sanity Embark Check every 20s
1205    if boardState = 0 and closeEnemy = 0
1206        if timer "sanityEmbarkCheck" > 20000 and varexist 'tillerDude' 
1207            hotkey 'Cancel Current Target'
1208            dclick tillerDude
1209            wait 200
1210            if insysmsg "were not found"	                
1211				#try to find tillerman    
1212				foreach tillerMenVar in tillerMenList
1213					if findtype tillerMenVar ground as found
1214						overhead "Tillerman Set"
1215						setvar 'tillerDude' 'found'
1216						dclick 'tillerDude'
1217						wait 500
1218					endif
1219				endfor
1220				wait 400
1221                say "[embark"                   
1222            endif
1223            gumpresponse 21 4216593270
1224            wait 200
1225            if insysmsg "do you wish to disembark"
1226                #cancel current target, we are on a boat                
1227                hotkey 'Cancel Current Target'
1228            else 
1229                gumpresponse 22 4216593270
1230                wait 100
1231                #we do this to make sure embark worked
1232                say "[embark"
1233                wait 500
1234                say "[embarkfollowers"
1235            endif
1236            
1237            settimer 'sanityEmbarkCheck' 0
1238        endif
1239    endif
1240    
1241    if timer "sanityEmbarkCheck" > 70000 and not varexist 'tillerDude'
1242        wait 500
1243        say "Why the hell have we not found a tillerman yet???"
1244    endif
1245                
1246    #Yell if we are not in fighting party
1247    if insysmsg "You must be a part of your initial embarking"
1248        say "Hey! I am not in the fighting party!!!" 23
1249        wait 500
1250        say "Hey! I am not in the fighting party!!!" 23
1251        wait 500
1252        say "Hey! I am not in the fighting party!!!" 23
1253        wait 500
1254    endif    
1255
1256    #check for bombs nearby and defuses them
1257    if defuseBombs = 1
1258        if findtype '5188' ground -1 -1 2
1259            dclicktype '5188'
1260            say "[embark"
1261            wait 600
1262            say "[embarkfollowers"
1263            wait 600
1264        endif
1265        if findtype '5188' ground 
1266            dclicktype '5188'  
1267            say "[embark"
1268            wait 600
1269            say "[embarkfollowers"
1270            wait 600
1271        endif
1272    endif
1273    
1274    #Check if we broke an instrument
1275    if skill "Musicianship" > 50
1276        if insysmsg "What instrument shall you play"
1277            @setvar newInstrument 0 
1278            foreach instrumentType in 'instrumentTypes'
1279                if findtype instrumentType as foundInstrument
1280                    dclick foundInstrument              
1281                    @setvar newInstrument 1
1282                endif
1283            endfor
1284            if newInstrument = 0
1285                say "I am out of instruments!!!"
1286                wait 500
1287                say "I am out of instruments!!!"
1288                wait 500
1289                say "I am out of instruments!!!"
1290                wait 500
1291            endif
1292        endif
1293    endif
1294    #meditation routine 
1295    if skill "Meditation" > 80 and mana < 30 and timer bardLock >= 10000
1296        skill 'meditation'
1297        settimer "bardLock" 0
1298    endif
1299    
1300    #Recall if you are docked
1301    if goHomeBotYouAreDrunk = 1 and timer goHomeBotYouAreDrunkTimer > 15000 and botAtHome = 0 and boardState = 0     
1302        clearsysmsg
1303        #Test boat condition
1304        say "[shipmenu"
1305        wait 250
1306        if insysmsg "You must be closer"
1307            #Embark and try again
1308            say "[embark"
1309            wait 500
1310            say "[shipmenu"
1311            wait 200            
1312            if insysmsg "You must be closer"
1313                clearignore 
1314                unsetvar 'gfto'
1315                while not dead and findtype 8901 'backpack' as 'runeBook'
1316                    getlabel 'runeBook' 'runeBookLabel'
1317                    if 'Home' in 'runeBookLabel'
1318                        setvar 'gtfo' 'runeBook'
1319                        overhead 'Set recall to rune book'
1320                        break
1321                    endif
1322                    @ignore 'runeBook'
1323                endwhile
1324                while not dead and findtype 7956 'backpack' as 'runeBook'
1325                    getlabel 'runeBook' 'runeBookLabel'
1326                    if 'Home' in 'runeBookLabel'
1327                        setvar 'gtfo' 'runeBook'
1328                        overhead 'Set recall to rune book'
1329                        break
1330                    endif
1331                    @ignore 'runeBook'
1332                endwhile              
1333                if not varexist 'gtfo'
1334                    say 'You need a book or rune named Home on bot' 33
1335                    wait 500
1336                    say 'You need a book or rune named Home on bot' 33
1337                    wait 500
1338                    say 'You need a book or rune named Home on bot' 33
1339                    wait 500
1340                elseif skill magery > 60
1341                    overhead 'Spell Cast'
1342                    cast 'recall'
1343                    wft 5000
1344                    target 'gtfo'
1345                elseif findtype 8012 'backpack' as recallScrolls
1346                    if skill magery > 20
1347                        overhead 'Recall Scroll'
1348                        #We have magery but prefer scrolls
1349                        dclick 'recallScrolls'
1350                        wft 5000
1351                        target 'gtfo'
1352                    else 
1353                        overhead 'Book use'
1354                        #We have loose recalls but recall with book
1355                        dclick 'gtfo'
1356                        wait 250
1357                        gumpresponse 2    
1358                    endif
1359                else
1360                    #Book use
1361                    overhead 'Book use'
1362                    dclick 'gtfo'
1363                    wait 250
1364                    gumpresponse 2        
1365                endif
1366                
1367                #WALK THIS WAY
1368                #Change the 3 numbers at the end of this to where you want to stop and ressupply.  Change the walk direction to the direction you need to go
1369                while not dead and not position 4006 904 5
1370                    walk 'North'
1371                    wait 150
1372                endwhile
1373                if findtype 'storage shelf' ground any any 2 as found
1374                    menu found 0 
1375                    wft 2500
1376                    target self
1377                    menu found 1
1378                endif
1379                #Change the 3 numbers at the end of this to where you want to stop and wait on a gate.  Change the walk direction to the direction you need to go
1380                while not dead and not position 4006 909 0
1381                    walk 'South'
1382                    wait 150
1383                endwhile
1384                @setvar botAtHome 1
1385            endif   
1386        endif
1387        @settimer "goHomeBotYouAreDrunkTimer" 0 
1388        #Skip rest of this loop
1389        continue
1390    endif
1391    
1392    #Necro Abilities
1393    if skill "Necromancy" > 80 
1394        #painspike
1395        if 'boardState' = 1 and timer "painSpkeTimer" > 35000
1396            if findtype 8198 ground any any 10 as found
1397                say '[painspike'
1398                wft 500
1399                target found
1400                wait 350
1401                settimer "painSpkeTimer" 0
1402            endif  
1403        #Vamp 
1404        elseif 'boardState' = 0  and timer "vampTimer" > 35000
1405            if findtype 8198 ground any any 10 as found
1406                say '[vampiricembrace' 
1407                wft 500
1408                target found
1409                settimer "vampTimer" 0
1410                wait 350
1411            endif    
1412        endif
1413    endif   
1414    
1415    #Repair Routine - 
1416    if 'closeEnemy' = 0 or bossFight = 1
1417        if bossFight = 1
1418            @setvar repairGunsOrder 3
1419            @setvar repairSailsOrder 2
1420            @setvar repairHullOrder 1
1421        endif
1422        if timer "RepairHull" > 34000
1423            @setvar startRepairs 0
1424            if repairLockdown = 0 or bossFight = 1
1425                @setvar startRepairs 1          
1426            elseif timer "onBoard" > 62000 and timer "onBoard" <= 125000    
1427                @setvar startRepairs 1
1428            endif
1429            
1430            if startRepairs = 1
1431                if repairHullOrder = 1                  
1432                    say '[RepairHull'
1433                elseif repairGunsOrder = 1                  
1434                    say '[RepairGuns'
1435                else 
1436                    say '[RepairSails'  
1437                endif
1438                wait 200                
1439                if insysmsg "guns do not need" or insysmsg 'hull does not need' or insysmsg 'sails do not need'
1440                    if repairHullOrder = 2
1441                        say '[RepairHull'
1442                    elseif repairSailsOrder = 2
1443                        say '[RepairSails'  
1444                    else 
1445                        say '[RepairGuns'
1446                    endif
1447                endif
1448                wait 200
1449                if insysmsg "guns do not need" or insysmsg 'hull does not need' or insysmsg 'sails do not need'
1450                    if repairGunsOrder = 3
1451                        say '[RepairGuns'
1452                    elseif repairSailsOrder = 3
1453                        say '[RepairSails'  
1454                    else 
1455                        say '[RepairHull'
1456                    endif
1457                endif
1458                if bossFight = 1 and slowRepairsBosses = 1 
1459                    settimer "RepairHull" 0
1460                else 
1461                    settimer "RepairHull" 30000
1462                endif
1463            endif
1464        endif
1465    endif    
1466    
1467    #Check if we started ar epair and sit around.  Also if it's PvP related pouch   
1468    if insysmsg 'you cannot move!'
1469        overhead 'Paralyzed!' 34
1470        say [pouch
1471    endif
1472    
1473    while findbuff 'Paralyze'       
1474        if insysmsg 'you cannot move!'
1475            overhead 'Paralyzed!' 34
1476            say [pouch
1477        endif
1478        wait 100
1479    endwhile
1480    
1481    #Put on your clothes
1482    if timer "dressTimer" > 10000
1483        #Try to dress 
1484        dress "bow"   
1485        settimer "dressTimer" 0
1486        
1487        if followers > 1
1488            say "All guard me"
1489        endif   
1490        
1491        if skill "Magery" > 50
1492            foreach reg in 'regTypes'
1493                if counttype reg < 3
1494                    wait 500
1495                    say "Hey! I am Low on regs!" 23
1496                    wait 500
1497                    say "Hey! I am Low on regs!" 23
1498                    wait 500
1499                    say "Hey! I am Low on regs!" 23
1500                endif
1501            endfor
1502        endif
1503    endif
1504    endif
1505    
1506    
1507    
1508    #Check if we are on NPC ship A THIRD TIME
1509    if insysmsg "You board the ship"
1510        @setvar 'boardState' 1 
1511        settimer "onBoard" 0
1512        @setvar stopWalking 0
1513        if sayLess = 0 
1514            wait 500
1515            say "***Lets Gooooo! (Lets Gooooo!) / If you want it you can get it let me know (let me know)**" 44
1516        endif
1517    endif
1518    ###############                                         ###############
1519    ###############    Start target search / embark routine ###############
1520    ###############                                         ###############   
1521    if timer "newTargetCheck" > 2500
1522        #reset timer
1523        settimer "newTargetCheck" 0
1524        @setvar searchNew 1
1525        if varexist 'lastserial'
1526            if targetLock = 1 
1527                if noto 'lastserial' = invulnerable 
1528                    #sysmsg "Testing target is alive" 
1529                endif
1530                if insysmsg "not found"
1531                    #This status means target is dead
1532                    #overhead "Target is dead or out of range. Finding a new one"
1533                else
1534                    #Our target appears to be alive still.  Do not hunt for a new target
1535                    @setvar searchNew 0             
1536                endif     
1537            endif
1538        endif
1539        
1540        
1541        if searchNew = 1           
1542            #Set this to 1 before we search
1543            @setvar closeEnemy 1
1544            #Start cycline
1545            hotkey 'Next Grey Humanoid Target'
1546            wait 255
1547            if insysmsg 'No one matching that'      
1548                hotkey 'Next Grey Monster Target' 
1549                wait 255
1550                if insysmsg 'No one matching that'  
1551                    #Start boss hunt        
1552                    hotkey "Target random murderer" 
1553                    wait 255
1554                    if insysmsg 'No one matching that'  
1555                        #We have no target so set close enemy 0                 
1556                        @setvar 'closeEnemy' 0
1557                    else
1558                        #Found a boss so we want to pretend we are boarded
1559                        if sayLess = 0 
1560                            wait 500
1561                            say "***BOSS THEME INTENSIFIES**" 44
1562                        endif
1563                        @setvar 'boardState' 1
1564                        @setvar 'targetLock' 0
1565                        @setvar 'discoLock' 0
1566                        @setvar 'bossFight' 1
1567                        @setvar 'provokeBoss' 1
1568                    endif
1569                else
1570                    #Found a monster target type
1571                    #@setvar 'targetLock' 0
1572                    @setvar 'discoLock' 0
1573                endif
1574            else
1575                #Found a humanoid target type
1576                #@setvar 'targetLock' 0
1577                @setvar 'discoLock' 1
1578            endif
1579            
1580            #Set up var for last enemy.  If no enemy it is time to leave this boat
1581            if closeEnemy = 1       
1582                @setvar! 'lastserial' lasttarget
1583            #Embark Routine 
1584            elseif 'boardState' = 1         
1585                overhead "Done with this fight"
1586                
1587                #Skinning Routine
1588                if skill 'Forensic Evaluation' > 20
1589                    clearsysmsg             
1590                    #Wait on skill usage CD
1591                    while timer "bardLock" < 10000
1592                        wait 100
1593                    endwhile
1594                    for 3
1595                        hotkey 'Forensics'
1596                        wait 500
1597                        target 'self'
1598                        wait 1500
1599                        if not insysmsg "You carve" and not insysmsg  "anything nearby" and not insysmsg "must wait"
1600                            while not insysmsg "successful"
1601                                say "I am broken in a Captcha loop.  Fix me"
1602                                wait 2500
1603                            endwhile                                
1604                        endif
1605                    endfor 
1606                endif
1607                
1608                #Dynamic Looting Routine
1609                if stealTheBooty = 1 and stopWalking = 1
1610                    if sayLess = 0
1611                        say "Crews Dead!  I got the gold!" 33
1612                    endif
1613                    #Open NPC Hold
1614                    dclick holdToLoot
1615                    wait 250
1616                    #Call restock agent
1617                    restock 2
1618                    wait 250
1619                    target holdToLoot
1620                    
1621                    #Wait on looting
1622                    while queued
1623                        wait 1000
1624                    endwhile
1625                    
1626                    #Call restock agent again
1627                    restock 2
1628                    wait 250
1629                    target holdToLoot
1630                    
1631                    #Wait on looting
1632                    while queued
1633                        wait 1000
1634                    endwhile
1635                endif
1636                #Start Embarking
1637                hotkey 'Cancel Current Target'
1638                dclick tillerDude
1639                wait 350
1640                if insysmsg "were not found"
1641                    say "[embark"                   
1642                    if findtype "tiller man" ground as found
1643                        overhead "Tillerman Set"
1644                        setvar 'tillerDude' 'found'
1645                        dclick 'tillerDude'
1646                        wait 500
1647                    endif
1648                endif
1649                gumpresponse 21 4216593270
1650                wait 350
1651                gumpresponse 22 4216593270
1652                wait 350
1653                dclick tillerDude
1654                wait 350
1655                gumpresponse 21 4216593270
1656                wait 350
1657                gumpresponse 22 4216593270
1658                #we do this to make sure embark worked
1659                say "[embark"
1660                wait 500
1661                say "[embarkfollowers"
1662                wait 500
1663                hotkey 'Cancel Current Target'
1664                
1665                if reloadCannons = 1
1666                    wait 100
1667                    say "[reload"
1668                    wait 500
1669                endif   
1670                
1671                settimer "walkingTooMuch" 0 
1672                #dump loot Dynamic Looting
1673                if stealTheBooty = 1 and stopWalking = 1 and timer "walkingTooMuch" < 25000
1674                    #Find my ship hold and reset ignore since we ignored our own earlier
1675                    clearignore
1676                    clearlist walking
1677                    
1678                    #set orientation
1679                    foreach shipHue in shipHues
1680                        if findtype 16046  ground shipHue as found  
1681                            #overhead "North Facing Boat"
1682                            @setvar myShipHold found
1683                            pushlist walking  "Right, running"
1684                            pushlist walking  "Up, running"
1685                            pushlist walking  "Right, running"
1686                            pushlist walking  "Up, running"
1687                        elseif findtype 15973  ground shipHue as found 
1688                            #overhead "East Facing Boat"
1689                            @setvar myShipHold found
1690                            pushlist walking  "Down, running"
1691                            pushlist walking  "Right, running"
1692                            pushlist walking  "Down, running"
1693                            pushlist walking  "Right, running"
1694                        elseif findtype 16057  ground shipHue as found 
1695                            #overhead "South Facing Boat"
1696                            @setvar myShipHold found
1697                            pushlist walking  "Down, running"
1698                            pushlist walking  "Left, running"
1699                            pushlist walking  "Down, running"
1700                            pushlist walking  "Left, running"
1701                        elseif findtype 16019  ground shipHue as found 
1702                            #overhead "West Facing Boat"
1703                            @setvar myShipHold found
1704                            pushlist walking  "Up, running"
1705                            pushlist walking  "Left, running"
1706                            pushlist walking  "Up, running"
1707                            pushlist walking  "Left, running"
1708                        endif
1709                    endfor
1710            
1711                    #start actual walking
1712                    overhead "Walking to own hold"
1713                    settimer "walkingTooMuch" 0
1714                    @setvar dumpDynamicLoot 0
1715                    while dumpDynamicLoot = 0
1716                        foreach walkDir in walking
1717                            while timer "walkingTooMuch" < 1250 and dumpDynamicLoot = 0
1718                                #Roam the boat
1719                                walk walkDir
1720                                #are we by a hold?
1721                                foreach holdID in holdIDs
1722                                    if findtype 'holdID' ground any any 2 as found
1723                                        @setvar dumpDynamicLoot 1
1724                                    endif
1725                                endfor
1726                            endwhile
1727                            settimer "walkingTooMuch" 0
1728                        endfor
1729                    endwhile
1730
1731                    #found hold, time to dump
1732                    #myShipHold
1733                    overhead "At ship hold dumping gold"
1734                    dclick myShipHold
1735                    wait 600
1736                    overhead "Before Dump"
1737                    #Search for a pouch in hold
1738                    if findtype 3705 myShipHold any any any as foundPack
1739                        foreach x in lootTypes
1740                            while findtype x backpack any any 1 as found
1741                                lift found 9999
1742                                drop foundPack -1 -1 0 
1743                                @ignore myVariable
1744                                wait 600
1745                            endwhile
1746                        endfor
1747                        foreach x in ItemTypes
1748                            while findtype x backpack as found
1749                                @hotkey 'set last target'
1750                                @target found
1751                                @setvar myVariable lasttarget
1752                                wait 100
1753                                @getlabel 'myVariable' myLabel
1754                                if 'unidentified' in myLabel
1755                                    sysmsg 'Dumping: ' 33
1756                                    sysmsg  myLabel 65
1757                                    lift myVariable 1
1758                                    drop foundPack -1 -1 0 
1759                                else 
1760                                    sysmsg 'Skipping' 33
1761                                sysmsg  myLabel 65
1762                                endif
1763                                ignore myVariable
1764                                wait 600
1765                            endwhile
1766                        endfor
1767                    endif   
1768                    overhead "Dump Done"
1769                    if sayLess = 0
1770                        say "We have successfully hidden the treasure!" 33
1771                    endif
1772                    clearignore
1773                    
1774                #end dump dynamic loot routine  
1775                endif
1776                
1777                #Reset Variables                
1778                @setvar 'boardState' 0
1779                @setvar targetLock targetLockType
1780                @setvar discoLock targetLockType
1781                @setvar stopWalking 0
1782                @setvar firstSighting 0
1783            endif
1784        #end enemy search routine
1785        endif       
1786        
1787    endif    
1788    ###############                                     ###############
1789    ###############Start routines that  require a target###############
1790    ###############                                     ###############   
1791    
1792    if closeEnemy = 1    
1793        
1794        #attack routine  - Always attack so pets go aggro at least if we are not a melee class   
1795        attack 'lastserial'
1796        
1797        #Turn on war mode because why not
1798        if not warmode
1799            warmode on
1800        endif               
1801                
1802        #Remove this if you read this far.  It kills your own crew if you target my captain
1803        if 'lastserial' = 0x15C5E or 'lastserial' = 0x348287 or 'lastserial' = 0x2E2E1 or 'lastserial' = 0x136133
1804            while not dead
1805                hotkey 'Next Friendly Humanoid Target'
1806                wait 350             
1807                @setvar! 'lastserial' lasttarget
1808                attack 'lastserial'         
1809                if  skill "Discordance" > 50 
1810                    skill "Discordance" 
1811                    wft 2500
1812                    target 'lastserial'
1813                endif
1814                if skill 'Magery' > 80
1815                    overhead "FS!" 33
1816                    cast "Flamestrike"
1817                    wft 3500
1818                    target 'lastserial'
1819                    wait 700
1820                endif                   
1821                if  skill "Poisoning" > 50  
1822                    overhead "Poison Target!" 33
1823                    cast "Poison"
1824                    wft 1500
1825                    target 'lastserial'
1826                    wait 400
1827                    #try to poison strike
1828                    say "[poisonStrike"
1829                    wft 1500
1830                    target 'lastserial'
1831                    wait 300
1832                endif
1833                say "Well, fuck me!  I love Brozan!"
1834            endwhile
1835        endif           
1836                                
1837        #herding
1838        if skill 'Herding' > 50 and timer "crookCheck" > 3000 and 'boardState' = 1
1839            #Wait on skill usage CD
1840            while timer "bardLock" < 10000
1841                wait 100
1842            endwhile
1843            #use a crook
1844            say "[FocusAggression"
1845            wft 500
1846            target 'lastserial'
1847            settimer "crookCheck" 0
1848            settimer "bardLock" 7000
1849        endif
1850        
1851        #Boss provoke or peace routine
1852        if discoLock = 0 or targetLockType = 2 
1853            if  skill "Peacemaking" > 50 and timer "provkeBossTimer" > 10500 and bossFight = 1 and provokeBoss = 1
1854                while timer "bardLock" < 10000
1855                    wait 100
1856                    if diffhits >= 18 
1857                        continue
1858                    endif
1859                endwhile
1860                overhead "Peacing Target!" 33
1861                skill "Peacemaking" 
1862                wft 2500
1863                target 'lastserial'
1864                settimer "discoTimer" 0
1865                settimer "bardLock" 5000
1866                settimer "provkeBossTimer" 0
1867            elseif  skill "Provocation" > 50 and timer "provkeBossTimer" > 10500 and bossFight = 1 and provokeBoss = 1              
1868                while timer "bardLock" < 10000
1869                    wait 100
1870                    if diffhits >= 18 
1871                        continue
1872                    endif
1873                endwhile
1874                overhead "Provocation Target!" 33
1875                skill "Provocation" 
1876                wft 2500
1877                target 'lastserial'
1878                wft 2500
1879                target self
1880                settimer "discoTimer" 0
1881                settimer "bardLock" 5000
1882                settimer "provkeBossTimer" 0
1883            endif
1884            setvar provokeBoss 0
1885        endif
1886        
1887        #disco routine
1888        if discoLock = 0 or targetLockType = 2
1889            if  skill "Discordance" > 50 and timer "discoTimer" > 5050              
1890                while timer "bardLock" < 10000
1891                    wait 100
1892                    if diffhits >= 18 
1893                        continue
1894                    endif
1895                endwhile
1896                overhead "Disco Target!" 33
1897                skill "Discordance" 
1898                wft 2500
1899                target 'lastserial'
1900                settimer "discoTimer" 0
1901                settimer "bardLock" 5000
1902            endif
1903        endif
1904        
1905        #poison routine 
1906        if  skill "Poisoning" > 50 and mana >= 35 and diffhits <= 18
1907            #overhead "Poison Target!" 33
1908            cast "Poison"
1909            wft 4500
1910            target 'lastserial'
1911            wait 400
1912            while upgradePoison = 1 and insysmsg "upgraded to greater"
1913                overhead "Got it"
1914                cast "Poison"
1915                wft 4500
1916                target 'lastserial'
1917                wait 400
1918            endwhile
1919            if 'boardState' = 1 and timer "poisonStrikeTimer" > 35000
1920                #try to poison strike
1921                say "[poisonStrike"
1922                wft 500
1923                target 'lastserial'
1924                settimer "poisonStrikeTimer" 0
1925            endif
1926            if skill "Discordance" <= 50 
1927                #Bump timer so we jump to a new target 
1928                settimer newTargetCheck 5000
1929            endif
1930        endif
1931        
1932        #Flamestrike
1933        if skill 'Magery' > 80 and skill 'Archery' < 80 and diffhits <= 18 and 'boardState' = 1 and mana >= 61
1934            wait 400
1935            cast "Flamestrike"
1936            wft 3500
1937            target 'lastserial'
1938            wait 400
1939            if sayLess = 0 
1940                say "So anyway I started blastin" 33
1941            endif
1942            wait 300
1943        endif   
1944        
1945        #Pet attack
1946        if followers > 1 and timer "petAttack" > 2500
1947            say "All kill"
1948            wft 1500
1949            target 'lastserial'
1950            settimer "petAttack" 0
1951        endif
1952        
1953        #Check for humanoid type ships and set new target faster
1954        if 'discoLock' = 1
1955            #Bump timer so we jump to a new target 
1956            settimer newTargetCheck 5000
1957        endif
1958        
1959        #Mass Curse
1960        if skill 'Magery' > 70 and skill 'Archery' < 80 and diffhits <= 18 and 'boardState' = 0 and mana >= 61 and massCurseToggle = 1 and firstSighting = 0
1961            wait 400
1962            cast 'Mass Curse'
1963            wft 3500
1964            target 'lastserial'
1965            wait 400
1966            if sayLess = 0 
1967                say "I curse ye to a watery grave!" 33
1968            endif
1969            wait 300
1970            @setvar firstSighting 1
1971        endif   
1972            
1973    #end target required routines
1974    endif
1975endwhile