Page 1 of 2
Just starting need some help.
Posted: Tue Jul 13, 2010 7:17 pm
by lore7460
I'm new to MacroQuest but not new to programming.
I'm trying to build a simple Druid bot that remains at a camp site,
when I return with a mob I want the druid to assist me and casts 5 dots and a snare,
then it watch's my health and rebuffs if needed, also recast dots if they ware off.
It only keeps buff up on Leader
I built my macro from scratch. And when I try and test it, it doesn't do anything.
Could you all point out what I'm doing wrong or what I'm missing
I read something about the DoEvents but I don't fully understand that.
Is that when the script checks for Event triggers?
Thank you in advance
Code: Select all
#turbo
#Include spell_routines.inc
#chat tell
#event thorns "Your Shield of Spikes spell has worn off of |${Leader}|."
#event skin "Your Skin like Nature spell has worn off of |${Leader}|."
#event Atc "auto attack is off"
Sub Main
/declare Leader string outer
/declare InCombat int outer 0
/declare HealSpell string outer Greater Healing
/declare HealPercent int outer 70
/declare Thorns_State int outer 0
/declare HPBuff_State int outer 0
/declare Throns string outer Shield of Spikes
/declare HPBuff string outer Skin like Naturel
/declare Dot1 string outer Stinging Swarm
/declare Dot2 string outer Creeping Crud
/declare Dot3 string outer Drons of Doom
/declare Dot4 string outer Drifting Death
/declare Dot5 string outer Immolate
/declare Snare string outer Snare
/declare Dot1_State int outer 0
/declare Dot2_State int outer 0
/declare Dot3_State int outer 0
/declare Dot4_State int outer 0
/declare Dot5_State int outer 0
/declare Snare_State int outer 0
/varset Leader ${Param0}
/echo Now assisting -- ${Leader} --
:MainLoop
/if (${Me.Casting.ID}>1) {
/goto MainLoop
}
/if (${InCombat}==0) {
/target ${Leader}
/if (${Target.Combat} {
/varset InCombat 1
/assist
/face
}
}
/call CheckHP
/if (${InCombat}) {
/call CheckDOTS
}
/call CheckBuffs
/doevents Chat
/doevent Event_Atc
/doevent Event_Skin
/doevent Event_Throns
/goto :MainLoop
/endmacro
Sub CheckBuffs
if (!${Thorns_State}) {
/target ${Leader}
/call cast "${Thorns}" gem2 nodismount
/varset Throns_State 1
}
if (!${HPBuff_State}) {
/target ${Leader}
/call cast "${HPBuff}" gem2 nodismount
/varset HPBuff_State 1
}
/return
Sub CheckHP
/target Me
/if (${Me.PctHPs<${HealPercent}) { /call cast "${HealSpell}" gem1 nodismount }
/target ${Leader}
/if (${Target.PctHPs<${HealPercent}) { /call cast "${HealSpell}" gem1 nodismount }
/return
Sub CheckDOTS
/target ${Leader}
/assist
/if (!${Dot1_State}) { /call cast "${Dot1}" gem3 nodismount /varset Dot1_State 1}
/if (!${Dot2_State}) { /call cast "${Dot2}" gem4 nodismount /varset Dot2_State 1}
/if (!${Dot3_State}) { /call cast "${Dot3}" gem5 nodismount /varset Dot3_State 1}
/if (!${Dot4_State}) { /call cast "${Dot4}" gem6 nodismount /varset Dot4_State 1}
/if (!${Dot5_State}) { /call cast "${Dot5}" gem7 nodismount /varset Dot5_State 1}
/if (!${Snare_State}) { /call cast "${Snare}" gem8 nodismount /varset Snare_State 1}
/return
sub Event_Thorns
/varset Torns_State 0
/return
sub Event_Skin
/varset HPBuff_State 0
/return 0
sub Event_Atc
/varset InCombat 0
/varset Dot1_State 0
/varset Dot2_State 0
/varset Dot3_State 0
/varset Dot4_State 0
/varset Dot5_State 0
/varset Snare_State 0
/return
Sub Event_Chat(string ChatType,string Sender,string ChatText)
/if (${ChatText.Equal["DS"]}) {
/target ${Sender}
/call cast "${Torns}" gem2 nodismount
}
/if (${ChatText.Equal["SOW"]}) {
/target ${Sender}
/call cast "Spirit of Wolf" gem2 nodismount
}
/if (${ChatText.Equal["root"]}) {
/assist ${Sender}
/call cast "Earthen Roots" gem2 nodismount
}
/if (${ChatText.Equal["Snare"]}) {
/assist ${Sender}
/call cast "Snare" gem8 nodismount
}
/if (${ChatText.Equal["camp"]}) {
/dismount
/sit
/camp
}
/if (${ChatText.Equal["follow"]}) {
/target ${Leader}
/face
/eacho /follow
}
/return
Re: Just starting need some help.
Posted: Tue Jul 13, 2010 7:26 pm
by dont_know_at_all
Never use " in /declare -- it will put the " into the string.
Re: Just starting need some help.
Posted: Tue Jul 13, 2010 7:39 pm
by lore7460
Thank you, for the quick reply,
I'll try without the quotes in the declare statements.
Re: Just starting need some help.
Posted: Tue Jul 13, 2010 10:32 pm
by lore7460
I finally got MacroQuest to work in EQ so now I had a chance to debug the macro
this is the corrected one, lots of little stupid errors like missing a slash and variable spelling.
Right now the issue I'm having is trying to tell if my target is in combat.
Since the target type is spawn it doesn't have a target.combat like the Character object.
Is there a way to ctype (cast) the target into the character object.
or is that what
/target PC does?
Any ideas or solutions are most appreciated.
Code: Select all
#turbo
#Include spell_routines.inc
#chat tell
#event thorns "Your Shield of Spikes spell has worn off of |${Leader}|."
#event skin "Your Skin like Nature spell has worn off of |${Leader}|."
#event Atc "auto attack is off"
Sub Main
/declare Leader string outer
/declare InCombat int outer 0
/declare HealSpell string outer Greater Healing
/declare HealPercent int outer 70
/declare Thorns_State int outer 0
/declare HPBuff_State int outer 0
/declare Thorns string outer Shield of Spikes
/declare HPBuff string outer Skin like Nature
/declare Dot1 string outer Stinging Swarm
/declare Dot2 string outer Creeping Crud
/declare Dot3 string outer Drons of Doom
/declare Dot4 string outer Drifting Death
/declare Dot5 string outer Immolate
/declare Snare string outer Snare
/declare Dot1_State int outer 0
/declare Dot2_State int outer 0
/declare Dot3_State int outer 0
/declare Dot4_State int outer 0
/declare Dot5_State int outer 0
/declare Snare_State int outer 0
/varset Leader ${Param0}
/echo Now assisting -- ${Leader} --
/call CheckBuffs_On
:MainLoop
/if (${Me.Casting.ID}>1) {
/goto MainLoop
}
/if (${InCombat}==0) {
/target ${Leader}
/if (${Target.Combat}==1) {
/varset InCombat 1
/assist
/face
}
}
/call CheckHP
/if (${InCombat}) {
/call CheckDOTS
}
/call CheckBuffs
/doevents Chat
/doevent Event_Atc
/doevent Event_Skin
/doevent Event_Throns
/goto :MainLoop
/endmacro
Sub CheckBuffs
/if (!${Thorns_State}) {
/target ${Leader}
/call cast "${Thorns}" gem2 nodismount
/varset Thorns_State 1
}
/if (!${HPBuff_State}) {
/target ${Leader}
/call cast "${HPBuff}" gem2 nodismount
/varset HPBuff_State 1
}
/return
Sub CheckBuffs_On
/target ${Leader}
/declare t int local
/for t 1 to ${Target.CountBuffs}
/if (${Target.Buff[${t}].Name.Equal["${Thorns}"]}) /varset Thorns_State 1
/if (${Target.Buff[${t}].Name.Equal["${HPBuff}"]}) /varset HPBuff_State 1
/next t
/return
Sub CheckHP
/target Me
/if (${Me.PctHPs}<${HealPercent}) { /call cast "${HealSpell}" gem1 nodismount }
/target ${Leader}
/if (${Target.PctHPs}<${HealPercent}) { /call cast "${HealSpell}" gem1 nodismount }
/return
Sub CheckDOTS
/target ${Leader}
/assist
/if (!${Dot1_State}) { /call cast "${Dot1}" gem3 nodismount /varset Dot1_State 1}
/if (!${Dot2_State}) { /call cast "${Dot2}" gem4 nodismount /varset Dot2_State 1}
/if (!${Dot3_State}) { /call cast "${Dot3}" gem5 nodismount /varset Dot3_State 1}
/if (!${Dot4_State}) { /call cast "${Dot4}" gem6 nodismount /varset Dot4_State 1}
/if (!${Dot5_State}) { /call cast "${Dot5}" gem7 nodismount /varset Dot5_State 1}
/if (!${Snare_State}) { /call cast "${Snare}" gem8 nodismount /varset Snare_State 1}
/return
sub Event_Thorns
/varset Thorns_State 0
/return
sub Event_Skin
/varset HPBuff_State 0
/return 0
sub Event_Atc
/varset InCombat 0
/varset Dot1_State 0
/varset Dot2_State 0
/varset Dot3_State 0
/varset Dot4_State 0
/varset Dot5_State 0
/varset Snare_State 0
/return
Sub Event_Chat(string ChatType,string Sender,string ChatText)
/if (${ChatText.Equal["thorns"]}) {
/target ${Sender}
/call cast "${Thorns}" gem2 nodismount
}
/if (${ChatText.Equal["sow"]}) {
/target ${Sender}
/call cast "Spirit of Wolf" gem2 nodismount
}
/if (${ChatText.Equal["root"]}) {
/assist ${Sender}
/call cast "Earthen Roots" gem2 nodismount
}
/if (${ChatText.Equal["Snare"]}) {
/assist ${Sender}
/call cast "Snare" gem8 nodismount
}
/if (${ChatText.Equal["camp"]}) {
/dismount
/sit
/camp
}
/if (${ChatText.Equal["follow"]}) {
/target ${Leader}
/face
/eacho /follow
}
/if (${ChatText.Equal["mount"]}) {
/call useitem "Mottled Worg Bridle"
}
/return
Re: Just starting need some help.
Posted: Tue Jul 13, 2010 10:49 pm
by lore7460
This is what I have if you were in the same group as your bot
Code: Select all
/if (${InCombat}==0) {
/if (${Me.xtarget}!=0) {
/varset InCombat 1
/target ${Leader}
/assist
/face
}
}
But I think for an external assist I'll have to use a tell trigger like "assist me"
then from that point the extended target list will help eliminate the adds
Re: Just starting need some help.
Posted: Tue Jul 13, 2010 11:03 pm
by dont_know_at_all
lore7460 wrote:Is there a way to ctype (cast) the target into the character object.
or is that what /target PC does?
Character is for you only... Target is a spawn.
Re: Just starting need some help.
Posted: Tue Jul 13, 2010 11:54 pm
by lore7460
This is what I ended up with.
I still haven't had the chance to test the combat part of it.
But the buffing and rebuffing are working great now.
Now this only checks the buffs of the leader object.
I'll see about adding self buffs l8ter on.
Code: Select all
#turbo
#Include spell_routines.inc
#chat tell
#event thorns "Your Shield of Spikes spell has worn off of |${Leader}|."
#event skin "Your Skin like Nature spell has worn off of |${Leader}|."
#event skin "Your skin returns to normal."
#event thorns "The brambles fall away."
#event Atc "auto attack is off"
Sub Main
/declare Leader string outer
/declare InCombat int outer 0
/declare HealSpell string outer Greater Healing
/declare HealPercent int outer 70
/declare Thorns_State int outer 0
/declare HPBuff_State int outer 0
/declare Thorns string outer Shield of Spikes
/declare HPBuff string outer Skin like Nature
/declare Mount_string string outer Mottled Worg Bridle
/declare Dot1 string outer Stinging Swarm
/declare Dot2 string outer Creeping Crud
/declare Dot3 string outer Drons of Doom
/declare Dot4 string outer Drifting Death
/declare Dot5 string outer Immolate
/declare Snare string outer Snare
/declare Dot1_State int outer 0
/declare Dot2_State int outer 0
/declare Dot3_State int outer 0
/declare Dot4_State int outer 0
/declare Dot5_State int outer 0
/declare Snare_State int outer 0
/varset Leader ${Param0}
/echo Now assisting -- ${Leader} --
:MainLoop
/call CheckBuffs_On
/if (${Me.Casting.ID}>1) {
/goto MainLoop
}
/if (${InCombat}==0) {
/if (${Me.XTarget}>0) {
/varset InCombat 1
/target ${Leader}
/assist
/face
}
}
/call CheckHP
/if (${InCombat}) {
/call CheckDOTS_Active
/call CheckDOTS
}
/call CheckBuffs
/doevents
/goto :MainLoop
/endmacro
Sub CheckBuffs
/if (!${Thorns_State}) {
/if (!${Target.Name.Equal["${Leader}"]}) /target ${Leader}
/call cast "${Thorns}" gem2 nodismount
/varset Thorns_State 1
}
/if (!${HPBuff_State}) {
/if (!${Target.Name.Equal["${Leader}"]}) /target ${Leader}
/call cast "${HPBuff}" gem2 nodismount
/varset HPBuff_State 1
}
/return
Sub CheckBuffs_On
/declare Thorns_on int local 0
/declare HPBuff_on int local 0
/if (!${Target.Name.Equal["${Leader}"]}) /target ${Leader}
/declare t int local
/for t 1 to ${Target.BuffCount}
/if (${Me.SpellReady[${Thorns}]}) {
/if (${Target.Buff[${t}].Name.Equal["${Thorns}"]}) {
/varset Thorns_State 1
/varset Thorns_on 1
}
}
/if (${Me.SpellReady[${HPBuff}]}) {
/if (${Target.Buff[${t}].Name.Equal["${HPBuff}"]}) {
/varset HPBuff_State 1
/varset HPBuff_on 1
}
}
/if (${Thorns_on}==0) /varset Thorns_State 0
/if (${HPBuff_on}==0) /varset HPBuff_State 0
/next t
/return
Sub CheckHP
/if (${Me.SpellReady[${HealSpell}]}) {
/if (${Me.PctHPs}<${HealPercent}) { /call cast "${HealSpell}" gem1 nodismount }
/if (!${Target.Name.Equal["${Leader}"]}) /target ${Leader}
/if (${Target.PctHPs}<${HealPercent}) { /call cast "${HealSpell}" gem1 nodismount }
}
/return
Sub CheckDOTS_Active
/target ${Leader}
/assist
/declare t int local
/declare Dot1X int local 0
/declare Dot2X int local 0
/declare Dot3X int local 0
/declare Dot4X int local 0
/declare Dot5X int local 0
/declare SnareX int local 0
/for t 1 to ${Target.BuffCount}
/if (${Target.Buff[${t}].Name.Equal["${Dot1}"]}) {
/varset Dot1_State 1
/varset Dot1X 1
}
/if (${Target.Buff[${t}].Name.Equal["${Dot2}"]}) {
/varset Dot2_State 1
/varset Dot2X 1
}
/if (${Target.Buff[${t}].Name.Equal["${Dot3}"]}) {
/varset Dot3_State 1
/varset Dot3X 1
}
/if (${Target.Buff[${t}].Name.Equal["${Dot4}"]}) {
/varset Dot4_State 1
/varset Dot4X 1
}
/if (${Target.Buff[${t}].Name.Equal["${Dot5}"]}) {
/varset Dot5_State 1
/varset Dot5X 1
}
/if (${Target.Buff[${t}].Name.Equal["${Snare}"]}) {
/varset Snare_State 1
/varset SnareX 1
}
/next t
/if (${Dot1X}==0) /varset Dot1_State 0
/if (${Dot2X}==0) /varset Dot2_State 0
/if (${Dot3X}==0) /varset Dot3_State 0
/if (${Dot4X}==0) /varset Dot4_State 0
/if (${Dot5X}==0) /varset Dot5_State 0
/if (${SnareX}==0) /varset Snare_State 0
/return
Sub CheckDOTS
/target ${Leader}
/assist
/if (!${Dot1_State}) { /call cast "${Dot1}" gem3 10s nodismount /varset Dot1_State 1}
/if (!${Dot2_State}) { /call cast "${Dot2}" gem4 10s nodismount /varset Dot2_State 1}
/if (!${Dot3_State}) { /call cast "${Dot3}" gem5 10s nodismount /varset Dot3_State 1}
/if (!${Dot4_State}) { /call cast "${Dot4}" gem6 10s nodismount /varset Dot4_State 1}
/if (!${Dot5_State}) { /call cast "${Dot5}" gem7 10s nodismount /varset Dot5_State 1}
/if (!${Snare_State}) { /call cast "${Snare}" gem8 10s nodismount /varset Snare_State 1}
/return
sub Event_Thorns
/varset Thorns_State 0
/return
sub Event_Skin
/varset HPBuff_State 0
/return 0
sub Event_Atc
/varset InCombat 0
/varset Dot1_State 0
/varset Dot2_State 0
/varset Dot3_State 0
/varset Dot4_State 0
/varset Dot5_State 0
/varset Snare_State 0
/return
Sub Event_Chat(string ChatType,string Sender,string ChatText)
/if (${ChatText.Equal["thorns"]}) {
/target ${Sender}
/call cast "${Thorns}" gem2 nodismount
}
/if (${ChatText.Equal["sow"]}) {
/target ${Sender}
/call cast "Spirit of Wolf" gem2 nodismount
}
/if (${ChatText.Equal["root"]}) {
/assist pc ${Sender}
/call cast "Earthen Roots" gem2 nodismount
}
/if (${ChatText.Equal["Snare"]}) {
/assist pc ${Sender}
/call cast "Snare" gem8 nodismount
}
/if (${ChatText.Equal["camp"]}) {
/dismount
/sit
/camp
}
/if (${ChatText.Equal["follow"]}) {
/target ${Leader}
/face
/eacho /follow
}
/if (${ChatText.Equal["mount"]}) {
/call cast "${Mount_string}" item
}
/if (${ChatText.Equal["assist me"]}) {
/varset InCombat 1
/target ${Leader}
/assist
/face
}
/if (${ChatText.Equal["dismount"]}) /dismount
}
/return
Re: Just starting need some help.
Posted: Wed Jul 14, 2010 1:38 pm
by MacQ
Lore7460, a great way to start is to become a VIP member, which is what I did many years ago. It only takes a small donation to the developers of MQ2 and gives you access, in the VIP forums, to a lot of quality macros already developed by dozens of skilled macro programmers. If you still want to develop your own macros, reading/experimenting with the macros in the VIP forums is also great way to learn. Welcome and good luck.
Re: Just starting need some help.
Posted: Thu Jul 15, 2010 6:11 pm
by lore7460
Thank you, MacQ
And I am a VIP member, the reason for posting was because the includes I was using were not VIP restricted.
So I figured that I would post in the general section to allow non vip members a chance to learn something.
I have found several problems with my code, one of the main issues is that I'm not targeting using SpawnID
and that's causing a lot of little problems, but I have moved on and working on a more advanced macro now.
I've been all over the wiki and I'm getting a pretty good hand on things.
I'll post my new code once its done in the VIP section since this time it will be using VIP only include files.
One question I do have are commands executed synchronous?
For example say I'm using a MQ2Cast /call cast "Virtue" -maxtries|3
will the script engine hold until the function cast is completed and processed or will it continue going to the next like after the call?
I guess that's more of a question for the MQ2Cast plugin in the VIP section.
Re: Just starting need some help.
Posted: Fri Jul 16, 2010 11:52 am
by lore7460
I got cast thing figured out. I just had to add a delay for recastTime if casting same spell again. If not just delay for normal global cool down.
Re: Just starting need some help.
Posted: Fri Jul 16, 2010 1:11 pm
by MacQ
I think one of the most diverse macros is RaidDruid (a.k.a AutoBot) and would provide you with many great examples of macro programming covering most all game conditions. You can find it in the VIP Macro forums. Don't let the name fool you. RaidDruid is not a Druid only macro; it supports a variety of classes. If you want to fully immerse yourself in macro programming, I suggest studying that macro in detail.
Re: Just starting need some help.
Posted: Wed Jan 14, 2026 4:37 am
by xyilla
Re: Just starting need some help.
Posted: Wed Jan 14, 2026 4:38 am
by xyilla
Re: Just starting need some help.
Posted: Wed Jan 14, 2026 4:39 am
by xyilla
Re: Just starting need some help.
Posted: Wed Jan 14, 2026 4:40 am
by xyilla