Location 120 feet in front of you

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

EQBot_man
a ghoul
a ghoul
Posts: 111
Joined: Mon May 17, 2004 6:35 pm

Location 120 feet in front of you

Post by EQBot_man » Sat Nov 06, 2004 9:36 pm

I did some trig to take inputs based on your location, your heading, and the direction you are looking and this math will give you the location of the point 120 feet from the directiion you are looking:
I added lots of spaces. You don't need the spaces but it made it easier to keep track of the parentheses while I was making the code. You can leave the spaces in. Its not "code" persay, but I've put the information you want to look at in code and /code.

Code: Select all

Y point = ${Math.Calc[  ${Me.Y}+${Math.Calc[ (120 * ${Math.Cos[${Math.Calc[${Me.Look}/128*90]}]}) * ${Math.Cos[90- ${Math.Calc[   90-${Me.Heading.Degrees}   ]}]}     ]}	]}  

X point = ${Math.Calc[  ${Me.X}-${Math.Calc[ (120 * ${Math.Cos[${Math.Calc[${Me.Look}/128*90]}]}) * ${Math.Sin[90- ${Math.Calc[   90-${Me.Heading.Degrees}   ]}]}     ]}	]} 

Z point= ${Math.Calc[    ${Me.Z}   +    ${Math.Calc[    120  *  ${Math.Sin[${Math.Calc[${Me.Look}/128*90]}]}      ]}     ]}
Also if you want to change the value of the calculation smaller or larger, change the 120 to whatever you wish. I suggest 20, and 130 units.

Just posted it in case someone could use it in any of their macros or whatever. Heh..took me a while to work out the proper math and test it so there you go.

|------------------------------------------------------------------
Here is something else you all might feel useful

Code: Select all

Locations are X Y Z format

location 10 feet north of you:  ${Math.Calc[${Me.Y}+10]} ${Me.X} ${Math.Calc[${Me.Z}+1]}
location 10 feet southof you:  ${Math.Calc[${Me.Y}-10]} ${Me.X} ${Math.Calc[${Me.Z}+1]}
location 10 feet east of you:  ${Me.Y} ${Math.Calc[${Me.X}-10]} ${Math.Calc[${Me.Z}+1]}
location 10 feet west of you:  ${Me.Y} ${Math.Calc[${Me.X}+10]} ${Math.Calc[${Me.Z}+1]}
location 10 feet up from you:  ${Me.Y} ${Me.X} ${Math.Calc[${Me.Z}+10]}
location 10 feet down from you:  ${Me.Y} ${Me.X} ${Math.Calc[${Me.Z}-10]}
I've added +1 unit N, E, S W, for reasons of practical use. Again. if you want smaller values or larger values change the 10's to whatever. I suggest 10 and 100
Last edited by EQBot_man on Mon Dec 06, 2004 10:44 pm, edited 3 times in total.

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Sun Nov 07, 2004 2:44 am

Not sure how it could be used, maybe for checking spawns so many meters in front of you, but hey, nice job :wink:

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Sun Nov 07, 2004 3:17 am

Mobs within casting range I'm fairly certain, but wait til he upgrades his spell range to 25 or 30%.

OMG the math!

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Sun Nov 07, 2004 1:02 pm

Yeah but casting range is radius, not just X feet in the direction your facing :P

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Sun Nov 07, 2004 7:06 pm

It allows targeting of spawns that are in front of you, in your natural FOV.
Opinions are like assholes, everyone has one, but most of them stink.

EQBot_man
a ghoul
a ghoul
Posts: 111
Joined: Mon May 17, 2004 6:35 pm

Post by EQBot_man » Wed Nov 17, 2004 6:20 pm

Yeah not exactly what I had in mind but I'll give you 2 hints:
--------------------------------------
Hint #1
if one wanted to know the location 120 feet in front of them from a custombind:

Code: Select all

/Custombind add location 

/Custombind set location /echo ${Math.Calc[  ${Me.Y}+${Math.Calc[ (120 * ${Math.Cos[${Math.Calc[${Me.Look}/128*90]}]}) * ${Math.Cos[90- ${Math.Calc[   90-${Me.Heading.Degrees}   ]}]}     ]}	]}  ${Math.Calc[  ${Me.X}-${Math.Calc[ (120 * ${Math.Cos[${Math.Calc[${Me.Look}/128*90]}]}) * ${Math.Sin[90- ${Math.Calc[   90-${Me.Heading.Degrees}   ]}]}     ]}	]} ${Math.Calc[    ${Me.Z}   +    ${Math.Calc[    120  *  ${Math.Sin[${Math.Calc[${Me.Look}/128*90]}]}      ]}     ]}

/bind location e
This would output something like:
340.39 2395 34.1
everytime you pressed e.

-----------------------------------

Hint #2
Make sure you are levitating

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Wed Nov 17, 2004 11:52 pm

some of us get it, and thanks ;)

EQBot_man
a ghoul
a ghoul
Posts: 111
Joined: Mon May 17, 2004 6:35 pm

Post by EQBot_man » Thu Nov 18, 2004 12:39 pm

ok good, glad some people could get use out of it

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Thu Nov 18, 2004 3:15 pm

Either it's something very simple, or it's a place I don't go/don't have access to. /shrug

fantum409
a ghoul
a ghoul
Posts: 141
Joined: Fri Nov 14, 2003 10:03 pm

Post by fantum409 » Mon Nov 22, 2004 6:20 pm

Now if you make it calculate the proper Z coordinate to indicate ground level on changing terrain...

Lord_Vyper
a hill giant
a hill giant
Posts: 169
Joined: Sat Sep 25, 2004 1:57 am

Post by Lord_Vyper » Mon Nov 22, 2004 6:27 pm

Ever stare at code for a minute or 3, then CLICK! I feel slightly smarter now. Thanks bot_man

EQBot_man
a ghoul
a ghoul
Posts: 111
Joined: Mon May 17, 2004 6:35 pm

Post by EQBot_man » Mon Nov 22, 2004 7:07 pm

Now if you make it calculate the proper Z coordinate to indicate ground level on changing terrain...
Now that would be $.. but can't do that I don't beleive

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Mon Nov 22, 2004 10:21 pm

Ever stare at code for a minute or 3, then CLICK! I feel slightly smarter now. Thanks bot_man
it's worth it if for no other reason than that :)

Neolesh
a hill giant
a hill giant
Posts: 231
Joined: Mon Aug 23, 2004 11:15 am

Post by Neolesh » Mon Nov 22, 2004 11:25 pm

Would it be hard to convert this to 120 feet behind your target? I'm bad with this level of math.

EQBot_man
a ghoul
a ghoul
Posts: 111
Joined: Mon May 17, 2004 6:35 pm

Post by EQBot_man » Tue Nov 30, 2004 6:12 pm

nt
Last edited by EQBot_man on Fri Dec 03, 2004 12:05 am, edited 1 time in total.