Page 1 of 1

Small Poblem with my Macro

Posted: Sat May 22, 2004 6:53 pm
by Snowbanx
I can get this to work fine, only problem is that for some reason it won't stop when i am out of bandages.

Feal free to correct any of my mistakes as this is my frist macro, =)

Code: Select all

|binding.mac -- 5.22.2004 
| 


#Event Nobandage "You can't bandage without bandages, go buy some." 

Sub Main 
   /echo binding.mac Started.... 
   /target id ${Group[0].ID}
   /sit
   /delay 2
   :loop_bandage
   /if (${Me.PctHPs} < 70) {
      /if (${Me.AbilityReady[Bind Wound]}) { 
         /doability "Bind Wound"
      } 
      /delay 5
      /goto :loop_bandage
   }
   /echo Binding Done. Exiting.
   /end

      

Sub Event_Nobandage
   /echo No Bandages. Exiting. 
   /endmac 
   /return

Posted: Sat May 22, 2004 7:24 pm
by signal0
You just need a /doevents statement.

Code: Select all

|binding.mac -- 5.22.2004
|

#Event Nobandage "You can't bandage without bandages, go buy some."

Sub Main
   /echo binding.mac Started....
   /target id ${Group[0].ID}
   /sit
   /delay 2
   :loop_bandage
   [color=red]/doevents[/color]
   /if (${Me.PctHPs} < 70) {
      /if (${Me.AbilityReady[Bind Wound]}) {
         /doability "Bind Wound"
      }
      /delay 5
      /goto :loop_bandage
   }
   /echo Binding Done. Exiting.
   /end

     

Sub Event_Nobandage
   /echo No Bandages. Exiting.
   /endmac
   /return 

Posted: Sat May 22, 2004 7:24 pm
by wassup
You are missing /doevents

Code: Select all

|binding.mac -- 5.22.2004 
| 

#Event Nobandage "You can't bandage without bandages, go buy some." 

Sub Main 
   /echo binding.mac Started.... 
   /target id ${Group[0].ID} 
   /sit 
   /delay 2
   :loop_bandage 
   /if (${Me.PctHPs} < 70) { 
      /if (${Me.AbilityReady[Bind Wound]}) /doability "Bind Wound" 
      /delay 5
      [color=cyan]/doevents[/color]
      /goto :loop_bandage 
   }
   /echo Binding Done. Exiting.
/end 

Sub Event_Nobandage 
   /echo No Bandages. Exiting. 
   /endmac 
/return
Edit: Edited a typo

Posted: Sat May 22, 2004 8:40 pm
by Snowbanx
well damn, i am sure that will work now, totaly fergot about /do events.

Thanks guys, i would have been searching for my answer for a VERY long time i think.


*thumbs up for the good work* =)

Posted: Sat May 22, 2004 9:28 pm
by wassup
One other thing... I always try to avoid using events when I can...

Maybe try this too, replace Bandages_Name with whatever the bandages are called you use:

Code: Select all

|binding.mac -- 5.22.2004 

Sub Main 
   /echo binding.mac Started.... 
   /target myself 
   /sit 
   /delay 2 
   :loop_bandage
   /if (${Me.PctHPs} < 70) {
      /if (!${FindItem[=[color=cyan]Bandages_Name[/color]]}) /call NoBandages
      /if (${Me.AbilityReady[Bind Wound]}) {
      /doability "Bind Wound" 
      /delay 5
      /goto :loop_bandage 
   } 
   /echo Binding Done. Exiting. 
   /endmacro
/return

Sub NoBandages
   /echo No Bandages. Exiting. 
   /endmac 
/return 


Posted: Sun May 23, 2004 1:36 pm
by eqjoe
Wassup wrote:One other thing... I always try to avoid using events when I can...
Almost all my macros are event driven......

Any reason you try to avoid using events?

-j

Posted: Sun May 23, 2004 5:08 pm
by wassup
Probably because they used to take more time to process than a simple comparison?

Use events when you have to... not because you can IMO.

Posted: Sun May 23, 2004 6:20 pm
by Programmer
Normally I would say events are best in situations where they are available. This sort of rotuine though is best without depending on an event. The reason is simple: it's not necessary to use an event to determine if you are out of bandages, as shown by Wassup.

The number one rule of programming: don't make things more complicated than they need to be to get the job done.

re: very nice

Posted: Wed Jun 02, 2004 1:05 am
by thunderly
I've been using a variant of these for a while, but the something that I'd like to add to it is to get the macro to stop if I move or am attacked. I've looked through some other macros like the hunters and such and I think I can tell how to code it up, but didn't know if there was one already done that had those types of features.