Here's a fairly simple macro, with perhaps some useless garbage in it, that does commands based on chat channle messages. It's keyed for a cleric, but you can easily change the spells it casts, and the commands.
It uses some bastardized code from a few sources, so it's not pretty and I haven't bothered to clean it up because I'm lazy.
Code: Select all
#Event Loading "LOADING, PLEASE WAIT..."
#Event Slainby "You have been slain by a"
#Event Invited "To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel"
#include spellsub.mac
#chat chat
Sub main
/varset v15 0
:resetattack
/varset v0 $target(name)
/varset v1 $target(id)
/varset v22 0
/varset t1 10
/varset t5 120
/varset t6 50
/varset v30 0
:CloserAF
/doevents
/if n $v22==1 /goto :resetattack
/if "$target()"=="FALSE" /goto :holdingpatt
/if "$target(type)"!="NPC" /goto :holdingpatt
/varset v11 0
/if n $char(hp,pct)<=75 /1 remedy me
/goto :CloserAF
:holdingpatt
/varset t1 70
/if n $v11!=1 /goto :holdingmove
/delay 5
/attack off
/goto :CloserAF
:holdingmove
/sendkey up ctrl
/varset v11 1
/delay 5
/attack off
/goto :CloserAF
||||||||||||||||||||||||||||
Sub Event_Chat
/if "$p2"=="I Need a heal" {
/sit off
/delay 5
/target $p1
/call SpellSub 2 105
/delay 5
/sit on
} else /if "$p2"=="Remedy me" {
/sit off
/delay 5
/target $p1
/call SpellSub 1 42
/delay 5
/sit on
} else /if "$p2"=="nuke" {
/sit off
/delay 5
/target $p1
/assist
/if "$target(type)"=="NPC" /goto :nukeaway
/goto :nonuke
:nukeaway
/call SpellSub 3 70
:nonuke
/delay 5
/sit on
} else /if "$p2"=="root" {
/sit off
/delay 5
/target $p1
/assist
/if "$target(type)"=="NPC" /goto :rootaway
/goto :noroot
:rootaway
/call SpellSub 4 24
:noroot
/delay 5
/sit on
} else /if "$p2"=="gate now" {
/sit off
/delay 5
/cast 8
/endmacro
}
/return
|||||||||||||||||||||||||||||||||
Sub Event_Loading
/endmacro
/return
Sub Event_Slainby
/endmacro
/return
Sub Event_Invited
/delay 20
/invite
/return
And the spellsub.mac I use.
Code: Select all
| - SpellSub.mac -
| Spell Casting Sub routine - Usage "/call SpellSub <gem> <delay *actual cast time plus recast*>"
| Will return $v99 = 999 if you go oom.
|
| Modified by GD to work with the 7-4-2002 Release
|
| modified by sempi to include sitting/standing and be more cleric oriented
|
| Modified by S_B_R to handle more events and relay more information to the person
| issuing the command. Also removed the auto-sit function to help control aggro. 09-07-02
#Event CastStart "You begin casting"
#Event CastFizzle "Your spell fizzles!"
#Event CastInterrupt "Your spell is interrupted."
#Event CastNoMana "Insufficient Mana to cast this spell"
#Event CastTooFar "Your target is out of range, get closer!"
#Event CastTimer "You haven't recovered yet..."
Sub SpellSub
/varset v98 $p0
/varset v99 $p1
:ReCast
/sit off
/varset v1 2
/cast $v98
/delay 10
/doevents
/if n $v1==0 /goto :ReCast
/if n $v1>1 /goto :Failure
/return
:Failure
/if n $v1==2 {
/1 Spell failed for unknown reason...
/delay 5
} else /if n $v1==3 {
/1 You're too far away. Come back.
/delay 5
} else /if n $v1==4 {
/1 OOM
/delay 100
} else /if n $v1==5 {
/1 Waiting for repop...
}
/return
Sub Event_CastStart
/varset v1 1
/delay $v99
/return
Sub Event_CastFizzle
/varset v1 0
/return
Sub Event_CastInterrupt
/varset v1 0
/return
Sub Event_CastTooFar
/varset v1 3
/return
Sub Event_CastNoMana
/varset v1 4
/return
Sub Event_CastTimer
/varset v1 5
/return