[NOTE]: This is meant to be studied....I am not attempting to write the macro for you.
Yeah...either the majority of the code is missing, or no, it definately won't work.
Can I suggest reading the forums and especially the "Macro Scripting for Dummies" tutorial? MacroQuest Help File is also going to be a huge help.
Yes, this has already been done before. ::Search:: is your friend.
It's ok to practice, but at least STUDY before you jump in.
Based on what you had here, I cleaned it up and shortened it. I'm not trying to write this for you, so I put LOTS of |comments in for you to learn from. This will just give you an idea of what's happening until you get your MQ working again so you can actually run the macro.
Oh...I changed your variable names just because I am tired from a 34-hour work day and didn't want to type it all out. Your names were fine, just make sure you are being consistant with your CaPiTaLiZaTiOn.
You are close on your variable comparisons, too.
This should have had quote marks (text):
Code: Select all
/target [color=cyan]"[/color]@Tankname[color=cyan]"[/color]
This does not need quote marks (numerical):
Code: Select all
/if n [color=violet]"[/color]$target(hp,pct)[color=violet]"[/color]<=@Chealhealth
Capitalization:
Not really necessary since your low HP is 1%:
Code: Select all
/if n "$target(hp,pct)">=@Qhealhealth2
Code: Select all
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| xxxxxx ClericBot V 1.0 xxxxxx
| xxxxxx Programmer: Zero xxxxxx
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
| Simple Cleric Bot that will watch your target and heal as needed or requested.
|
| USAGE:
| /macro ClericBot <TankName>
|
| ~ This Macro will auto-target the tank name provided when the macro is started.
| ~ When the target falls between 35% & 45% HP, it will cast Complete Healing.
| ~ When the target falls below 35% HP, it will cast Quick Healing spells until
| he/she is over 35% HP, then cast a Complete Heal.
| ~ To force the Cleric to cast a spell (defined below) send a /tell with the
| command you also define below.
|
| USAGE:
| /tell <ClericName> Heal me 1234
|
| READ ALL COMMENTS BELOW.
| CHANGE ALL VARIABLES IN SUB MAIN TO MATCH
| THE NAMES OF YOUR SPELLS (CaSe-SeNsItIvE)
|
| Comments can be deleted....this is just for tutorial purposes.
|
#turbo 50
| You REALLY should be using this to handle ALL of your spell casting in ALL of your Macros!
#include SpellCast.inc
#chat Tell
| Set this to whatever text you want to trigger from your target.
| Set it in a hotbutton! When you send a /tell to your Cleric with this text in it,
| the Cleric will cast your Heal Over Time spell, or whatever you put in here.
#event HealMe "Heal me 1234"
/declare TN global
/declare CH global
/declare QH global
/declare HOT global
Sub Main
/echo ClericBot v1.0 has started.
/echo send a tell to me saying (Heal me 1234) and i shall cast a heal over time.
/echo My current Tank to heal is "@TN"
| Sets the Tank Name to the name you provided when you started the Macro.
/varset TN "@Param0"
| *****************************************
| *** SET THESE TO YOUR OWN SPELL NAMES ***
| *****************************************
| Set this to your Complete Heal spell name.
/varset CH "Complete Heal Spell Name"
| Set this to your Quick Heal for those emergency heals!
/varset QH "Quick Heal Spell Name"
| Set this to the "Heal Over Time" spell you will be using when you send the Bot a /tell.
/varset HOT "Heal Over Time Spell Name"
:HealLoop
| Comment out this line if you do NOT want your Cleric to meditate while watching the Tank.
| A simple /sit will work here, but I like to check to make sure we're not already sitting
| or riding a mount so we don't sit before trying to cast. SpellCast.inc will automatically
| stand you up before casting, anyway. Putting this here just ensures we are going to med.
/if ($char(mounted)!="TRUE" && $char(state)!="SIT") /sit
| Make sure we still have the Tank on target!
/if "$target(name,clean)"!="@TN" /target "@TN"
| Check to see if the Tank is requesting a Heal.
/doevents
| If Tank HP drops to between 35% and 45%, cast the Complete Heal spell.
/if (n $target(hp,pct)<=45 && n $target(hp,pct)>=35) /call Cast "@CH"
| If Tank HP drops to between 35% and 45%, cast the Quick Heal spell.
/if n $target(hp,pct)<=34 /call Cast "@QH"
| Rinse and repeat!
/goto :HealLoop
/return
| Got a tell...let's cast that Heal Over Time spell now!
Sub Event_HealMe
/call Cast "@HOT"
/return
If you'd like to compare it to what you actually wrote without all the |comments to junk it up, here is the shortened version:
Code: Select all
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| xxxxxx ClericBot V 1.0 xxxxxx
| xxxxxx Programmer: Zero xxxxxx
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#turbo 50
#include SpellCast.inc
#chat Tell
#event HealMe "Heal me 1234"
/declare TN global
/declare CH global
/declare QH global
/declare HOT global
Sub Main
/echo ClericBot v1.0 has started.
/echo send a tell to me saying (Heal me 1234) and i shall cast a heal over time.
/echo My current Tank to heal is "@TN"
/varset TN "@Param0"
/varset CH "Complete Heal Spell Name"
/varset QH "Quick Heal Spell Name"
/varset HOT "Heal Over Time Spell Name"
:HealLoop
/if ($char(mounted)!="TRUE" && $char(state)!="SIT") /sit
/if "$target(name,clean)"!="@TN" /target "@TN"
/doevents
/if (n $target(hp,pct)<=45 && n $target(hp,pct)>=35) /call Cast "@CH"
/if n $target(hp,pct)<=34 /call Cast "@QH"
/goto :HealLoop
/return
Sub Event_HealMe
/call Cast "@HOT"
/return
As you can see, it's only 27 lines of actual code...24 if you take out the /echo's. And if you get rid of those damn /declares and /varsets and just hardcode the name of the spell in the script, you can get it down to a nice compact size of only 18 lines!
Code: Select all
#turbo 50
#include SpellCast.inc
#chat Tell
#event HealMe "Heal me 1234"
/declare TN global
Sub Main
/varset TN "@Param0"
:HealLoop
/if ($char(mounted)!="TRUE" && $char(state)!="SIT") /sit
/if "$target(name,clean)"!="@TN" /target "@TN"
/doevents
/if (n $target(hp,pct)<=45 && n $target(hp,pct)>=35) {
/call Cast "Complete Heal Spell Name"
} else {
/if n $target(hp,pct)<=34 /call Cast "Quick Heal Spell Name"
}
/goto :HealLoop
/return
Sub Event_HealMe
/call Cast "Heal Over Time Spell Name"
/return
(Even less with a few minor modifications.) What you posted of yours (looking like the whole thing didn't get posted), you're already at 49 lines. A bit much for a macro that only casts 3 spells when the target falls in specific ranges of health or sends a tell.
Note the placement of the /declares, /varsets, :loops, /returns, and the use of Sub's. Doing things this way will help keep your code organized, re-usable, and performing at its peak without eventually slowing down your system.
I generally use a #turbo of 50 for performance issues. Don't really need it in this macro.
Also, notice how the #event is set up and called. It didn't look like you had this handled in your orginal. If it was in the part that didn't get posted, it would not have worked anyway, because you had no /doevents in your main loop.
When making lables, be sure to remain consistant with your Capitalization! Spell names can also be sensitive to CaSe. If your spells don't work, check your spellbook to make sure they are spelled EXACTLY as EQ shows them, and you're using the proper symbols (` rather than ' for some spells).
Look at my SpellCast.inc found
HERE. You should be able to see how it is handling the casting of spells in case you do want/need to do this in your own mac. I still suggesting always using SpellCast.inc, though. It's been tried and tested and tested and tested, and it works. While this mac simply loops through a HP check and keeps casting, more advanced mac's can't afford to have error-checking built in on every cast. SpellCast.inc handles that automatically so you don't have to.
Hope this helps your efforts in learning macro scripting.
It's late....time for bed. :) Let me know if you have any questions. I can't remember if I covered everything I wanted to or not right now. lol