/keypress problem

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Meatball
orc pawn
orc pawn
Posts: 14
Joined: Sun Feb 22, 2004 8:39 am

/keypress problem

Post by Meatball » Thu Apr 22, 2004 8:46 am

I've got a sub in one of my scripts that runs back to an anchor points (created when the macro starts) that isn't working. The exact same code that check ${Target.Distance} works fine. When this one runs, autorun isn't getting turned on. Any ideas?

Code: Select all

Sub GotoLoc
   /face loc @AnchorY,@AnchorX
   /keypress autorun
   :GotoLocLoop
   if (${Math.Calc[${Math.Distance[@AnchorY,@AnchorX]}>10]}) {
      /goto :GotoLocLoop
   }
   /keypress back
   /look 0
/return

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Apr 22, 2004 8:57 am

Honestly I'm not sure why /keypress autorun wouldn't work. According to Lax's post of /keypress names that is valid. You should be able to use this though.

Code: Select all

Sub GotoLoc 
   /face loc @AnchorY,@AnchorX 
   /keypress forward hold
   :GotoLocLoop 
   if (${Math.Calc[${Math.Distance[@AnchorY,@AnchorX]}>10]}) { 
      /goto :GotoLocLoop 
   } 
   /keypress forward
   /look 0 
/return 

Meatball
orc pawn
orc pawn
Posts: 14
Joined: Sun Feb 22, 2004 8:39 am

Post by Meatball » Thu Apr 22, 2004 9:02 am

ml2517, I've tried that code too. I added an /echo inside my loop and it's making it inside the loop and never getting out because I'm not moving. I'm baffled by this one since my GotoTarget works exactly the same way and works fine. I've even added a /delay call after the /face to make sure I wasn't having problems because /face wasn't finishing doing it's business. I guess I'll just keep playing with it.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Apr 22, 2004 9:49 am

Dunno, try this:

Code: Select all

Sub GotoLoc 
   /face loc @AnchorY,@AnchorX 
   /keypress forward
   /keypress forward hold 
   :GotoLocLoop 
   if (${Math.Distance[@AnchorY,@AnchorX]}>10) { 
      /goto :GotoLocLoop 
   } 
   /keypress forward 
   /look 0 
/return 
Also, if you don't have the second update that Lax posted to fix /if we are all going to laugh at you. :twisted:

Doesn't sound like that is the issue though.

Shali
a ghoul
a ghoul
Posts: 87
Joined: Sun Dec 07, 2003 12:39 pm

re

Post by Shali » Thu Apr 22, 2004 3:56 pm

may seem obvious, but ive done this before....make sure if you use WASD movement setup that you replace foward with w (im guessing that foward is up arrow key not the movement command) because for me having that setup

Code: Select all

/keypress w hold
works fine