Autoexp.mac -- What's wrong??

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

Moderator: MacroQuest Developers

Fabolous1
a ghoul
a ghoul
Posts: 134
Joined: Sun Jun 27, 2004 12:44 am

Autoexp.mac -- What's wrong??

Post by Fabolous1 » Thu Aug 19, 2004 1:21 pm

Can you please repost what the fixed version looks like. I've been messing around with this forever and can't figure out what...

Code: Select all

|| Autoexp.mac
|  - This macro has been designed to automaticly get you some level's.
|  - By: Fabolous1
||********************************************************************

Sub Main
  |Beginning
    /declare AnchorLoc string outer 0
    /varset AnchorLoc ${Me.Y},${Me.X}
    /echo AnchorLoc ${Me.Y},${Me.X}

  |What we will kill.
    /declare MobLvl1-2 string outer 0
    /varset MobLvl1-2 a sylvan bat

  |Don't worry about these
    /declare InvalidTargetID string outer 0

  |Search and Destroy
  :Acquire
  /if (${Me.PctHPs}<100) /call Rest
  /if (${Me.Level}<=2) /target (${MobLvl1-2}) nopcnear notid ${InvalidTargetID}
  /if (${Target.ID}) { 
               /if (${Int[${Target.PctHPs}]}<100) { 
               /echo Mob NOT at Full Health, picking another... 
               /varset InvalidTargetID ${Target.ID} 
               /goto :Acquire
               }
  /call MoveToMob
/return

Sub MoveToAnchor
/echo Moving to Anchor at Loc: ${AnchorLoc}. 
:AnchorMoveLoop  
    /delay 1
    /doevents
    /face nolook loc ${AnchorLoc}     
    /if (${Math.Distance[${AnchorLoc}]}>12) { 
       /keypress forward hold 
    } else { 
       /keypress forward 
       /return 
    } 
    /goto :AnchorMoveLoop 
/return 

Sub MoveToMob
/echo Acquired ${Target.CleanName} at range ${Int[${Target.Distance}]}
:MovementLoop
/if (${Target.Distance}>12) {
  /face
  /delay 10s
  /keypress forward HOLD
  }
/if (${Target.Distance}<=12)
  /keypress forward
  /echo Attacking ${Target.CleanName}
  /attack on
}
/if (!${Target.ID}) { 
  /attack off 
  /keypress forward 
  /keypress back   
  /return
}
/goto :MovementLoop
/return

Sub Rest
/echo Checking health.
:Rest
/if (${Me.PctHPs}<100) {
  /call MoveToAnchor
  /echo My health is below 100%.
  /if (${Me.Standing}) /sit
  /goto :Rest
}
/return

missingfiles
a hill giant
a hill giant
Posts: 224
Joined: Wed Jun 09, 2004 1:15 pm

Post by missingfiles » Thu Aug 19, 2004 1:28 pm

Found the problem

Code: Select all

By: Fabolous1 
:P

When yuo run this macro what errors are you getting or were is it going wrong? Does it even start? Im at work and cant test it.

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Thu Aug 19, 2004 3:39 pm

Code: Select all

/if (${Me.PctHPs}<100) /call Rest 

...

Sub Rest 
/echo Checking health. 
:Rest 
/if (${Me.PctHPs}<100) { 
seems a little redundant

Code: Select all

/if (${Target.ID}) { 
               /if (${Int[${Target.PctHPs}]}<100) { 
Not sure if Target.PctHPs needs to be typecast.

Code: Select all

/echo Acquired ${Target.CleanName} at range ${Int[${Target.Distance}]}
Same with Target.Distance

Code: Select all

/if (${Target.Distance}>12) { 
  /face 
  /delay 10s 
  /keypress forward HOLD 
  }
If /delay 10s works (not sure it does), you may want to adjust this value. You can cover a LOT of ground in 10s.

Code: Select all

/if (${Target.Distance}<=12) 
  /keypress forward 
  /echo Attacking ${Target.CleanName} 
  /attack on 
You don't face the mob here. There's a good chance you'll walk through him and keep walking (up to 12 units away, at which point, you'll turn around and run into the problem I stated above)

We may be able to help more if you tell us what happens when you try to run the macro (errors, behavior, etc.)

Terramantian
a ghoul
a ghoul
Posts: 120
Joined: Thu May 13, 2004 6:20 pm

Post by Terramantian » Thu Aug 19, 2004 6:48 pm

Mimatas wrote:

Code: Select all

/if (${Target.ID}) { 
               /if (${Int[${Target.PctHPs}]}<100) { 
Not sure if Target.PctHPs needs to be typecast.

Code: Select all

/echo Acquired ${Target.CleanName} at range ${Int[${Target.Distance}]}
Same with Target.Distance
No, but it shouldn't be a problem
Mimatas wrote:

Code: Select all

/if (${Target.Distance}>12) { 
  /face 
  /delay 10s 
  /keypress forward HOLD 
  }
If /delay 10s works (not sure it does), you may want to adjust this value. You can cover a LOT of ground in 10s.
DEFINATELY. Go to an open zone, and press forward in for 10 seconds... see how far you run. Your check is for 12 units.. you can travel five times that in a second easily. Make this 5 or 10 or smaller.


Also a few other things I noticed

Code: Select all

/if (${Me.Level}<=2)
Dunno why you have this.. it'd be better to calculate a level range in your /target to only target light blue or blue mobs. I see what you're doing.. but it'll take a long time to find a single mob for each few levels that's plentiful enough to exp off of. It'd be better to have an array of available mobs, then have it pick a close one within the level range. NBH has an excellent target aquiring system.. might want to look at it.

Code: Select all

    /declare AnchorLoc string outer 0 
    /varset AnchorLoc ${Me.Y},${Me.X} 
    /echo AnchorLoc ${Me.Y},${Me.X}
Does this work??

I'm not sure it'll work as a string... probably.. but it's sloppy imo and you'd be much better off just having a ${AnchorX} and ${AnchorY}.

It makes no allowance for obsticles, or for engaging mobs that have already been taken (between the time you target and when you attack). I'm sure I've missed some things but you have enough to fix for now :p Saying what exactly is wrong would help as well...

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Thu Aug 19, 2004 7:45 pm

Terra is right on almost all counts.
Once you make all of Terra's changes, you'll essentially have
a hunter macro.

I like to reinvent wheels too... Your best bet would be to just take a hunter macro and either manually change the ini every few levels, or mod it to use a new ini every few levels.
Dunno why you have this.. it'd be better to calculate a level range in your /target to only target light blue or blue mobs.
This is also a good idea, except for the fact that some zones have db (or even green) npc's that will kick your ass/kill faction/do other unwanted things. Terra is definitely right about trying to kill one mob though... you may be running all the way across the zone to find a specific mob, when a perfectly acceptable one is right next to you.

Also, I didn't see any unwanted aggro code... send a lv. 1 toon charging across GFay, guaranteed he'll bump into an orc or two... which will likely eat him alive before he makes it to that bat he's been chasing. This would be made even worse if your Rest code were called, unless you set your anchor at a guard. You'd basically sit/get hit/stand/repeat until you finally FD'd, cept without the Feign.

It's not a bad attempt, but I'd recommend you use what's already out there in this case.