little help plz

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

shaman001
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sun May 09, 2004 8:41 pm

little help plz

Post by shaman001 » Sat Jun 19, 2004 4:04 pm

ok i run a bard and mage in hoh sometime i forget to send pet in so i made mac to send in pet if i for get only problem is i cant get it to loop now any help would be nice on how to fix i could nto find anything to fix it

Code: Select all

#event exp "You have gained#*#" 
#event pet "Attacking a#*#"

sub main 
   /declare pet int outer
   /delay 1s
   /declare iAssistHealthPct int local
   /declare sAssistName string local
   /doevents 
   /delay 1s 
   /if (${Defined[Param0]}) {
      /varset sAssistName ${Param0}
   }

   /if (${Defined[Param1]}) {
      /varset iAssistHealthPct ${Param1}
   } else /varset iAssistHealthPct 60

   /goto :mainloop 
   /return 
       
         :Mainloop
            /delay 10
            /assist ${sAssistName}
            /delay 20
            /if ((${PetTarget}==0)&&(${Target.PctHPs}<=${iAssistHealthPct})) {
            /pet attack
            } 
            /return 

         :waitforexp 
            /doevents 
            /delay 1s 
            /doevents 
            /if (${PetTarget}<1) :goto main 
            /goto :waitforexp 
            /return

Sub Event_exp
   /varset pet 0
/return

Sub Event_pet
   /varset pet 1
/return

/echo working

/goto :main

/endmacro
Last edited by shaman001 on Sat Jun 19, 2004 6:01 pm, edited 1 time in total.

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sat Jun 19, 2004 4:13 pm

Your

Code: Select all

#Sub Event_exp
   /varset pet 0
/return

#Sub Event_pet
   /varset pet 1
/return
should be

Code: Select all

Sub Event_exp
   /varset pet 0
/return

Sub Event_pet
   /varset pet 1
/return
Without #.

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Sat Jun 19, 2004 7:55 pm

You were using different names for variables in several places.

Also, the only code that's executed is the stuff inside Sub Main and subs called from it. Code will execute starting from the top of Sub Main. The macro will end when it reaches a /return inside sub main, you had one too many in there.

Thus, these lines do nothing at all:

Code: Select all

/echo working 

/goto :main 

/endmacro

Code: Select all

#event exp "You have gained#*#" 
#event pet "Attacking a#*#" 

sub main 
   /declare pet int outer 
   /delay 1s 
   /declare iAssistHealthPct int local 
   /declare sAssistName string local 
   /doevents 
   /delay 1s 
   /if (${Defined[Param0]}) { 
      /varset sAssistName ${Param0} 
   } 

   /if (${Defined[Param1]}) { 
      /varset iAssistHealthPct ${Param1} 
   } else /varset iAssistHealthPct 60 

        
         :Mainloop 
            /delay 10 
            /assist ${sAssistName} 
            /delay 20 
            /if ((${pet}==0)&&(${Target.PctHPs}<=${iAssistHealthPct})) { 
            /pet attack 
            } 
            

         :waitforexp 
            /doevents 
            /delay 1s 
            /doevents 
            /if (${pet}<1) /goto :Mainloop
            /goto :waitforexp 
            /return 

Sub Event_exp 
   /varset pet 0 
/return 

Sub Event_pet 
   /varset pet 1 
/return