Moderator: MacroQuest Developers


Code: Select all
sub Event_chat(MsgType,MsgFrom,MsgText)
/if @MsgType==tell {
/if @MsgText=="heal" {
/target @MsgFrom
/cast 1
}
/if @MsgText=="valor" {
/target @MsgFrom
/cast 2
}
.
.
.
}
/return 



Code: Select all
|**
buffbot.mac
Buff Bot Version 1.0
By the Disgruntled Postal Worker
This is a fairly intuiative little buff bot I wrote
after someone on the message board was asking for one
Usage = /macro buffbot.mac <BotName> <ControllerName> <Buff1> <Slot1> <Buff2> <Slot2> <Buff3> <Slot3> <Buff4> <Slot4> <Buff5> <Slot5> <Buff6> <Slot6> <Buff7> <Slot7> <Buff8> <Slot8>
Written Monday 15 December, 2003
**|
#event Fizzle "Your spell fizzles!"
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
Sub Main
|** This first section is where we declare all the variables for the macro **|
/declare controller global
/declare botname global
/declare buff1 global
/declare buff2 global
/declare buff3 global
/declare buff4 global
/declare buff5 global
/declare buff6 global
/declare buff7 global
/declare buff8 global
/declare slot1 global
/declare slot2 global
/declare slot3 global
/declare slot4 global
/declare slot5 global
/declare slot6 global
/declare slot7 global
/declare slot8 global
/declare follow global
|**
We now check the parameters passed to the macro to ensure they are correct and put
these parameters into the proper variables.
**|
/if ($defined(Param0)==false || $ucase("@Param0")=="HELP")
{
/call Help
/endmacro
}
/varset botname @Param0
/if ($defined(Param1)==false)
{
/call Help
/endmacro
}
/varset controller @Param1
/if ($defined(Param2)==false)
{
/call Help
/endmacro
}
/varset buff1 @Param2
/if ($defined(Param3)==false)
{
/call Help
/endmacro
}
/varset slot1 @Param3
/if ($defined(Param4)==true)
{
/if ($defined(Param5)==false)
{
/call Help
/endmacro
}
/varset buff2 @Param4
/varset slot2 @Param5
}
/if ($defined(Param6)==true)
{
/if ($defined(Param7)==false)
{
/call Help
/endmacro
}
/varset buff3 @Param6
/varset slot3 @Param7
}
/if ($defined(Param8)==true)
{
/if ($defined(Param9)==false)
{
/call Help
/endmacro
}
/varset buff4 @Param8
/varset slot4 @Param9
}
/if ($defined(Param10)==true)
{
/if ($defined(Param11)==false)
{
/call Help
/endmacro
}
/varset buff5 @Param10
/varset slot5 @Param11
}
/if ($defined(Param12)==true)
{
/if ($defined(Param13)==false)
{
/call Help
/endmacro
}
/varset buff6 @Param12
/varset slot6 @Param13
}
/if ($defined(Param14)==true)
{
/if ($defined(Param15)==false)
{
/call Help
/endmacro
}
/varset buff7 @Param14
/varset slot7 @Param15
}
/if ($defined(Param16)==true)
{
/if ($defined(Param17)==false)
{
/call Help
/endmacro
}
/varset buff8 @Param16
/varset slot8 @Param17
}
/varset follow 0
|**
Once the variables have been set we do a small loop to check for any chat messages each second.
I have also added the sit command to make sure the buff bot is sitting and medding while not buffing
**|
:MainLoop
/target "@botname"
/if ($char(state)=="Stand")
{
/sit
}
/doevents
/delay 1s
/goto :MainLoop
:EndMacro
/return
Sub Event_Chat(ChatType,Sender,ChatText)
/if "@Sender"=="@controller"
{
/if "@ChatText"~~"camp"
{
/sit
/camp desktop
}
/if "@ChatText"~~"follow"
{
/if "@follow"==0
{
/varset follow 1
/call FollowMe
}else
{
/varset follow 0
}
}
/if "@ChatText"~~"commands"
{
/call ControlCommands
}
}
/if "@ChatText"~~"@buff1"
{
:cast01
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff1 on you, be ready !"
/target "@Sender"
/cast "@slot1"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast01
/if "$return"=="cast_fizzle" /goto :cast01
/sit
/delay 1s
}
/if "@ChatText"~~"@buff2"
{
:cast02
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff2 on you, be ready !"
/target "@Sender"
/cast "@slot2"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast02
/if "$return"=="cast_fizzle" /goto :cast02
/sit
/delay 1s
}
/if "@ChatText"~~"@buff3"
{
:cast03
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff3 on you, be ready !"
/target "@Sender"
/cast "@slot3"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast03
/if "$return"=="cast_fizzle" /goto :cast03
/sit
/delay 1s
}
/if "@ChatText"~~"@buff4"
{
:cast04
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff4 on you, be ready !"
/target "@Sender"
/cast "@slot4"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast04
/if "$return"=="cast_fizzle" /goto :cast04
/sit
/delay 1s
}
/if "@ChatText"~~"@buff5"
{
:cast05
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff5 on you, be ready !"
/target "@Sender"
/cast "@slot5"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast05
/if "$return"=="cast_fizzle" /goto :cast05
/sit
/delay 1s
}
/if "@ChatText"~~"@buff6"
{
:cast06
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff6 on you, be ready !"
/target "@Sender"
/cast "@slot6"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast06
/if "$return"=="cast_fizzle" /goto :cast06
/sit
/delay 1s
}
/if "@ChatText"~~"@buff7"
{
:cast07
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff7 on you, be ready !"
/target "@Sender"
/cast "@slot7"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast07
/if "$return"=="cast_fizzle" /goto :cast07
/sit
/delay 1s
}
/if "@ChatText"~~"@buff8"
{
:cast08
/if ($char(state)=="Sit")
{
/stand
}
/tell "@Sender" "Alright, I am now casting @buff8 on you, be ready !"
/target "@Sender"
/cast "@slot8"
/doevents Fizzle
/doevents OutOfMana
/doevents OutOfRange
/if "$return"=="cast_oom" /goto :cast08
/if "$return"=="cast_fizzle" /goto :cast08
/sit
/delay 1s
}
/if "@ChatText"~~"Available"
{
/call OfferedBuffs
}
/return
Sub FollowMe
:LoopFollow
/if n $target(distance)>10 /sendkey down up
/if n $target(distance)<10 /sendkey up up
/face fast
/doevents
/goto :LoopFollow
:EndFollow
/return
Sub Help
/echo Incorrect Paramaters
/echo --------------------
/echo To start the buff bot you must use the following:
/echo
/echo /macro buffbot <BotName> <ControllerName> <Buff1> <Slot1> <Buff2> <Slot2> ect.
/echo eg. /macro buffbot DaBuffBot Disgruntled Symbol 2 Valor 5 Stamina 8
/echo
/return
Sub ControlCommand
/tell "@Sender" "-------- Buff Bot Controler Commands ---------"
/tell "@Sender" ""
/tell "@Sender" " camp --- This will camp the buff bot out"
/tell "@Sender" " follow --- This will make the buff bot follow you"
/return
Sub OfferedBuffs
/tell "@Sender" "Hello, currently the following buffs are on offer"
/tell "@Sender" "1) @buff1"
/if @buff2 > 0
{
/tell "@Sender" "2) @buff2"
}
/if @buff3 > 0
{
/tell "@Sender" "3) @buff3"
}
/if @buff4 > 0
{
/tell "@Sender" "4) @buff4"
}
/if @buff5 > 0
{
/tell "@Sender" "5) @buff5"
}
/if @buff6 > 0
{
/tell "@Sender" "6) @buff6"
}
/if @buff7 > 0
{
/tell "@Sender" "7) @buff7"
}
/if @buff8 > 0
{
/tell "@Sender" "8) @buff8"
}
/tell "@Sender" "Send me a tell with the buff you want cast on you !"
/return
Sub Event_Fizzle
/return cast_fizzle
Sub Event_OutOfMana
/tell "@Sender" "I'm out of mana at the moment, Let me med for 10 seconds and I'll try again !"
/sit
pause 10s
/stand
/return cast_oom
Sub Event_OutOfRange
/tell "@Sender" "Your Out of Range ! Send you buff request when you get closer to me ! I'm at $char(x),$char(y)"
/return
