Moderator: MacroQuest Developers
Code: Select all
|Simple shaman bot
#include spellcast.inc
#event exp "You have gained#*#"
#event slow "#*#yawns"
Sub Main
/declare slowed int outer
:main
/assist maintank
/call cast "Togor's Insects"
/doevents
/delay 1s
/goto :checkcast
/return
:checkcast
/doevents
/delay 1s
/if (${slowed}==1) /goto :waitforexp
/return
:waitforexp
/doevents
/delay 1s
/if (${slowed}==0) /goto :main
/goto :waitforexp
/return
Sub Event_exp
/varset slowed 0
/return
Sub Event_slow
/varset slowed 1
/return
/endmacro
Code: Select all
|Simple shaman bot
#include spellcast.inc
#event exp "You have gained#*#"
Sub Main
/declare slowed bool outer FALSE
:main
/doevents
/assist maintank
/if (!${slowed}) {
/call Cast "Togor's Insects"
/if (${String[${Macro.Return}].Equal[CAST_SUCCESS]}) {
/varset slowed TRUE
}
}
/goto :main
/return
Sub Event_exp
/varset slowed FALSE
/return
Code: Select all
|Simple shaman bot
#include spellcast.inc
#event exp "You have gained#*#"
Sub Main
/declare slowed bool outer FALSE
/declare maintank string outer [color=red]Tank Name Here[/color]
:main
/doevents
/assist ${maintank}
:slow
/if (!${slowed}) {
/call Cast "Togor's Insects"
/if (!${String[${Macro.Return}].Equal[CAST_SUCCESS]}) {
/goto :slow
} else {
/varset slowed TRUE
}
}
:tank
/target ${maintank}
/if (${Target.PctHPs}<=[color=red]50[/color]) {
/call Cast "[color=red]Shaman Heal Spell[/color]"
/if (!${String[${Macro.Return}].Equal[CAST_SUCCESS]}) {
/goto :tank
}
}
/goto :main
/return
Sub Event_exp
/varset slowed FALSE
/return Code: Select all
|*
Simple usage is:
-- Name a specific target. Can use %T and make a hotkey
"/tell BOT_NAME cast minor healing on TARGET"
-- This version uses flags to determine
-- who to cast the spell on
"/tell BOT_NAME cast minor healing"
*|
#chat tell
#chat group
#chat chat
#Event Cast "#*#|${Master}|#*#cast #1#'"
#Event Fizzle "#*#Your spell fizzles#*#"
Sub Main
/declare Debug int outer 0
/declare Master string outer
/declare RelayChannel string outer tell
/declare ProgramName string outer ShamanBot
|||||||||||||||||||||||||||||||||||||||||||
| Flags that modify the bots behaviour
| Sit down after casting a spell
/declare AutoSitAfterCast int outer 1
| If the bot receives no specific target, it will
| use its current target, if any
/declare UseActiveTargetForSpells int outer 1
| If the bot receives no specific target, it will
| use its Master. UseActiveTarget is processed first
| if they are both set
/declare UseMasterTargetForSpells int outer 0
||||||||||||||||||||||||||||||||||||
| State variables
| In case of fizzles
/declare LastSpellCast string outer
| Startup variable settings
/if (${Defined[Param0]}) {
/varset Master ${Param0}
/if (${Defined[Param1]}) {
/varset RelayChannel ${Param1}
}
/call Output "Initialization complete"
} else {
/varset Debug 1
/call Output "You must specify a master"
/endmacro
}
| Umm... main loop
:MainLoop
/doevents
/delay 1
/goto :MainLoop
/return
Sub Output
/if (${Debug}) /echo "[${ProgramName}] ${Param0}
/return
Sub RelayInfo
/docommand /${RelayChannel} ${Master} ${Param0}
/return
Sub CastSpell
/if (${Param0.NotEqual["NULL"]}) {
/if (${Me.Sitting}) /docommand /stand
| Delay until the spell is available
/delay 35s ${Me.SpellReady[${Param0}]}
/varset LastSpellCast ${Param0}
/call RelayInfo "Casting ${Param0} on ${Target.CleanName}"
/cast "${Param0}"
| Delay until casting is done
/delay 30s !${Me.Casting.ID}
| Do we need to perform actions after casting?
/if (${AutoSitAfterCast}) /docommand /sit
}
/return
| Param1 will be something like "This Spell on Target" with " on Target" being optional
Sub Event_Cast
| Can't cast if we're moving can we
/if (${Me.Moving}) /return
/if (${Defined[Param1]}) {
/declare target string local
/declare tmp int local 0
/declare spellName string local
| Was a target specified?
/varset tmp ${Param1.Find[ on ]}
| Target was specified
/if (${tmp}) {
| Get target name
/varcalc tmp ${Param1.Length} - (${tmp}+3)
/varset target ${Param1.Right[${tmp}]}
| Get spell name
/varcalc tmp (4+${tmp})*-1
/varset spellName ${Param1.Left[${tmp}]}
} else {
| Do we have a current target and should we use it?
/if (${UseActiveTargetForSpells}) {
/varset target ${Target.Name}
} else {
| Use our master if we were told to
/if (${UseMasterTargetForSpells}) {
/varset target ${Spawn[${Master}].Name}
}
}
| Get spell name
/varset spellName ${Param1}
}
| Make sure we have a valid target
/if (!${Spawn[${target}].ID}) {
/call RelayInfo "Spell target <${target}> is not valid"
/return
} else {
| Do we have the spell memorized?
/if (${Me.Gem[${spellName}]}) {
/target ${target}
/call CastSpell "${spellName}"
} else {
/call RelayInfo "${spellName} is not memorized"
}
}
}
/return
Sub Event_Fizzle
/call CastSpell "${LastSpellCast}"
/return
Code: Select all
#include spell_routines.inc
#define slowduration 4m
#define slowspell "Togor's Insects"
| .... add in your main macro code here ....
Sub Slow
/declare tempID int local ${Target.ID}
/call Cast "slowspell"
/if ( !${Defined[slowTimer${tempID}]} ) /declare slowTimer${tempID} timer outer
/if ( ${Macro.Return.Equal[CAST_IMMUNE]} ) {
/deletevar slowTimer${tempID}
/declare slowTimer${tempID} int outer -1
} else /if ( ${Macro.Return.Equal[CAST_SUCCESS]} ) {
/varset slowTimer${tempID} slowduration
} else {
/varset slowTimer${tempID} 1
}
/return ${Macro.Return}
Sub Event_Timer(string timerName,int timerValue)
/declare tempID int local 0
/declare oldTargetID int local ${Target.ID}
/if ( ${timerName.Left[9].Equal[slowTimer]} ) {
/varset tempID ${timerName.Right[-9]}
/if ( ${Spawn[${tempID}].Type.Equal[NPC]} || ${Spawn[${tempID}].Master.Type.Equal[NPC]} ) {
/target id ${tempID}
/call Slow
/if ( ${Target.ID}==${tempID} ) {
/if ( ${Spawn[${oldTargetID}].ID} ) {
/target id ${oldTargetID}
} else {
/keypress clear_target
}
}
} else {
/deletevar ${timerName}
}
}
/return ${Macro.Return}




