Help Modify Druidmac

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Andrue
decaying skeleton
decaying skeleton
Posts: 7
Joined: Mon Sep 30, 2002 1:00 am

Help Modify Druidmac

Post by Andrue » Mon Sep 30, 2002 8:31 pm

I wanted to make a sub routine that would also check automatically if my warrior was at half life etc. If he wasnt at half life it would automatically heal him. Im not exactly sure what lines to add so far i came up with this but it doesnt seem to work properly.

edit: codes added

Code: Select all

| Druid Healer 
| 
| Written by: Honter&Arioch 
| Modified by: Nuad 
| 
#include SpellSub.mac 
#include routines.mac 
#chat tell 

Sub Main 
    :loop  
    /doevents  
    /goto :loop 
/return 

Sub Event_AutoHeal
/target char name
/if n $t2==0 { 
/if n $char(hp,pct)<45 { 
/echo $char(hp,pct) 
/cast 1
/sit 
/varset t2 20s 
} 
} 
/return

Sub Event_Chat 
   /stand 
   /target $p1 
   /if $p2~~"heal" /cast 1 
   /if $p2~~"DS" /cast 2
   /if $p2~~"Skin" /cast 3 
   /if $p2~~"Regen" /cast 4 
   /if $p2~~"str" /cast 5 
   /if $p2~~"sow" /cast 6 
   /if $p2~~"snare" /call SnareSub 
   /if $p2~~"root" /call RootSub 
   /if $p2~~"come" /call GoTarget 
   /if $p2~~"self" /call SelfBuff 
   /if $p2~~"go home" /call GoHome 
      /sit 
/return 
    
Sub SnareSub 
    /assist $p1 
    /delay 5 
    /tell $p1 Ensnaring %T 
    /call SpellSub 7 5.75    
    /target $p1 
    /tt Mob ensnared 
/return 

Sub RootSub 
    /assist $p1 
    /delay 5 
    /tell $p1 Rooting %T 
    /call SpellSub 8 5.5    
    /target $p1 
    /tt Mob rooted 
/return 

Sub GoTarget 
   /stand 
   /face $p1 
   /varset v90 $target(id) 
   /tt I'm coming to you %t, no other actions possible in the next 10 Seconds 
   /varset t0 10s 
   :CloserAF 
      /if "$target(id)"!="$v90" /goto :EndAF 
      /if n $target(distance)>14 /call AutoRun 1 
      /if n $target(distance)<15 /call AutoRun 0 
      /if n $target(distance)<5 /call BackPedal 0 
      /if n $target(distance)>4 /call BackPedal 1 
      /face $p1 
      /if n $t0==0 /press esc 
   /goto :CloserAF 

   :EndAF 
   /call AutoRun 0 
/return 

Sub SelfBuff 
   /sendkey down F1 
   /sendkey up F1 
   /Call SpellSub 6 8 
   /sendkey down F1 
   /sendkey up F1 
   /call SpellSub 3 8 
   /target $p1 
/return 

Sub GoHome 
   /sit 
   /camp desktop 
   /unload 
/return

Catt
a lesser mummy
a lesser mummy
Posts: 76
Joined: Mon Sep 16, 2002 2:49 am

Post by Catt » Mon Sep 30, 2002 11:35 pm

I see a number of things that reading the manual could help you with, for example, in Sub Event-AutoHeal:
/if <n> <condition> <command>
Runs a command if the condition is true. (n makes the compare numeric)
Condition understands comparison operators

== Equal to
!= Not Equal to
> < Greater than; less than
>= <= Greater than or equal to; Lesser than or equal to
~~ contains operator (string only)

Command can be { which will run everything up to the next }
} can be followed by else and a command.
WARNING: Nested {}s are not handled as of yet
(Bold added for clarity)

Check out readme.html in your MQ directory.

You (who ever wrote it) have some good ideas there, jsut need to read about how to make them work.