Facing & Running to a X & Y Loc ?

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

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Facing & Running to a X & Y Loc ?

Post by bohicaseti » Thu Apr 22, 2004 7:40 am

Can't for the life of me figure out why this doesn't point the character in the right direction for the given X,Y Locs. It used to work fine before the big change, so I'm assuming I'm missing something simple somewhere, but can't put my finger on it. So far it just points out into the middle of the zone somewhere then starts to run mindlessly. Tried searching the forums for the last few hours but can't seem to find any code that works. I'll accept any and all flamage if this turns out to be something screwy on my end, but I'm just lost. :oops:

Code: Select all

#define AnchorX "-500.00"
#define AnchorY "400.00"
/declare AnchorX Global
/declare AnchorY Global

Sub Main


:AnchorMoveLoop 

   /newif (${Me.State.NotEqual[STAND]}) /stand 
   /face nolook loc @AnchorY,@AnchorX
   /newif (${Math.Distance[@AnchorX,@AnchorY]}>5) /keypress forward hold
   /newif (${Math.Distance[@AnchorX,@AnchorY]}<=5) { 
      /keypress forward
      /newif (${Me.State.NotEqual[STAND]}) /stand 
      /face away nolook loc @AnchorX,@AnchorY
      /return 
}
    /goto :AnchorMoveLoop 

/return 
The "/face nolook loc @AnchorY,@AnchorX" line is where its just not doing what it should. Any advice is greatly appreciated. Thank you
Friends help friends move . . . .
Real friends help friends move dead bodies.

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:17 am

You are mixing up your X and Y values.

In game it is y,x,z if you are reading the numbers from left to right that /loc spits out.

The /face loc function expects it in this format:

/face loc y,x


Also, you should be presenting it to Math.Distance as y,x as well.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Thu Apr 22, 2004 11:45 am

Dont worry bohicasti, I'm on your side ;)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Post by bohicaseti » Thu Apr 22, 2004 12:43 pm

ml2517:
I've tried every possible X & Y, /declare, /varset combination that I can think of before posting. It's really rather embarassing that I can't get such a simple thing to work like that but if I posted every example of what I tried (some of it looked just plain commical), this post would prolly be the size of genbot :P
Friends help friends move . . . .
Real friends help friends move dead bodies.

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Thu Apr 22, 2004 1:01 pm

Code: Select all

   /newif (${Me.State.NotEqual[STAND]}) /stand 
   /face nolook loc @AnchorY,@AnchorX 
   /newif (${Math.Distance[@AnchorX,@AnchorY]}>5) /keypress forward hold 
   /newif (${Math.Distance[@AnchorX,@AnchorY]}<=5) { 
      /keypress forward 
      /newif (${Me.State.NotEqual[STAND]}) /stand 
      /face away nolook loc @AnchorX,@AnchorY 
      /return 
  }
Change to..

Code: Select all

     
   /face nolook loc @AnchorY,@AnchorX 
   /if (${Math.Distance[@AnchorY,@AnchorX]}>5) /keypress forward hold 
   /if (${Math.Distance[@AnchorY,@AnchorX]}<=5) { 
      /keypress forward 
      /face away nolook loc @AnchorY,@AnchorX 
      /return 
   }
Should work. Apparently we don't need stand anymore. It does that automatically when you try to move forward while sitting.
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Post by bohicaseti » Thu Apr 22, 2004 1:13 pm

Okay, lets break it down to it's most simple form for the best understanding of the problem. It will not face to the designated /loc. It DOES /face somewhere though. Not sure what it's lookin at in the zone, but it ain't my Y,X loc that I gave it. We'll start with the most basic possible snippet. I tested it with a location that was about 15 feet away to my left (west). My character still just faces out into no mans land.

Code: Select all

#define AnchorX -361.00
#define AnchorY 228.00

Sub Main
   /face nolook loc @AnchorY,@AnchorX
/return
The above does not work. Tried switching out the #define with /varset, putting the loc's in ""s, swapping out X & Y, tried brackets, squigleys, anything else that I could dream up. Won't work. What really burns my hide is that if I manually type in /face nolook loc 228,-361 the damn thing faces correctly. It's mocking me.
Friends help friends move . . . .
Real friends help friends move dead bodies.

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Thu Apr 22, 2004 1:23 pm

Code: Select all

#define AnchorX -361.00 
#define AnchorY 228.00 

Sub Main 
   /face nolook loc @AnchorY,@AnchorX 
   /echo @AnchorY,@AnchorX 
/return 
What does it echo? I can't test it here at work :wink:
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Post by bohicaseti » Thu Apr 22, 2004 1:39 pm

When echo'd it spits out @228.00,@-361.00
So I changed the line to /face nolook loc AnchorY,AnchorX and that did the trick. Thanks a bunch for the simple debug instruction there. Here's the working code. I had to take out all the @'s and that seemed to fix everything. Thanks a bunch for the help guys :D

Code: Select all

#define AnchorX "-361.00"
#define AnchorY "228.00"
/declare AnchorX Global
/declare AnchorY Global

Sub Main


:AnchorMoveLoop 

   /newif (${Me.State.NotEqual[STAND]}) /stand 
   /face nolook loc AnchorY,AnchorX
   /newif (${Math.Distance[AnchorY,AnchorX]}>5) /keypress forward hold
   /newif (${Math.Distance[AnchorY,AnchorX]}<=5) { 
      /keypress forward
      /return 
}
    /goto :AnchorMoveLoop 

/return 
Friends help friends move . . . .
Real friends help friends move dead bodies.

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

Post by Falco72 » Thu Apr 22, 2004 2:03 pm

Are you sure that is working, Bohicaseti?
If you use #define anydef, anydef is NOT a variable, is a constant, so you can not change it during the macro. More, const do not need @ before them, cause it is not a variable. But you can not use a const and a variable with the same name (or am I wrong, Lax?), so I dont think you can use a code like that in a true macro. Also, you can not declare a variable outside a Sub.
For what I know on macros, the code should be:

Code: Select all

Sub Main
   /declare AnchorX global
   /declare AnchorY global
   /varset AnchorX -361
   /varset AnchorY -228

   /face nolook loc @AnchorX,@AnchorY
   /newif (${Math.Distance[@AnchorY,@AnchorX]}>5) /keypress forward hold
   :AnchorMoveLoop
   /face nolook loc @AnchorX,@AnchorY
   /newif (${Math.Distance[@AnchorY,@AnchorX]}<=5) {
      /keypress forward
      /return
   }
   /delay 1
   /goto :AnchorMoveLoop
/endmacro

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Thu Apr 22, 2004 2:40 pm

You could do:

Code: Select all

#define AnchorX "-361.00" 
#define AnchorY "228.00" 

Sub Main 
/declare AnchorX Global 
/declare AnchorY Global 
....
/return
Which is what was done. The last post was just typed hastily I'm sure.
But you are right in that they are a constant.
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Post by bohicaseti » Thu Apr 22, 2004 2:54 pm

Falco72:

Copied and pasted your version and it did what it was doing before. Just starts running out into some magical place in the zone (no where near the defined loc) , I agree with you totally on your logic on the matter, but what I posted earlier is the only way I can get my character to not act like Stevie Wonder and make a bee-line for Hoboken, NJ. ATM I'm having so many other problems with my macro that just getting it to do that is only about 5% of my problem solved. I'm not a programmer so this is all just a hair pulling experience for me. Took me a month to make my original and had it for about 3 days running before the big change, now I'm looking at another month of breaking keyboards and mice. :wink:
Friends help friends move . . . .
Real friends help friends move dead bodies.

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

Post by ml2517 » Thu Apr 22, 2004 3:28 pm

MrSmallie wrote:You could do:

Code: Select all

#define AnchorX "-361.00" 
#define AnchorY "228.00" 

Sub Main 
/declare AnchorX Global 
/declare AnchorY Global 
....
/return
Which is what was done. The last post was just typed hastily I'm sure.
But you are right in that they are a constant.
Actually that'd probably do some pretty strange shit since the define would be replacing the AnchorX and AnchorY in the /declare lines.

Try this:

Code: Select all

#define AnchorX "-500.00" 
#define AnchorY "400.00" 

Sub Main 
:AnchorMoveLoop 

   /if (${Me.State.NotEqual[STAND]}) /stand 
   /face nolook loc AnchorY,AnchorX 
   /if (${Math.Distance[AnchorY,AnchorX]}>5) /keypress forward hold 
   /if (${Math.Distance[AnchorY,AnchorX]}<=5) { 
      /keypress forward 
      /if (${Me.State.NotEqual[STAND]}) /stand 
      /face away nolook loc AnchorY,AnchorX 
      /return 
} 
    /goto :AnchorMoveLoop 

/return 

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Post by bohicaseti » Thu Apr 22, 2004 3:42 pm

ml2517:

hehe Thanks for the effort but when I tried that one, my character decided to run in the opposite direction to no-man's land. I'm not really worried about it anymore cause it seems to work just fine with what I posted earlier (even though it shouldn't? hehe). Right now I'm stuck on trying to get ObstacleChecking working and casting my self BP buff if I don't have it already on me. Figure about 3 or 4 keyboards from now I should have it. :wink:

Thanks again, sorry if I'm throwing a monkey wrench into the logic of things.
Friends help friends move . . . .
Real friends help friends move dead bodies.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

To be correct.

Post by grimjack » Thu Apr 22, 2004 6:22 pm

Code: Select all


Sub Main 
/declare AnchorX Global 
/declare AnchorY Global
/varset AnchorY "228.00"
/varset AnchorX "-361.00"

:AnchorMoveLoop 

   /newif (${Me.State.NotEqual[STAND]}) /stand 
   /face nolook loc @AnchorY,@AnchorX 
   /newif (${Math.Distance[@AnchorY,@AnchorX]}>5) /keypress forward hold 
   /newif (${Math.Distance[@AnchorY,@AnchorX]}<=5) { 
      /keypress forward 
      /return 
} 
    /goto :AnchorMoveLoop 

/return 
#define replaces every instance of a string with something else(hard coded). If you want something that can be updated while the script is running you will want to use variables.

In the original you where replacing every instance of the text AnchorY with 228.00 in the script and every instance of AnchorX with 361.00. This would cause the /declare AnchorY global to translate to /declare 228.00 global and the /declare AnchorX global to /declare -331.00 global. If you are going to hardcode the x/y values you don't need declares or variables at all but if you want something that can be dynamic inside of the script you will want to ditch the #declare statements and switch to what is above.

Oh, and the one that you posted should work as is like you said, it just isn't dynamic and has some things it does not need (like the /declare statements). The reason it works is that it replaces every AnchorX and AnchorY in the script with the hardcoded value you set with the #define.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

User avatar
bohicaseti
a lesser mummy
a lesser mummy
Posts: 33
Joined: Sat Mar 06, 2004 5:55 am

Post by bohicaseti » Thu Apr 22, 2004 7:22 pm

/bow grimjack

Seems like I danced around that as much as was humanly possible. Thanks a bunch for clearing that up and also for the definitions and differences for each of the methods. Definitely nice to learn the hows and why's when getting a chunk of working code. Thanks again grim. :D
Friends help friends move . . . .
Real friends help friends move dead bodies.