Public Macros Basic Healing
Reply
Basic Healing
I was hoping someone could help with this basic macro, I have been reading a lot but I'm getting the below error. If I run the macro when my tank is attacking it heals one then gives the error. I put my char name in place of MAINTANK before loading testing.

Flow ran into another subroutine
clericheal.mac@19(Heal):Sub Heal

Macro
More +

#turbo 10
#include spell_routines.inc

Sub Main

/declare healspell              outer "Faithful Light Rk. I"
/declare clericdv1              timer outer 0s
/declare clericepic2            timer outer 0s

:start
/if (${NetBots[MAINTANK].Attacking} ) {
        /target MAINTANK
        /call Heal
}
/if (!${NetBots[MAINTANK].Attacking} ) {
        /goto :start
}

Sub Heal
/if (${Me.Casting.ID}) /return
/if (${Me.Moving}) /return
/if (${Target.PctHPs}<85 && ${Target.Distance}<70 && ${clericdv1} == 0) {
        /call cast "Hammer of the High Priest" item 3s
        /varset clericdv1 10s
}
/if (${Target.PctHPs}<20 && ${clericepic2} == 0) {
        /call cast "Ancient Frozen Aegis of Divinity" 1s
        /varset clericepic2 1m
}
/if (${Target.PctHPs}<85 && ${Target.Distance}<200 && ${Target.Type.Equal[PC]} && ${Target.Type.NotEqual[CORPSE]}) {
        /call cast ${healspell} gem4
}
/return[/
Mon Jun 10, 2013 11:22 pm
Your sub Main does not have a

/return

also it is not really an infinite loop which is what you want these things to be in general.

finally your general flow here is not how I would heal. timers are bad for casting. You want if conditions to trigger things for more control.

I changed the loop and added a /return see if this works better.

Macro
More +
#turbo 10
#include spell_routines.inc

Sub Main
        /declare healspell outer "Faithful Light Rk. I"
        /declare clericdv1 timer outer 0s
        /declare clericepic2 timer outer 0s

        :start
        /if (${NetBots[MAINTANK].Attacking} ) {
                /target MAINTANK
                /call Heal
        }
        /goto :start
/return

Sub Heal
        /if (${Me.Casting.ID}) /return
        /if (${Me.Moving}) /return
        /if (${Target.PctHPs}<85 && ${Target.Distance}<70 && ${clericdv1} == 0) {
                /call cast "Hammer of the High Priest" item 3s
                /varset clericdv1 10s
        }
        /if (${Target.PctHPs}<20 && ${clericepic2} == 0) {
                /call cast "Ancient Frozen Aegis of Divinity" 1s
                /varset clericepic2 1m
        }
        /if (${Target.PctHPs}<85 && ${Target.Distance}<200 && ${Target.Type.Equal[PC]} && ${Target.Type.NotEqual[CORPSE]}) {
                /call cast ${healspell} gem4
        }
/return

_________________
Sorvani
Tue Jun 11, 2013 1:41 am
Senior Project Member
Thanks Sorvani, I will be able to test this later.

My intent with the timers was to use clicky items to heal if they are available. I thought the timers were needed to keep track of the cast time and the recast time, /call cast "Hammer of the High Priest" item 3s (cast time)
/varset clericdv1 10s (recast timer)

/if the timer isn't at 0 to show the item is ready the program will move on to the next heal, ${clericdv1} == 0)

Is there a better way to tell if a clicky item is ready to cast? Or am I misunderstanding your comment "You want if conditions to trigger things for more control".

Thanks
Tue Jun 11, 2013 1:33 pm
The code you provided doesn't work so I went down to a lower level to troubleshoot and I can't get the below routine to loop, the below code runs once and ends. I'm running UF with the UF download if that helps.

Macro
More +

#turbo 10

Sub Main

:start
/if (${Target.PctHPs}<85) {
        /cast "Faithful Light Rk. I"
        /gsay Healing %T
       
}
/goto :start
/return
Tue Jun 11, 2013 11:13 pm
When the macro runs once and stops...

Does it give the "Flow ran into another subroutine" error?
Does it give an error referring to the /cast in line 7?
Does it give any other errors or warnings?

Is there a better way to tell if a clicky item is ready to cast? Or am I misunderstanding your comment "You want if conditions to trigger things for more control".


${Cast.Ready[itemname or itemid]}
${Me.Inventory[slotname or #].TimerReady}
Wed Jun 12, 2013 4:45 am
Senior Project Member
Another way to check if ready is,
Macro
More +
!${FindItem[random item name].Timer}

Both of grumble's ways work but on some servers I found some items where it would either always return true or false. Never figured out why it did that.
Wed Jun 12, 2013 7:18 pm
Listen to This Guy
Grumble, The only message I get is "The current macro has ended."

It appears to be looping prior to the heal because I start that macro prior to battle, it waits until I drop below 85%, as soon as the heal casts the macro stops with the above message.

I just ran the below macro and it loops correctly, so I'm not sure what's going on.

Macro
More +
Sub Main
   :mainloop
     /if (!${Me.Sitting}&&!${Me.Casting}&&!${Me.Moving}) {
       /sit on
     }
     /delay 1
   /goto :mainloop
/return
Wed Jun 12, 2013 10:01 pm
Take the macro that works, and change one small thing to make it like the one that doesn't work. Then test it.

If it works change a 2nd small thing and test.

Keep doing this until you end up with it being identical to the one that doesn't work. The only two outcomes are that you end with a functioning macro or you identify the one small change that is causing the error.
Wed Jun 12, 2013 10:56 pm
Project Lead
The use of /echo is priceless.

just start inserting /echo everywhere with a uniqueness to it like:
It can help you track where the error is.
/Echo will say whatever is after it in the MQ2 Window

Macro
More +
Sub Main
   :mainloop
     /echo AAA

     /if (!${Me.Sitting}&&!${Me.Casting}&&!${Me.Moving}) {
       /sit on
       /echo BBB
     }

     /delay 1
     /echo CCC

   /goto :mainloop
/echo DDD
/return
Thu Jun 13, 2013 10:52 am
Listen to This Guy
I agree /echo statements are great for debugging.
Thu Jun 13, 2013 11:25 pm
Listen to This Guy
I did some testing with a /echo on each line and the macro is stopping on the line with /if (${Me.Casting.ID}) /return. I removed that line and the macro works, bit it continuously tried to heal while I'm casting, looping and spamming the group chat.

It appears (${Me.Casting.ID}) is not able to determine the spell ID and then stops the macro.

Anyone else experience this or have further suggestions? I already tried (${Me.Casting}) and got the expected error of not being able to parse because a non numeric was encountered.

Thanks,
Thu Jun 13, 2013 11:32 pm
Need more info. Post the macro and any error messages or echo results.

By any chance, do you use notepad to write your macros? Does the error appear on a line that notepad splits into two separate lines? If so, change your wordwrap setting.
Fri Jun 14, 2013 5:44 am
Senior Project Member
I got the macro to work by changing the /return to a goto command. I read that Return can also be used to exit out of a subroutine early, maybe /return can't be used in a main program body? Below is the code that ended up working for me, I will edit it from here.

Macro
More +
Sub Main
   :mainloop
     /if (${Me.Casting.ID}) /goto :mainloop
     /if (${Me.Moving}) /goto :mainloop
     /if (${Target.PctHPs}<85) {
        /casting 5265 -maxtries|3
        /gsay Healing %T
       }
     /goto :mainloop
/return
Fri Jun 14, 2013 7:16 pm
Your original code had a heal sub routine, hence the return. You moved it to the main sub so of course things would not work right.

Please post your code always when asking questions. This would have made this more understandable.
_________________
Sorvani
Sat Jun 15, 2013 3:44 am
Senior Project Member
I got the macro to work by changing the /return to a goto command. I read that Return can also be used to exit out of a subroutine early, maybe /return can't be used in a main program body? Below is the code that ended up working for me, I will edit it from here.


A return in the main program will end the macro immediately. The return tells MQ2 the macro is over.
Sat Jun 15, 2013 2:52 pm
Senior Project Member
Public Macros Basic Healing
Reply