This is like the first few pages of this thread, heres some of the sutff i had found
it was from
http://wow.curse.com/downloads/wow-addo ... m-gps.aspx
i made some psudeo functions with a part of the code
out of proper order -_-
function GetDistance(tarX,tarY, posX,posY)
local v1 = (tarX-posX) * (tarX-posX);
local v2 = (destY-posY) * (destY-posY);
local v3 = 30 * (sqrt((v1 + v2)));
v3 = tonumber(v3,10);
DistanceToTarget = format("%d", v3);
end
posx,posy = whereamI();
function whereamI()
local posX, posY = GetPlayerMapPosition("player");
return posx, posy;
end
---Sendmessage asking for above after sotring our own. then cal GetDistance()
http://www.wowwiki.com/API_GetPlayerMapPositionfor info on that.
also
http://www.wowwiki.com/API_CheckInteractDistancemay be useful
also there is an addon called envrioment emotes that uses something simmiler to what wanted with *low*
http://www.wowinterface.com/downloads/i ... 7-1.3.html
a lib for whoing
http://wow.curse.com/downloads/wow-addo ... holib.aspxget player facing
local radians = GetPlayerFacing()
with it going around
0
-90 90
180
facing < 0 => westward
facing > 0 and facing != 180 => eastward
abs(facing) < 90 => northward
abs(facing) > 90 => southward
can also convert it to
0-360 as
local radians = (-math.pi/180) * (GetPlayerFacing() % 360)
Some most likely non working drycode of getting a yell direction
--after registering the CHAT_MSG_SAY event---
function whereamI()
local posX, posY = GetPlayerMapPosition("player");
return posx, posy;
end
function GetDistance(tarX,tarY, posX,posY)
local v1 = (tarX-posX) * (tarX-posX);
local v2 = (destY-posY) * (destY-posY);
local v3 = 30 * (sqrt((v1 + v2)));
v3 = tonumber(v3,10);
DistanceToTarget = format("%d", v3);---a varible.
end
function MyMod_Say(event, arg1, arg2, arg3)
PrevMsg = arg1;
PrevPlyr = arg2;
PrevLang = arg3;
if string.find(string.lower(prevmsg),"*low*") then --make it lowercase incase they type *Low*
posX,posY = whereamI();--store this for ourselves
SendAddonMessage("Distance",WHISPER,prevPlyr)
--wait for return on thier whereami check
--the returnvalue will have to be sent as tarX,tarY and saved
GetDistance(posX,posY,tarX,tarY)
if distanceTotarget > (some number) then
--we can't hear them, filter it
--add a meesage to the display as an emote that we hear the player mumbler or somesuch...add the language if its said in something other then dfualt
end
end
---CHAT_MSG_YELL on event
function Facing()
local radians = (-math.pi/180) * (GetPlayerFacing() % 360)
--converts the value to 0-360
--0 = north
--90 is east
--180 is south
--270 is west
--to get NE,NW etc we will have to do an if check between values IE > 0 and < 90
--after if/else checks return value as text heading
end
function MyMod_yell(event, arg1, arg2, arg3)
PrevMsg = arg1;
PrevPlyr = arg2;
PrevLang = arg3;
if string.find(string.lower(prevmsg),"*low*") then --make it lowercase incase they type *Low*
posX,posY = whereamI();--store this for ourselves
SendAddonMessage("Distance",WHISPER,prevPlyr)
--wait for return on thier whereami check
--the returnvalue will have to be sent as tarX,tarY and saved
GetDistance(posX,posY,tarX,tarY)
if distanceTotarget > (some number) then
--confirm they did not just yell right next to us...ow my ears
--ask the player for thier facing after getting ours
direction = Facing();
sendaddonmessage(<ask for facing>)
---after we have the info we need to do some complicated checking to compare our direction to thiers, I cannot quite wrap my head around how to identify if they are behind us or not.
--add a message to screen after the yell to the effect of 'it sounds like <name> is yelling from <direction>
end
end
Suggestion: Once we 'see' a player register them to a DB Store if they register as having the addon. that way we can do addon whispers to that player to get location info faster. Possibly have the DB purge itself or the player if not seen for a few days.