Public Macros NEW Shammy macro using NetBots and what I have learned
Reply
NEW Shammy macro using NetBots and what I have learned
I have gone back and rewritten my Shammy macro now that I have learned a bit about netbots. I STILL think it is a very cool plugin. I'm rewritting each one of my toons macros including my clerics. In my spare time I have been spending the last week experimenting and testing all the neat things I can do with netbots. I have finally finished my Shammy macro. Tested? No... BUT I will be soon once I'm all done for now I will at least post what I have. Lots of example of netbots so I hope it comes in handy.. snippets edit .. if it helps then I have done my job =)

Macro
More +

#include Spell_routines.inc
#turbo 40
#chat group
#chat tell


#event givesow   "#1# tells the group, 'sow'"
#event helpcommands "#1# tells the group, 'shadowolf'"
#event sowall "#1# tells the group, 'sow all'"






Sub Main

                                 
| Spells and there locations                              
|      **MySpells**     **OtherSpells                  
| 1. Blizzard Blast.......Agility
| 2. Togor's Insects......Endure Magic
| 3. Malaisement..........Resist Cold
| 4. Burst of Strength....Deftness
| 5. Talisment of Altuna..Resist Fire....Venom of the Snake
| 6. Stamina..............Cannibalize II
| 7. Form of the Bear.....Chloroplast
| 8. Greater Healing

 
    /declare sow    string outer Spirit of Wolf
    /declare canni    string outer   Cannibalize II
   
    /declare debuff   string outer   Malaisement
    /declare slow     string outer   Togor's Insects
    /declare dot      string outer   Venom of the Snake
    /declare heal     string outer   Greater Healing
    /declare DDSpell  string outer   Blizzard Blast
   
    /declare RegenSpell         string outer   Chloroplast
    /declare RegenSpellID       string outer
    /varset RegenSpellID ${Me.Book[${Me.Book[Chloroplast]}].ID}
   
    /declare MRSpell            string outer   Endure Magic
    /declare MRSpellID          string outer
    /varset MRSpellID ${Me.Book[${Me.Book[Endure Magic]}].ID}
   
    /declare FRSpell            string outer   Resist Fire
    /declare FRSpellID          string outer
    /varset FRSpellID ${Me.Book[${Me.Book[Resist Fire]}].ID}
   
    /declare RCSpell            string outer   Resist Cold
    /declare RCSpellID          string outer
    /varset RCSpellID ${Me.Book[${Me.Book[Resist Cold]}].ID}
 
    /declare HPSpell            string outer Talisment of Altuna
    /declare HPSpellID          string outer
    /varset HPSpellID ${Me.Book[${Me.Book[Talisment of Altuna]}].ID}
 
    /declare DexSpell            string outer Deftness
    /declare DexSpellID          string outer
    /varset DexSpellID ${Me.Book[${Me.Book[Deftness]}].ID}
 
    /declare StaSpell            string outer Stamina
    /declare StaSpellID          string outer
    /varset STAID ${Me.Book[${Me.Book[Stamina]}].ID}
 
    /declare AgiSpell            string outer Agility
    /declare AgiSpellID          string outer
    /varset AGIID ${Me.Book[${Me.Book[Agility]}].ID}
 
    /declare TempBuff           string outer Burst of Strength
    /declare TempBuffID         string outer
    /varset TempBuffID ${Me.Book[${Me.Book[Burst of Strength]}].ID}

    /declare BearSpell           string outer Form of the Bear
    /declare BearSpellID         string outer
    /varset BearSpellID ${Me.Book[${Me.Book[Form of the Bear]}].ID}
   
    /declare BoStimer    timer outer
    /declare dottimer    timer outer
    /declare debufftimer timer outer
    /declare slowtimer   timer outer
    /declare DDSpelltimer timer outer

|     Other Stuff    

    /declare z int local
    /declare y int local
    /declare x int local
    /declare MA string outer Backbreaker
    /declare ToonName       string outer
    /declare VerifySpell    string outer
   

:Med
    /if ((!${Me.Casting.ID}) && (${Me.State.Equal[STAND]}) & (${Me.PctMana}<98)) /sit
    /doevents
    /delay 10
    /if (${Me.PctMana}>10) /goto :Main
    /goto :Med




:Main
    /if (${Spawn[${NetBots[${MA}].TargetID}].Type.Equal[NPC]} && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}<80 && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}>65 && ${Spawn[${NetBots[${MA}].TargetID}].Type.NotEqual[CORPSE]} && ${slowtimer}==0 && ${Me.PctMana}>40) {
        /target id ${NetBots[${MA}].TargetID}
        /call cast "${slow}" gem2 3s
        /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
            /g [ %t ] is SLOWED!
            /varset slowtimer 150s
        }
       
        /if (${Macro.Return.Equal[CAST_IMMUNE]}) {
            /g [ %t ] is IMMUNE to SLOW!
            /varset slowtimer 15m
        }
       
        /if (${Macro.Return.Equal[CAST_RESISTED]}) {
            /call cast "${slow}" gem2 3s
            /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                /varset slowtimer 150s
                /g >> %t << is SLOWED!
            }
           
            /if (${Macro.Return.Equal[CAST_RESISTED]}) {
                /varset slowtimer 15m
                /g Sorry >> %t << RESISTED Slow to many times not trying again.
            }
        }
    }
   
    /if (${Spawn[${NetBots[${MA}].TargetID}].Type.Equal[NPC]} && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}<80 && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}>65 && ${Spawn[${NetBots[${MA}].TargetID}].Type.NotEqual[CORPSE]} && ${debufftimer}==0 && ${Me.PctMana}>40) {
        /target id ${NetBots[${MA}].TargetID}
        /call cast "${debuff}" gem3 3s
        /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
            /g [ %t ] is DEBUFFED!
            /varset debufftimer 11m
        }
       
        /if (${Macro.Return.Equal[CAST_IMMUNE]}) {
            /g [ %t ] is IMMUNE to DEBUFF!
            /varset debufftimer 20m
        }
       
        /if (${Macro.Return.Equal[CAST_RESISTED]}) {
            /call cast "${debuff}" gem3 3s
            /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                /varset debufftimer 11m
                /g >> %t << is Debuffed!
            }
           
            /if (${Macro.Return.Equal[CAST_RESISTED]}) {
                /varset debufftimer 20m
                /g Sorry >> %t << RESISTED Debuff to many times not trying again.
            }
        }
    }
   
    /if (${Spawn[${NetBots[${MA}].TargetID}].Type.Equal[NPC]} && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}<75 && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}>60 && ${Spawn[${NetBots[${MA}].TargetID}].Type.NotEqual[CORPSE]} && ${debufftimer}==0 && ${Me.PctMana}>40) {
        /target id ${NetBots[${MA}].TargetID}
        /call cast "${dot}" gem5 3s
        /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
            /g [ %t ] is DOTTED!
            /varset dottimer 38s
        }
       
        /if (${Macro.Return.Equal[CAST_IMMUNE]}) {
            /g [ %t ] is IMMUNE to DEBUFF!
            /varset dottimer 20m
        }
       
        /if (${Macro.Return.Equal[CAST_RESISTED]}) {
            /call cast "${dot}" gem5 3s
            /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                /varset dottimer 38s
                /g >> %t << is DOTTed!
            }
           
            /if (${Macro.Return.Equal[CAST_RESISTED]}) {
                /varset dottimer 20m
                /g Sorry >> %t << RESISTED My DOT to many times not trying again.
            }
        }
    }
   
    /if (${Spawn[${NetBots[${MA}].TargetID}].Type.Equal[NPC]} && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}<60 && ${Spawn[${NetBots[${MA}].TargetID}].PctHPs}>45 && ${Spawn[${NetBots[${MA}].TargetID}].Type.NotEqual[CORPSE]} && ${DDSpelltimer}==0 && ${Me.PctMana}>30) {
        /target id ${NetBots[${MA}].TargetID}
        /call cast "${DDSpell}" gem1 3s
        /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
            /varset DDSpelltimer 12s
        }
       
        /if (${Macro.Return.Equal[CAST_IMMUNE]}) {
            /varset dottimer 20m
        }
       
        /if (${Macro.Return.Equal[CAST_RESISTED]}) {
            /call cast "${DDSpell}" gem1 3s
            /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                /varset dottimer 38s
            }
           
            /if (${Macro.Return.Equal[CAST_RESISTED]}) {
                /varset dottimer 20m
            }
        }
    }
   
    /if (${Spawn[${NetBots[${MA}].TargetID}].Type.Equal[CORPSE]}) {
        /varset debufftimer 0
        /varset slowtimer 0
        /varset dottimer 0
        /varset DDSpelltimer 0
    }
   
    /goto :mana
   
:mana
    /if (${Me.PctHPs}>90 && !${Me.Casting.ID} && ${Me.PctMana}<30) {
        /call cast "${canni}" gem6 3s
        /call cast "${canni}" gem6 3s
            /call cast "${canni}" gem6 3s
            /call cast "${canni}" gem6 3s
    }
   
    /goto :Pet

:Pet
    /if (!${Me.Pet.Name.NotEqual[NULL]}) /call cast "Frenzied Spirit" gem5 5s
    /if (${Me.Pet.Name.NotEqual[Null]} && !${Me.PetBuff[Guardian]} && !${NetBots[${MA}].Attacking} && ${Me.PctMana}>50) /call cast "Guardian" gem5 3s
    /if (${Me.Pet.Name.NotEqual[Null]} && !${Me.PetBuff[Stamina]} && !${NetBots[${MA}].Attacking} && ${Me.PctMana}>50) /call cast "${StaSpell}" gem6 3s
    /if (${Me.Pet.Name.NotEqual[Null]} && !${Me.PetBuff[Agility]} && !${NetBots[${MA}].Attacking} && ${Me.PctMana}>50) /call cast "${AgiSpell}" gem1 3s
    /if (${Me.Pet.Name.NotEqual[Null]} && !${Me.PetBuff[Deftness]} && !${NetBots[${MA}].Attacking} && ${Me.PctMana}>50) /call cast "${DexSpell}" gem4 3s
    /if (${Me.Pet.Name.NotEqual[Null]} && !${Me.PetBuff[Furious Strength]} && !${NetBots[${MA}].Attacking} && ${Me.PctMana}>50) /call cast "Furious Strength" gem5 3s
   
 
    /if (${NetBots[${MA}].Attacking} && ${NetBots[${MA}].TargetHP}<70) {
        /target id ${NetBots[${MA}].TargetID}
        /pet attack
    }
    /goto :healloop


:healloop
    /if (${Group}>1) {
        /for x 0 to ${Group}
        /if ((${Group.Member[${x}].Type.NotEqual[CORPSE]}) && (${Group.Member[${x}].PctHPs}<35)) {
            /targ ${Group.MEmber[${x}]}
            /if (${Target.Distance}<100) {
                /call Cast "${heal}" gem8 3s
                /g ${heal} on %t
                /delay 3s !${Me.Casting.ID}
            }
            /if (${Target.Distance}>100) /g %t is out of range!
        }
       
        /if ((${Group.Member[${x}].Pet.Name.NotEqual[NULL]}) && (${Group.Member[${x}].Pet.PctHPs}<45)) {
            /targ ${Group.MEmber[${x}].Pet}
            /if (${Target.Distance}<100) {
                /call Cast "${heal}" gem8 3s
                /g ${heal} on %t
                /delay 3s !${Me.Casting.ID}
            }
            /if (${Target.Distance}>100) /g %t is out of range!
        }
       
        /next x
    }
   
    /goto :Buffs

   
:Buffs

    /varset CheckSpell " ${NetBots[Shadowolf].Buff} "
    /if (!${CheckSpell.Find[ ${BearSpellID} ]} && !${NetBots[${MA}].TargetID} && !${NetBots[${MA}].Attacking} && ${Me.PctMana}>60) {
        /call cast "${BearSpell}" gem7 3s
        /delay 3s !${Me.Casting.ID}
    }

    /if (${Me.PctMana}>40) {
        /for z 1 to ${NetBots.Counts}
        /varset ToonName ${NetBots.Client.Token[${z}, ]}
        /varset VerifySpell " ${NetBots[${ToonName}].Buff} "
     
        /if (!${VerifySpell.Find[ ${TempBuffID} ]} && ${NetBots[${ToonName}].TargetID} && ${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${TempBuff}" gem4 3s
            /delay 4s !${Me.Casting.ID}
        }
       
        /next z
    }

    /if (${Me.PctMana}>60) {
        /for y 1 to ${NetBots.Counts}
        /varset ToonName ${NetBots.Client.Token[${y}, ]}
        /varset VerifySpell " ${NetBots[${ToonName}].Buff} "

        /if (!${VerifySpell.Find[ ${HPSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${HPSpell}" gem5 3s
            /delay 4s !${Me.Casting.ID}
        }
       
        /if (!${VerifySpell.Find[ ${DexSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${DexSpell}" gem4 3s
            /delay 4s !${Me.Casting.ID}
        }
       
        /if (!${VerifySpell.Find[ ${StaSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${StaSpell}" gem6 3s
            /delay 4s !${Me.Casting.ID}
        }

        /if (!${VerifySpell.Find[ ${AgiSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${AgiSpell}" gem1 3s
            /delay 4s !${Me.Casting.ID}
        }

        /if (!${VerifySpell.Find[ ${RegenSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${RegenSpell}" gem7 3s
            /delay 4s !${Me.Casting.ID}
        }

        /if (!${VerifySpell.Find[ ${MRSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${MRSpell}" gem2 3s
            /delay 4s !${Me.Casting.ID}
        }
       
        /if (!${VerifySpell.Find[ ${FRSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${FRSpell}" gem5 3s
            /delay 4s !${Me.Casting.ID}
        }
       
        /if (!${VerifySpell.Find[ ${RCSpellID} ]} && !${NetBots[${ToonName}].Attacking}) {
            /target ${ToonName}
            /if (${Select[${Target.Class.ShortName},SHD,PAL,WAR,MNK,BRD,BER]}) /call cast "${RCSpell}" gem3 3s
            /delay 4s !${Me.Casting.ID}
        }
       
        /next y
    }    
   
    /goto :Med
   
    /return

   

| SoW

Sub Event_sowall(Line)
  /g One Moment Plz Giving Everyone SoW!
  /declare g int local
  /for g 0 to ${Group}
  /if (${Group.Member[${g}].Type.NotEqual[CORPSE]}) /call sowingall ${Group.Member[${g}].CleanName}
  /next g
  /return

Sub Event_givesow(Line,Targ)
  /assist ${Targ.Right[-2].Left[-1]}
  /delay 1s
  /g casting ${sow} on [ %t ]
  /call Cast "${sow}" gem5 4s
  /return

sub Event_helpcommands(Line)
  /g Sow all - I will give the Spirit of Wolf to everyone in the group.
  /delay 1s
  /g SoW - I will give sow to you or whom you feel needs it.
  /delay 1s
  /return
Thu Jun 28, 2012 5:05 pm
Clean up all your spell ID declarations...
Macro
More +
    /declare RegenSpell         string outer   Chloroplast
    /declare RegenSpellID       string outer ${Spell[${RegenSpell].ID}


Most of your /goto's are useless as they simply go to the next line...
Redo things as seperate subroutines like this.
Macro
More +
Sub CheckNeedToSit
    | if i am mounted, exit the sub
    /if (${Me.Mount.ID}) /return
    /if ((!${Me.Casting.ID}) && (${Me.State.Equal[STAND]}) & (${Me.PctMana}<98)) /sit
/return

Then change sub main
Macro
More +
Sub Main
    | setup all the variables.
:MainLoop
    /doevents
    /call CheckNeedToSit

    | put main logic here

    /call Mana
    /call Pet
    | etc
    /goto :MainLoop
/return

_________________
Sorvani
Thu Jun 28, 2012 10:22 pm
Senior Project Member
Ok I can see how:
Macro
More +

    /declare RegenSpell         string outer   Chloroplast
    /declare RegenSpellID       string outer ${Spell[${RegenSpell].ID}

could help to reduce some of the code. As long as it will accomplish the same thing in my " Buffs" section then that is cool. I had to do alot of asking around to see if there where ways to use netbots to identify spells because of the way it works. It can ID spells but it lists them and if not done correctly then (like if the spell is at the end or the start of the list) it won't find it. Also, had to isolate the ID so 271 spell wouldn't get confused with 1271 spell or a simular one. After much testing I found that the way I did it works great.

Yes, I could have turned a lot of those loop tags into subs but I was going for reducing the amount of subs so the macro wasn't bouncing all over the place and it was easier to fillow. Do I need alot of those loop tags? No your right I don't but I worked on it maybe 30 mins to an hour each day and with my format in Note++ it was easier to tag each section I was working on and make notes as I was going in the macro so I would know or remember what I was doing the next day. There was a lot of stopping to test this and that or I would get an idea about something else and start testing that. It was just easier for me to follow and didn't want alot of notes all over my macro.
Plus, with the loop tags there I can always find a section I want to work on faster or expand upon and know exactly where to go.

Considering this has got to be one of the most complex macros I have ever written, I think it's pritty cool. Just still need to test it now. (after of corse I rewrite my clerics macro nw =P )
Fri Jun 29, 2012 11:41 am
You created a variable called RegenSpell, gave it a value of Chloroplast, then hard coded the Chloroplast name into the spell ID lookup just 2 lines later. The same thing happened with all other buff names.

Macro
More +
${Spell[${RegenSpell}].ID}

${Me.Book[${Me.Book[${RegenSpell}]}].ID}


Both lines do roughly the same thing, but do so in different ways.

The ${Spell[name]} version loops through the entire spellfile with it's thousands of entries. The ${Me.Book[name]} version loops through the spells in your spellbook, which is a considerably smaller list.

In this example, there is very little difference because spell/buff ID's are only set at the beginning of the macro. However, a complex macro that has many ${Spell[name]} calls in subroutines might seem more laggy than the ${Me.Book[name]} version. Especially if the macro is run by multiple toons.

Also, had to isolate the ID so 271 spell wouldn't get confused with 1271 spell or a simular one. After much testing I found that the way I did it works great.

Does your macro do this?
Sun Jul 01, 2012 12:05 am
Senior Project Member
Spells
Yes I noticed when I was trying to find a way and researching and asking questions about how NetBots could be used to find, detect and cast buffs that would have worn off, I found that the way I ended up isolating the Spell ID works great.

When you use netbots to check spells it would give a list of spell ID numbers of spells currently on that toon. I did try other ways and returns and tested and ran into problems because the way NetBots works. I did find with the way it did it if you tried to find the ID of the spell and it was simular to another spell ID (like 1 number more but still having all the same numbers) it would actualy mistake it for that spell. I personaly didn't have it do it but after again researching I found people who it had done it to. Also because of this fact, I found also if the spell ID was at the begining or the end of the list of buff IDs it wouldn't detect it at all. This had to do with the space problem. I forget the exact details of this but did a lot of testing in trying to find just the ID number of the spell using NetBots and I always had the same problem, if at the front or back it ran into problems (first or last spell in the list). But if you notice the /varset with the spaces around it:
Macro
More +

!${VerifySpell.Find[ ${HPSpellID} ]}

and with the way I isolated the spell ID it actualy does what it needs to do now. I have rewritten all my toons this way now. There is a topic on MQ2 forums where several others and I worked through this problem. Credit actualy goes to a few people who came up with this salution and I worked through it, tested it and worked it in.

http://www.macroquest2.com/phpBB3/viewtopic.php?f=47&t=18378

The link is in the VIP section so not sure if you can access it without VIP access.

Macro
More +

| Just to cast the spell
/declare FRSpell string outer Resist Fire
/call cast "${FRSpell}" gem5 3s

|To set up the Variable-Specify Spell ID-no, haven't changed this yet but also
|makes it easy to change the spells at the top and done with it
/declare StaSpellID          string outer
/varset StaSpellID ${Me.Book[${Me.Book[Stamina]}].ID}

|Sets up the varaibles and adds the spaces in listings of buff IDs
|(front and back)when net bots calls for the buff IDs
|of all current buffs the toon has
/varset ToonName ${NetBots.Client.Token[${y}, ]}
/varset VerifySpell " ${NetBots[${ToonName}].Buff} "

|Checks for the specific Spell ID and isolates the ID number
|this way spell # 1267 doesn't get confused with # 267
|The spaces in front and back help do this
!${VerifySpell.Find[ ${StaSpellID} ]}

From here if I need to to change anything it is mostly just copy paste or type a new spell in at the top of the macro and done. Make my life much easier only having to replace a small amount of code when needed.
Thu Jul 05, 2012 9:53 am
Public Macros NEW Shammy macro using NetBots and what I have learned
Reply