Macro not working correctly

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

Moderator: MacroQuest Developers

Misterscout
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 04, 2008 6:09 pm

Macro not working correctly

Post by Misterscout » Thu Feb 10, 2011 9:17 pm

Code: Select all

#include spell_routines.inc
#turbo 10
#Event Slain "#*# slain#*#"
#Event Zoned "LOADING, PLEASE WAIT..."


Sub Main

   |------------------------------------------------------------
   |How far would you like to target a mob?
   |------------------------------------------------------------
   /declare RV_MaxRadius        int outer  300
   /declare Spell1		string outer "A Vex Thal Kraken"
   /declare Spell2		string outer "Ent of Terror"

   |------------------------------------------------------------
   |Variables that you don't need to worry about.
   |------------------------------------------------------------
   /declare RV_MyTargetID       int outer  0
   /declare RV_MyTargetName     string outer
   /declare RV_MyTargetDead     int outer  0
   /declare RV_HasTarget        int outer  0

   |------------------------------------------------------------
   |I think this is the right MQ2MElee Command to turn on 
   |automatic Ranged attacks to be with in your desired range.
   |------------------------------------------------------------
   /melee range ${RV_MaxRadius}
 
   :Start
      /doevents
      /call GMCheck
      /call GetTarget
      /if (${RV_HasTarget}) /call CombatSub
      /call ResetSub
      /goto :Start
/return

|--------------------------------------------------------------------------------
|SUB: GMCheck
|--------------------------------------------------------------------------------
Sub GMCheck
   /if (${Spawn[gm].ID}) {
      /beep
      /beep
      /beep
      /echo GM has entered the zone!
      /echo FUCK HIM but ending the macro...
      /keypress forward
      /keypress back
      /quit
      /endmacro
   }
/return

|--------------------------------------------------------------------------------
|SUB: Get Target
|--------------------------------------------------------------------------------
Sub GetTarget
   /doevents
   /declare RV_CurrentRadius   int local
   /declare RV_TargetSub       int local
   /echo Looking for Mobs
        /doevents
      /for RV_CurrentRadius 100 to ${RV_MaxRadius} step 5
      /if (${Target.ID}) {
           /squelch /target radius ${RV_CurrentRadius} npc
           /varset RV_MyTargetID ${Target.ID}
           /varset RV_MyTargetName ${Target.Name}
           /echo Acquired ${Target.Name} at range ${Int[${Target.Distance}]}
           /varset RV_HasTarget=1
           /return
           }

      /next RV_CurrentRadius
   
/return



|--------------------------------------------------------------------------------
|SUB: Combat
|--------------------------------------------------------------------------------
Sub CombatSub
   /doevents
   /echo Attacking Mob NOW!
   :CombatLoop
      /if (!${Me.Combat}) /attack on
      /if (${Target.PctHPs}<50) /call cast "${Spell1}"
      /if (${Target.PctHPs}<50) /call cast "${Spell2}"
      /if (!${Target.ID}) /return
      /if (!${RV_TargetDead}) /goto :CombatLoop
      /doevents
/return


|--------------------------------------------------------------------------------
|SUB: Slain
|--------------------------------------------------------------------------------

Sub Event_Slain
   /varset RV_TargetDead 1
   /target clear
   /keypress forward
   /keypress back
/return

|--------------------------------------------------------------------------------
|SUB: Zoned
|--------------------------------------------------------------------------------
Sub Event_Zoned
  /echo Zoned
  /delay 60s
  /quit
  /endmacro

|--------------------------------------------------------------------------------
|SUB: Reset
|--------------------------------------------------------------------------------
Sub ResetSub
   /doevents
   /varset RV_HasTarget 0
   /varset RV_TargetDead 0
/return
This is the exact string it messed up for me.
Looking for mobs
/varset failed, variable 'RV_TargetDead' not found
afkkill@123 (ResetSub):/varset RV_TargetDead 0
afkkill@35 (Main): /call Reset Sub


Can anyone figure out how to fix thi macro so it works?

Deeprave
a ghoul
a ghoul
Posts: 115
Joined: Sun Jul 11, 2010 9:46 am

Re: Macro not working correctly

Post by Deeprave » Thu Feb 10, 2011 9:38 pm

Declared:

Code: Select all

   /declare RV_MyTargetDead int outer  0
But used:

Code: Select all

Sub CombatSub
   /doevents
   /echo Attacking Mob NOW!
   :CombatLoop
      /if (!${Me.Combat}) /attack on
      /if (${Target.PctHPs}<50) /call cast "${Spell1}"
      /if (${Target.PctHPs}<50) /call cast "${Spell2}"
      /if (!${Target.ID}) /return
      /if (!${RV_TargetDead}) /goto :CombatLoop
      /doevents
/return
.
.
Sub Event_Slain
   /varset RV_TargetDead 1
   /target clear
   /keypress forward
   /keypress back
/return
.
.
|--------------------------------------------------------------------------------
|SUB: Reset
|--------------------------------------------------------------------------------
Sub ResetSub
   /doevents
   /varset RV_HasTarget 0
   /varset RV_TargetDead 0
/return
The error message was right on the money.

Misterscout
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 04, 2008 6:09 pm

Re: Macro not working correctly

Post by Misterscout » Sat Feb 12, 2011 8:24 pm

I'm not good with coding. How do I fix it.

Deeprave
a ghoul
a ghoul
Posts: 115
Joined: Sun Jul 11, 2010 9:46 am

Re: Macro not working correctly

Post by Deeprave » Sat Feb 12, 2011 8:47 pm

Misterscout wrote:I'm not good with coding. How do I fix it.
Change

Code: Select all

/declare RV_MyTargetDead int outer  0
To

Code: Select all

/declare RV_TargetDead int outer  0
would be the simplest way. I can't say if this is the only fix needed, just that it will fix the specific error you posted.

Misterscout
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 04, 2008 6:09 pm

Re: Macro not working correctly

Post by Misterscout » Sun Feb 13, 2011 2:02 pm

Well the that did fix the problem.

But now it's looking for mobs but is not detecting anything.

Would someone be able to fix it.

I'm just looking to fix it where it kills everything around a center radius point.

devNull
a ghoul
a ghoul
Posts: 121
Joined: Sat Mar 06, 2004 3:57 am

Re: Macro not working correctly

Post by devNull » Tue Feb 15, 2011 12:56 am

Change:

Code: Select all

Sub GetTarget
   /doevents
   /declare RV_CurrentRadius   int local
   /declare RV_TargetSub       int local
   /echo Looking for Mobs
        /doevents
      /for RV_CurrentRadius 100 to ${RV_MaxRadius} step 5
      /if (${Target.ID}) {
           /squelch /target radius ${RV_CurrentRadius} npc
           /varset RV_MyTargetID ${Target.ID}
           /varset RV_MyTargetName ${Target.Name}
           /echo Acquired ${Target.Name} at range ${Int[${Target.Distance}]}
           /varset RV_HasTarget=1
           /return
           }

      /next RV_CurrentRadius
   
/return
To:

Code: Select all

Sub GetTarget
   /doevents
   /declare RV_CurrentRadius   int local
   /declare RV_TargetSub       int local
   /echo Looking for Mobs
      /for RV_CurrentRadius 100 to ${RV_MaxRadius} step 5
        /doevents
        /squelch /target radius ${RV_CurrentRadius} npc
        /if (${Target.ID}) {
           /varset RV_MyTargetID ${Target.ID}
           /varset RV_MyTargetName ${Target.Name}
           /echo Acquired ${Target.Name} at range ${Int[${Target.Distance}]}
           /varset RV_HasTarget=1
           /return
        }

      /next RV_CurrentRadius
   
/return
Note that it's also trying to cast Spell1 and Spell2. Looks like you have them setup as mob names.

Code: Select all

   /declare Spell1      string outer "A Vex Thal Kraken"
   /declare Spell2      string outer "Ent of Terror"

      /if (${Target.PctHPs}<50) /call cast "${Spell1}"
      /if (${Target.PctHPs}<50) /call cast "${Spell2}"


Misterscout
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 04, 2008 6:09 pm

Re: Macro not working correctly

Post by Misterscout » Wed Feb 16, 2011 1:03 am

Thankyou for all of your help. Now there is a new error with your fix as follows.

/varset failed, variable 'RV_HasTarget=1' not found


What happen when it runs is it finds the target but there is no pursuit to the target.

devNull
a ghoul
a ghoul
Posts: 121
Joined: Sat Mar 06, 2004 3:57 am

Re: Macro not working correctly

Post by devNull » Wed Feb 16, 2011 1:49 pm


Misterscout
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 04, 2008 6:09 pm

Re: Macro not working correctly

Post by Misterscout » Fri Feb 18, 2011 3:45 pm

Perfect that worked.
The macro is running without errors.

But now it doesn't actually move to the target it selects......just targets and says your too far away...

devNull
a ghoul
a ghoul
Posts: 121
Joined: Sat Mar 06, 2004 3:57 am

Re: Macro not working correctly

Post by devNull » Sat Feb 19, 2011 2:16 am

Misterscout wrote:Perfect that worked.
The macro is running without errors.

But now it doesn't actually move to the target it selects......just targets and says your too far away...
The combat sub doesn't have any move to / follow the mob code. All it does it turn attack on and cast some spells. You either need to move the toon yourself, write your own move to / follow code, or donate for VIP and look at some of the plugins that would do what you want.

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

New 4g And 5g Router Sim Website

Post by FrankJScott » Thu Oct 30, 2025 5:18 pm

In reply to the person talking about sierra 4g modem, 4g router with ethernet, sim card wifi router 5g, gsm modem software, rs232 to ethernet ip, router wifi 4g sim card, 4g sim modem, rs232 over wifi, 4g lte sim router, sim in router, router lorawan, 4g iot module, all sim router price, modbus rtu and tcp, 3g 4g modem router, commercial 4g router, lora wan gateway, usr router, serial gsm modem, 4g gprs module, modbus bus, modbus communication, gsm module features, I suggest this great site for 4g and 5g router sim details for rtu tcp converter, rs232 to wifi, modbus tcp standard, usr serial to ethernet, outdoor lte, lte wifi router with sim card slot, 232 to ethernet, gsm module usb, modbus to serial converter, modbus device, 4g router multiple sim cards, dual sim router 5g, 4g modem australia, 4g sim based router, router 5g gsm, router with sim card slot in india, 4g hotspot router with sim card slot, rs485 to tcp, mobile lte modem, modbus to rs485 converter, lte modem with sim card slot, 4g lte modem, 4 sim router, also. See More Cool Vavada Online Casino Tips d1ac75_

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

High Rated FIlm Series Info

Post by FrankJScott » Sat Nov 15, 2025 7:28 am

For the people inquiring about dogma cast, the flight attendant cast, empire strikes back cast, tate donovan movies and tv shows, richard moll movies and tv shows, flyboys cast, theo james movies, cast van jurassic world dominion, cast of v for vendetta, we were soldiers cast, I highly suggest this my explanation about film series url or spirited movie cast, asa butterfield movies and tv shows, laurence fishburne tv shows, sing cast with pictures, mia kirshner movies and tv shows, bad guys cast 2022, jim broadbent films, cars 3 cast, james spader pretty in pink, jesse metcalfe movies and tv shows, not forgetting sites such as this this site about film series tips on top of red white and royal blue cast, crooklyn cast, cast of spider man far from home, them cast, cast deadpool, lucas black movies and tv shows, haunted mansion cast, the survivor cast, james earl jones movies and tv shows, sleeping with the enemy cast, as well as this her latest blog about film series site which is also great. Also, have a look at this updated film series link which is worth considering with the royal nanny cast, dennis haysbert movies and tv shows, haley bennett movies, wanted movie cast, my family movie cast, glass movie cast, the flash 2022 cast, cast of the duke, cast of spiderhead, ryan guzman movies and tv shows, which is worth considering with this great film series site not to mention cast of john wick, cast of crocodile dundee 2, phantasm cast, once upon a time in america cast, top gun 1986 cast, go to the website for as well as lights camera christmas cast, the river cast, paddy considine movies and tv shows, crush movie cast, cast of footloose, for good measure. Check more @ Top Rated 4g And 5g Router Sim Info a61d1ac

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

Top Todaki Women's Massage Website

Post by FrankJScott » Mon Nov 17, 2025 8:51 am

In reply to the person talking about ayurvedic massage for ladies, ladies full massage, ladies hot massage, massage and menopause, leg massage for women, neck massager for women, nice lady massage, female to female body massage, female to male massage spa, ayurvedic ladies massage, massage service female, relax women massage spa, thigh massager, massage spa for female, woman get massage, massage spa near me female, massage from male to female, prenatal massage in third trimester, female body massage therapist near me, head massage for women, I suggest this read more for todaki women's massage forum for body massage male female, female to male body massage, female to female body massage near me, body spa near me female to female, women massage twitter, individual female massage therapist near me, back massage for pregnant woman, personal female massage therapist, female abdominal massage, foot ankle calf massager, female to male massage service at home, male massage for ladies, women hip massage, body massage near me for female, relax women massage spa, female massage near me, ladies spa packages, female to male massage near by me, masseur for ladies, massage for ladies near me, home massage service by female, hot female massage therapist, female to female massage home service, also. See More Top Todaki Women's Massage Info 9a61d1a

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

Cool TAJIR4D Site

Post by FrankJScott » Sun Nov 23, 2025 6:07 pm

In response to the lady inquiring about www sport toto 4d com, toto result singapore pool today, lucky 6d toto number, toto result 2021, toto my favorite number, toto 4d 6 4 2025, carta podium 4d, lotto toto 6 49, lucky hari hari 4d result today, lotto 4d result today, I highly recommend this our site about TAJIR4D LOGIN blog or lucky no 4d today, toto 4d 23 4 2025, toto result 2021, lottomacao, toto 4d 18 6 25, lucky numbers for toto 6 55, toto best number, popular toto numbers, today toto 6d lucky number, frequent toto numbers, as well as this link on TAJIR4D LOGIN advice which is worth considering with lucky number sport toto, toto 4d ticket, 4d toto 6 58, www toto bg lottery, toto 4d 28 5 2025, toto 4d 3 4 2025, lucky no toto today, 6d lucky numbers today, lottomacao, toto 4d 17 7 25, not forgetting sites such as this top TAJIR4D site which is also great. Also, have a look at this recommended TAJIR4D details as well as popular toto numbers, 4d toto number, lotto99, toto best number, sportstoto 4d, lottomax price, 4d toto lucky number today, lotto2sure, toto hot numbers, toto 4d 10 8 25, which is worth considering with this read what he said on TAJIR4D url bearing in mind online toto lotto, lucky perdana 4d, toto 4d 6 4 2025, lottomacao, toto 6d 58, get more information on alongside all lucky number magnum 4d today, 4d 6d lotto, toto 4d 3 4 2025, lotto 4d king live, lucky no toto today, for good measure. Check more @ Recommended TAJIR4D Blog 9a61d1a