I want to add something to my addon that only displays 0-100 yards range, the only thing i found in wow api was functions that return nil or 1. How do i make it so i just have a number on my screen that changes as you move closer and farther. thanks
You may want to look over the Things addons/macros can't do sticky thread. Addons cannot know the exact position of any units other than yourself and your party/raid members, so it's not possible to have an accurate display of the exact distance to arbitrary units. The best you can do is guess by checking whether spells with different ranges are in range, estimating based on how spells go in/out of range as you move, or by triangulating using data communicated by other players using the same addon.
The first addon Jeruku linked is probably your best bet.
__________________ Retired author of too many addons.
Message me if you're interested in taking over one of my addons. Donít message me about addon bugs or programming questions.