Back to "ali" tags

SUPER-Auto healing by dennozz

Description: Auto healing script using different healing methods.

1#SUPER Auto-healer ver.4.09
2
3#********** INFORMATION **********# 
4
5#Made by @dennozz on discord. 
6#Inspired/learned by other scrips in https://outlands.uorazorscripts.com/
7
8# **If you like my work and wish to buy me a coffee: https://buymeacoffee.com/dennoz** #
9
10# Information : This is a script to auto heal you using Magery, Chivarly, Potions, Bandages and magery buffs
11
12# Updates
13#Ver 4.09 - Fixed bug for dropping the gold when max weight
14#Ver 4.08 - Added the use of cure potion when bleed or disease using ability Panacea from alchemy codex
15#Ver 4.00 - Restructured code and changed variables to make it more friendly to adjust the hit points differences for healing trigger
16
17
18#********** SET YOUR SETTINGS **********# 
19
20#--- Set Mage auto heals ---#
21
22@setvar! miniHeal 1
23@setvar! greaterHeal 1
24@setvar! cureSpell 1
25
26#--- Set Mage Buffs ---#
27
28@setvar! magicReflect 1
29@setvar! blessSpell 1
30@setvar! armorReflect 1
31@setvar! protectionSpell 1
32
33@setvar! miniumManaToBuff 50
34
35#--- Set Chivarly auto heals ---#
36
37@setvar! nobleSacrifice 1
38@setvar! holyLight 1
39
40@setvar! nobleSacrificeDiff 75
41@setvar! holyLightDiff 55
42
43#--- Set potions ---#
44
45@setvar! drinkStr 1
46@setvar! strengthLowerThan 101
47
48@setvar! drinkAgility 1
49@setvar! drinkMagicResist 1
50@setvar! drinkHeal 1
51@setvar! drinkCure 1
52
53@setvar! drinkRefresh 1
54@setvar! staminaLowerThan 85
55
56#--- Alchemy Codex ---#
57
58@setvar! panaceaAbility 1
59
60#--- Auto healing hp diffs ---#
61#--- All variables refer to hit points differences ---#
62#--- When below certain hit points it will trigger ---#
63
64@setvar! activateAutoHealDiff 1
65
66@setvar! startCastMiniHealDiff 10
67@setvar! endCastMiniHealDiff 30
68
69@setvar! castEmergencyMiniHealDiff 66
70
71@setvar! startCastGreaterHealDiff 30
72@setvar! endCastGreaterHealDiff 200
73
74@setvar! drinkHealPotDiff 40
75
76@setvar! interruptCastingBuffsDiff 40
77
78#--- Set mushrooms ---#
79
80@setvar! mushroomCount 3
81@setvar! eatMushWhenManaLowerThan 50
82l
83@setvar! mushroomTimerCD 60000
84
85#--- Drop Gold When Overweight ---#
86
87@setvar! amountOfGoldToDrop 500
88
89#--- Optional : Have a cooldown named `Heal Pot` ---#
90
91@setvar! healingPotCD 8000
92
93@setvar! lowManaWarningMessageWhenBelow 11
94
95#********** DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING  **********   
96
97@setvar! holyPoints 0
98
99@setvar! nobleCD 30000
100settimer nobleTimer nobleCD
101
102@setvar! nobleDelayCD 5000
103settimer nobleDelayTimer nobleDelayCD
104
105@setvar! nobleMessageCD 500
106settimer nobleMessageTimer nobleMessageCD
107
108@setvar! holyLightCD 30000
109settimer holyLightTimer holyLightCD
110
111@setvar! maxwaittimeinms 650
112
113#--- Script msgs timers ---#
114
115@setvar! autoHealMessageCD 4500
116settimer autoHealMessageTimer 0
117
118@setvar! guardMessageCD 5500
119settimer guardMessageTimer guardMessageCD
120
121@setvar! manaMessageCD 2222
122settimer manaMessageTimer manaMessageCD
123
124@setvar! overweightMessageCD 3000
125settimer overweightMessageTimer overweightMessageCD
126
127#--- Resources timers ---#
128
129@setvar! pouchMessageCD 5000
130settimer pouchMessageTimer pouchMessageCD
131
132@setvar! aidsMessageCD 4000
133settimer aidsMessageTimer aidsMessageCD
134
135@setvar! whiteMessageCD 3000
136settimer whiteMessageTimer whiteMessageCD
137
138@setvar! blueMessageCD 3000
139settimer blueMessageTimer blueMessageCD
140
141@setvar! blackMessageCD 2500
142settimer blackMessageTimer blackMessageCD
143
144@setvar! orangeMessageCD 2000
145settimer orangeMessageTimer orangeMessageCD
146
147@setvar! yellowMessageCD 1500
148settimer yellowMessageTimer yellowMessageCD
149
150@setvar! redMessageCD 1000
151settimer redMessageTimer redMessageCD
152
153@setvar! foodMessageCD 3333
154settimer foodMessageTimer foodMessageCD
155
156@setvar! panaceaAbilityCD 30000
157
158if not timerexists panaceaAbilityTimer
159    settimer panaceaAbilityTimer panaceaAbilityCD
160endif
161
162@setvar! panaceaDelayMessageCD 5000
163
164if not timerexists panaceaDelayMessageTimer
165    settimer panaceaDelayMessageTimer panaceaDelayMessageCD
166endif
167
168#--- Magery buffs timers ---#
169
170@setvar! magicReflectCD 15000
171settimer magicReflectTimer 15000
172
173@setvar! armorReflectCD 15000
174settimer armorReflectTimer 15000
175
176@setvar! protectionCD 15000
177settimer protectionTimer 15000
178
179overhead "Auto Healing Activated" 66
180
181if nobleSacrifice = 1 or holyLight = 1
182    if findtype 'paladin spellbook' backpack
183        yell '[chivalryhotbar'
184        while not gumpexists 1387930325
185            yell '[chivalryhotbar'
186            waitforgump 1387930325 maxwaittimeinms
187        endwhile
188    endif
189endif
190    
191while not dead
192
193    if timer autoHealMessageTimer > autoHealMessageCD
194        overhead "* auto-healing *" 90
195        settimer autoHealMessageTimer 0
196    endif
197
198#********** AUTO-HEALING IF NEEDED **********   
199
200    while diffhits >= activateAutoHealDiff or paralyzed or poisoned
201        if dead
202            stop
203        endif
204
205        if timer nobleDelayTimer < nobleDelayCD and timer nobleMessageTimer > nobleMessageCD
206            sysmsg "Healing Restricted {{nobleDelayTimer}} / 5000" 34 
207            overhead "Healing Restricted {{nobleDelayTimer}} / 5000" 34 
208            settimer nobleMessageTimer 0
209        endif
210        
211        @setvar! castingInterrupted 0
212        
213        if panaceaAbility = 1
214            if findbuff "bleed" or findbuff "diseased"
215                if timer panaceaAbilityTimer > panaceaAbilityCD
216                    if findtype "Orange Potion" self
217                        dclicktype "Orange Potion"
218                        wait 200
219                        while not insysmsg "you are not poisoned" and not insysmsg "potion codex panacea"
220                            dclicktype "Orange Potion"
221                            wait 200                        
222                        endwhile
223                        settimer panaceaAbilityTimer 0
224                        overhead "Panacea Activated!" 55
225                        sysmsg "Panacea Activated!" 55
226                    endif 
227                elseif timer panaceaAbilityTimer > 25000 and timer panaceaDelayMessageTimer > panaceaDelayMessageCD
228                    sysmsg "Panacea Ability ready in less than 5 seconds" 44
229                    settimer panaceaDelayMessageTimer 0
230                endif
231            endif
232        endif
233        
234        if not findbuff "food" 
235            if findtype "tray" backpack as fody    
236                dclick fody
237                wait 200
238            else 
239                if timer foodMessageTimer > foodMessageCD
240                    overhead "No food found!" 34
241                    settimer foodMessageTimer 0
242                endif
243            endif
244        endif
245        
246        if weight > maxweight
247            if timer overweightMessageTimer > overweightMessageCD
248                overhead "Overweight !!" 34
249                settimer overweightMessageTimer 0
250            endif
251            
252            if 0 != amountOfGoldToDrop
253                while weight > maxweight
254                    if findtype "gold coin" backpack as item
255                        lift item amountOfGoldToDrop
256                        droprelloc 0 0
257                        getlabel backpack xxx
258                        wait 200
259                        if insysmsg "cannot drop anything"
260                            drop backpack -1 -1 -1
261                        endif
262                        wait maxwaittimeinms
263                        overhead "* Gold Dropped *" 55
264                    endif
265                endwhile            
266            endif
267        endif
268        
269        if timer autoHealMessageTimer > autoHealMessageCD
270            overhead "* auto-healing *" 90
271            settimer autoHealMessageTimer 0
272        endif    
273        #--- Trapped ---#
274        
275        if paralyzed 
276            if findtype "pouch" backpack 38 
277                yell "[pouch"            
278                wait 200
279            else
280                if timer pouchMessageTimer > pouchMessageCD
281                    overhead "Out of Pouches!" 34
282                    settimer pouchMessageTimer 0
283                endif
284            endif
285        endif
286            
287        #--- Self bandage ---#
288        
289        if diffhits >= 1 and not bandaging
290            if skill 'healing' >= 50 or skill "veterinary" >= 50
291                if findtype 'clean bandage%s%' backpack
292                
293                    if targetexists
294                        hotkey 'cancel current target'  
295                    endif
296                    dclicktype 'clean bandage%s%'
297                    waitfortarget maxwaittimeinms
298                    target 'self'
299                    wait 200            
300                else
301                    if timer aidsMessageTimer > aidsMessageCD
302                        overhead "Out of bandages" 34
303                        settimer aidsMessageTimer 0
304                    endif
305                endif
306            endif
307        endif
308        
309        #--- Drink str pot ---#
310        
311        if drinkStr = 1 and str < strengthLowerThan
312            if not findbuff "Strength" 
313                if findtype "White Potion" self
314                    dclicktype "White Potion"
315                    wait 200
316                else
317                    if timer whiteMessageTimer > whiteMessageCD
318                        overhead "Out of str pots" 34
319                        settimer whiteMessageTimer 0 
320                    endif
321                endif
322            endif
323        endif
324        
325        #--- Drink agility pot ---#
326        
327        if drinkAgility = 1
328            if not findbuff "Agility" 
329                if findtype "Blue Potion" self
330                    dclicktype "Blue Potion"
331                    wait 200
332                else
333                    if timer blueMessageTimer > blueMessageCD
334                        overhead "Out of agility pots" 34
335                        settimer blueMessageTimer 0 
336                    endif
337                endif
338            endif
339        endif
340            
341        #--- Drink magic resist pot ---#
342    
343        if drinkMagicResist = 1
344            if not findbuff "Magic Resist" 
345                if findtype "Black Potion" self
346                    dclicktype "Black Potion"
347                    wait 200
348                else
349                    if timer blackMessageTimer > blackMessageCD
350                        overhead "Out of resist pots" 34
351                        settimer blackMessageTimer 0
352                    endif
353                endif
354            endif
355        endif
356            
357        #--- Poisoned ---#
358        
359        if 1 = drinkCure or 1 = cureSpell
360            while poisoned
361                if findtype "Orange Potion" self
362                    
363                    dclicktype "Orange Potion"
364                    wait 200
365                else
366                    if timer orangeMessageTimer > orangeMessageCD
367                        overhead "Out of cure pots" 34
368                        settimer orangeMessageTimer 0
369                    endif
370                    
371                    if diffhits >= 30 or not findtype 3972 self or not findtype 3973 self
372                        break
373                    endif
374                    
375                    if skill 'magery' >= 40 and mana >= 6 and 1 = cureSpell and not casting
376                        cast 'cure'
377                        wait 50
378                        while not casting                   
379                            if targetexists
380                                hotkey 'cancel current target'
381                            endif
382                            cast 'cure'  
383                            wait 50
384                        endwhile  
385                        while not targetexists and casting
386                        endwhile
387                        waitfortarget maxwaittimeinms
388                        target 'self' 
389                        wait 200
390                    else 
391                        break
392                    endif
393                endif
394            endwhile
395        endif
396            
397        #--- Drink Heal Pot ---#
398        
399        if diffhits >= drinkHealPotDiff and 1 = drinkHeal
400            if findtype "Yellow Potion" self as hPot
401                getlabel hPot potLabel
402                if "next" in potLabel
403                    #do nothing
404                else
405                    @setvar! ch 0
406                    
407                    if counttype 3852 self as c
408                        @setvar! ch c
409                    endif
410                    if insysmsg "potion satchel used"
411                    endif
412                    
413                    dclicktype 3852
414                    getlabel backpack xxx
415                    wait 200
416                                
417                    if ch != counttype 3852 self or insysmsg "potion satchel used"
418                        cooldown "Heal Pot" healingPotCD
419                    endif
420                endif
421            else
422                if timer yellowMessageTimer > yellowMessageCD
423                    overhead "Out of heals pots" 34
424                    settimer yellowMessageTimer 0
425                endif
426            endif
427        endif
428                
429        #--- Drink red pot ---#
430        
431        if stam < staminaLowerThan and 1 = drinkRefresh
432            if findtype "Red Potion" self
433                dclicktype "Red Potion"
434                wait 200
435            else
436                if timer redMessageTimer > redMessageCD
437                    overhead "Out of refresh pots" 34
438                    settimer redMessageTimer 0 
439                endif
440            endif
441        endif
442        
443        #--- Cast Chivarly ---#
444        
445        if ingump "20/" 1387930325
446            @setvar! holyPoints 20
447        elseif ingump "19/" 1387930325
448            @setvar! holyPoints 19
449        elseif ingump "18/" 1387930325
450            @setvar! holyPoints 18
451        elseif ingump "17/" 1387930325
452            @setvar! holyPoints 17
453        elseif ingump "16/" 1387930325
454            @setvar! holyPoints 16
455        elseif ingump "15/" 1387930325
456            @setvar! holyPoints 15
457        elseif ingump "14/" 1387930325
458            @setvar! holyPoints 14
459        elseif ingump "13/" 1387930325
460            @setvar! holyPoints 13
461        elseif ingump "12/" 1387930325
462            @setvar! holyPoints 12
463        elseif ingump "11/" 1387930325
464            @setvar! holyPoints 11
465        elseif ingump "10/" 1387930325
466            @setvar! holyPoints 10
467        elseif ingump "9/" 1387930325
468            @setvar! holyPoints 9
469        elseif ingump "8/" 1387930325
470            @setvar! holyPoints 8
471        elseif ingump "7/" 1387930325
472            @setvar! holyPoints 7
473        elseif ingump "6/" 1387930325
474            @setvar! holyPoints 6
475        elseif ingump "5/" 1387930325
476            @setvar! holyPoints 5
477        elseif ingump "4/" 1387930325
478            @setvar! holyPoints 4
479        elseif ingump "3/" 1387930325
480            @setvar! holyPoints 3
481        elseif ingump "2/" 1387930325
482            @setvar! holyPoints 2
483        elseif ingump "1/" 1387930325
484            @setvar! holyPoints 1
485        else 
486            @setvar holyPoints 0
487        endif    
488
489        if holyLight = 1 and 4 < holyPoints and timer holyLightTimer > holyLightCD and timer nobleDelayTimer > nobleDelayCD and skill 'chivalry' >= 95 and diffhits >= holyLightDiff
490            @setvar! castingInterrupted 0
491            
492            if insysmsg "holy symbols remaining"
493            endif
494            if insysmsg "seconds before you may use that ability again."
495            endif
496
497            while not insysmsg "holy symbols remaining" and not dead
498                sysmsg "holy light" 46
499                hotkey 'holy light'
500                getlabel backpack xxx
501                wait 200
502                if insysmsg "seconds before you may use that ability again."
503                    sysmsg "holylight on cooldown" 44
504                    @setvar! castingInterrupted 1
505                    break    
506                endif
507            endwhile
508            
509            if castingInterrupted = 0
510                overhead '[>Holy Light<]' 46
511                settimer holyLightTimer 0
512            endif
513            
514        elseif nobleSacrifice = 1 and 3 < holyPoints and timer nobleTimer > nobleCD and skill 'chivalry' >= 80 and diffhits >= nobleSacrificeDiff
515            @setvar! castingInterrupted 0
516            
517            if insysmsg "holy symbols remaining"
518            endif
519            if insysmsg "seconds before you may use that ability again."
520            endif
521
522            while not insysmsg "holy symbols remaining" and not insysmsg "whom do you wish to heal" and not dead
523                sysmsg "noble sacrifice" 46
524                hotkey 'noble sacrifice'
525                getlabel backpack xxx
526                wait 200
527                if insysmsg "seconds before you may use that ability again."
528                    sysmsg "Noble Sacrifice on cooldown" 44
529                    @setvar! castingInterrupted 1
530                    break    
531                endif
532            endwhile
533            
534            if castingInterrupted = 0
535                overhead '[>Noble Sacrifice<]' 48
536                waitfortarget maxwaittimeinms
537                target 'self'
538                settimer nobleTimer 0
539                settimer nobleDelayTimer 0
540            endif
541        endif
542            
543        #--- Cast heals ---#
544        
545        if skill 'magery' >= 40 and diffhits >= startCastMiniHealDiff and diffhits < endCastMiniHealDiff and mana >= 4 and miniHeal = 1 and not casting
546            if insysmsg "Your concentration is disturbed"
547            endif  
548            
549            sysmsg 'mini heal' 11
550            cast 'heal'
551            while not casting                   
552                if targetexists
553                    hotkey 'cancel current target'
554                endif
555                cast 'heal'
556            endwhile  
557            
558            while not targetexists
559                if insysmsg "Your concentration is disturbed"
560                    interrupt
561                    @setvar! castingInterrupted 1
562                    break                
563                endif
564            endwhile
565            
566            if castingInterrupted = 0
567                target 'self' 
568            endif 
569            
570        elseif skill 'magery' >= 40 and diffhits >= castEmergencyMiniHealDiff and mana >= 4 and miniHeal = 1 and not casting
571            if insysmsg "Your concentration is disturbed"
572            endif  
573            sysmsg "mini heal" 11
574            cast 'heal'
575            while not casting                   
576                if targetexists
577                    hotkey 'cancel current target'
578                endif
579                cast 'heal'
580            endwhile  
581            
582            while not targetexists
583                if insysmsg "Your concentration is disturbed"
584                    interrupt
585                    @setvar! castingInterrupted 1
586                    break                
587                endif
588            endwhile
589            
590            if castingInterrupted = 0
591                target 'self' 
592            endif 
593            
594        elseif skill 'magery' >= 60 and diffhits >= startCastGreaterHealDiff and diffhits < endCastGreaterHealDiff and mana >= 11 and greaterHeal = 1 and not casting
595            if insysmsg "Your concentration is disturbed"
596            endif  
597                        
598            sysmsg "greater heal" 11
599            cast 'greater heal'         
600            while not casting                   
601                if targetexists
602                    hotkey 'cancel current target'
603                endif
604                cast 'greater heal'
605            endwhile  
606            
607            @settimer! spellTimer 0  
608            @setvar! spellCD 800  
609            
610            while not targetexists
611                if insysmsg "Your concentration is disturbed"
612                    interrupt
613                    @setvar! castingInterrupted 1
614                    break                
615                endif 
616                
617                if timer spellTimer < spellCD
618                    #--- Poisoned ---#
619                    
620                    if 1 = drinkCure
621                        while poisoned and casting and not targetexists 
622                            if findtype "Orange Potion" self
623                                dclicktype "Orange Potion"
624                                wait 200
625                            else
626                                if timer orangeMessageTimer > orangeMessageCD
627                                    overhead "Out of cure pots" 34
628                                    settimer orangeMessageTimer 0
629                                endif
630                                break
631                            endif
632                        endwhile
633                    endif            
634                
635                    #--- Drink Heal Pot ---#
636                    
637                    if diffhits >= drinkHealPotDiff and 1 = drinkHeal and casting and not targetexists
638                        if findtype "Yellow Potion" self as hPot
639                            getlabel hPot potLabel
640                            if "next" in potLabel
641                                #do nothing
642                            else
643                                @setvar! ch 0
644                                
645                                if counttype 3852 self as c
646                                    @setvar! ch c
647                                endif
648                                if insysmsg "potion satchel used"
649                                endif
650            
651                                dclicktype 3852
652                                getlabel backpack xxx
653                                wait 200
654                                            
655                                if ch != counttype 3852 self or insysmsg "potion satchel used"
656                                    cooldown "Heal Pot" healingPotCD
657                                    if diffhits < activateAutoHealDiff
658                                        interrupt
659                                        if targetexists
660                                            hotkey 'cancel current target'
661                                        endif
662                                    endif
663                                endif
664                            endif
665                        else
666                            if timer yellowMessageTimer > yellowMessageCD
667                                overhead "Out of heals pots" 34
668                                settimer yellowMessageTimer 0
669                            endif
670                        endif
671                    endif
672                endif
673            endwhile
674            
675            if castingInterrupted = 0
676                target 'self' 
677            endif 
678        
679        endif 
680        
681        if mana < lowManaWarningMessageWhenBelow and timer manaMessageTimer > manaMessageCD
682            overhead "Low mana warning" 34
683            settimer manaMessageTimer 0
684        endif
685        
686    endwhile
687        
688#********** AUTO-MAGERY BUFFS IF NEEDED **********          
689    @setvar! castingInterrupted 0
690    
691    if magicReflect = 1 and skill 'magery' >= 70 and not findbuff "Magic Reflection" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and timer magicReflectTimer > magicReflectCD and findtype 3972 self and findtype 3974 self and findtype 3981 self and not find currentTarget ground -1 -1 12
692        if insysmsg "that spell will not"
693        endif
694        if insysmsg "that spell is already"
695        endif
696        sysmsg "magic reflect" 11
697        cast 'Magic Reflection'
698        while not casting 
699            getlabel backpack xxx
700            wait 200
701            if insysmsg "that spell will not" or insysmsg "that spell is already"
702                settimer magicReflectTimer 0
703                break  
704            endif
705            if targetexists
706                hotkey 'cancel current target'
707            endif
708            cast 'Magic Reflection'
709        endwhile 
710        
711        while casting 
712            if diffhits >= interruptCastingBuffsDiff
713                interrupt
714                @setvar! castingInterrupted 1 
715                break
716            endif            
717            #--- Poisoned ---#
718            
719            if 1 = drinkCure
720                while poisoned and casting and not targetexists 
721                    if findtype "Orange Potion" self
722                        sysmsg "pot cure - reflect" 11
723                        dclicktype "Orange Potion"
724                        wait 200
725                    else
726                        if timer orangeMessageTimer > orangeMessageCD
727                            overhead "Out of cure pots" 34
728                            settimer orangeMessageTimer 0
729                        endif
730                        break
731                    endif
732                endwhile
733            endif            
734        
735            #--- Drink Heal Pot ---#
736            
737            if diffhits >= drinkHealPotDiff and 1 = drinkHeal and casting and not targetexists
738                if findtype "Yellow Potion" self as hPot
739                    getlabel hPot potLabel
740                    if "next" in potLabel
741                        #do nothing
742                    else
743                        @setvar! ch 0
744                        
745                        if counttype 3852 self as c
746                            @setvar! ch c
747                        endif
748                        if insysmsg "potion satchel used"
749                        endif
750                        sysmsg "pot heal - reflect" 11
751                        dclicktype 3852
752                        getlabel backpack xxx
753                        wait 200
754                                    
755                        if ch != counttype 3852 self or insysmsg "potion satchel used"
756                            cooldown "Heal Pot" healingPotCD
757                        endif
758                    endif
759                else
760                    if timer yellowMessageTimer > yellowMessageCD
761                        overhead "Out of heals pots" 34
762                        settimer yellowMessageTimer 0
763                    endif
764                endif
765            endif
766            
767        endwhile
768        wait 200  
769  
770    endif
771    
772    if armorReflect = 1 and skill 'magery' >= 30 and not findbuff "Reactive Armor" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and timer armorReflectTimer > armorReflectCD and findtype 3980 self and findtype 3972 self and findtype 3981 self and not find currentTarget ground -1 -1 12
773        if insysmsg "that spell will not"
774        endif
775        if insysmsg "that spell is already"
776        endif
777        sysmsg "reflect armor" 11
778        cast 'Reactive Armor'
779        while not casting   
780            getlabel backpack xxx
781            wait 200
782            if insysmsg "that spell will not" or insysmsg "that spell is already"
783                settimer armorReflectTimer 0
784                break  
785            endif
786            if targetexists
787                hotkey 'cancel current target'
788            endif
789            cast 'Reactive Armor'
790        endwhile  
791        
792        while casting 
793        endwhile
794        getlabel backpack xxx
795        wait 200  
796    endif     
797    
798    if protectionSpell = 1 and skill 'magery' >= 40 and not findbuff "Protection" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and findtype 3980 self and findtype 3972 self and findtype 3973 self and not find currentTarget ground -1 -1 12
799        sysmsg "protect" 11
800        cast 'Protection'
801        while not casting
802            if targetexists
803                hotkey 'cancel current target'
804            endif
805            cast 'Protection'
806        endwhile  
807        while casting
808        endwhile
809        wait 200  
810    endif 
811    
812    if blessSpell = 1 and skill 'magery' >= 50 and not findbuff "Cunning" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and findtype 3972 self and findtype 3974 self and not find currentTarget ground -1 -1 12
813        sysmsg "bless" 11
814        cast 'Bless'         
815        while not casting                  
816            if targetexists
817                hotkey 'cancel current target'
818            endif
819            cast 'Bless'
820            wait 50
821        endwhile  
822        
823        while not targetexists and casting
824        endwhile
825        
826        waitfortarget maxwaittimeinms
827        target 'self' 
828        wait 200  
829    endif 
830            
831endwhile