- Registered User
Member for 13 years, 10 months, and 1 day
Last active Fri, Oct, 4 2013 14:29:42
- 0 Followers
- 125 Total Posts
- 0 Thanks
Oct 4, 2014_ForgeUser30210 posted a message on Attempt to access forbidden object from code tainted by an AddOnGreat, that was exactly what I was looking for.Posted in: Lua Code Discussion
Oct 4, 2014_ForgeUser30210 posted a message on Attempt to access forbidden object from code tainted by an AddOnSince (approximately) 6.0.x some frames are "forbidden". Even looking at them will cause an error. Examples include "StoreFrame".Posted in: Lua Code Discussion
I understand why they are especially protected.
However, when iterating over global variables inevitabley these come up (imho they should not be global if they are forbidden) leading to errors.
Is there a way to detect whether a frame is forbidden without triggering an error?
Edit: The following works/works not
type(StoreFrame) -- table type(StoreFrame.IsObjectType) -- function StoreFrame:IsObjectType() -- error
Sep 13, 2014Thank you very much for this, it is awesome.Posted in: Lua Code Discussion
There is one small issue though: I like to diffentiate between single and double quoted strings. I would like to have different markup for them, but I think this cannot be done right now. Could you include this or tell me how to do it?
Feb 5, 2014I found my mistake... really stupid:Posted in: Lua Code Discussion
Turns out that "UIParent" and UIParent are not equal (we all knew that...).
But unfortunately may check assumed that the relative frame was always a frame, but sometimes it is a string.
Feb 3, 2014Thanks Phanx.Posted in: Lua Code Discussion
I was able to reproduce that indeed UIParent_ManageFramePosition is (at least one of) the cause.
FramerateLabel.SetPoint = function() ... error() ... end
to get a stacktrace.)
I'm still not sure why my approach does not work, but I will give your idea a try.
Feb 2, 2014Using a dual screen setup certain parts of the standard interface are ... very bad placed.Posted in: Lua Code Discussion
I successfully moved the worldscreen to only one screen.
However many things don't follow.
One example is the FramerateLabel (for me I is shown with CTRL+R).
By default it is anchored to BOTTOM, UIPARENT, BOTTOM, 0, 135 which happens to be in the middle (left-right) of the virtual screen. Unfortunately that corresponds to the exact place where the gap between the two physical screens is.
Using (from memory)
FramerateLabel:ClearAllPoints() FramerateLabel:SetPoint('BOTTOM', WorldFrame, 'BOTTOM', 0, 135)
I can move this to a more suitable place.
So far so good.
However after some time the FramerateLabel moves back to the original position. This is what surprises me, because I could not find the cause.
To find it I tried replacing FramerateLabel.SetPoint, but somehow this has not helped me.
What I also know: This happens whenever I have a loading screen. also at some other times. Apparently some Blizzard code resets the anchors. I tried to solve this by replacing SetPoint, but apparently I am doing it wrong.
This is part of my code for the replacement function for SetPoint
if frame:GetName() == "FramerateLabel" then ChatFrame1:AddMessage("A" .. (relativeFrame and relativeFrame.GetName and relativeFrame:GetName() or tostring(relativeFrame))) end local newRelativeFrame = relativeFrame if relativeFrame == UIParent then if frame:GetName() == "FramerateLabel" then ChatFrame1:AddMessage("changing") end newRelativeFrame = WorldFrame else if frame:GetName() == "FramerateLabel" then ChatFrame1:AddMessage("not UIParent, not changing") end end local original = originalSetPoint[frame] assert(original) if frame:GetName() == "FramerateLabel" then ChatFrame1:AddMessage("B" .. (newRelativeFrame and newRelativeFrame.GetName and newRelativeFrame:GetName() or tostring(newRelativeFrame))) end
The strange thing is that I get
not UIParent, not changing
Oct 12, 2013The right image is not a 180° degree, it is either 90° or 270°, proably a typo.Posted in: Lua Code Discussion
These four (0, 90, 180, 270) are all easy. You don't need much code for that.
The non-rectangular angles are a bit more involved. Can you follow the math I posted? If not someone might be willing to do so for you.
Oct 11, 2013So you want to crop a texture, e.g, from to bottom, but only from left to 40%.Posted in: Lua Code Discussion
This is done with:
:SetTexCoord(0, 0.4, 0, 1)
this is equivalent to
:SetTexCoord(0, 0, 0, 1, 1, 0, 0.4, 1)
Unfortunately :SetRotation will probably overwrite this. But please try it.
If you need to do a manual rotation you should first attempt to manually calculate the texture coords for a rotation.
I don't want to do the math right now, please read
Edit: I should point out, that I don't think what you want is possible this way. But unless you give an example picture of what you want I can't be sure.
Oct 11, 2013I am a bit lost. What do you mean by fill? I assumed you mean stretches from border to border. That makes not much sense with rotation.Posted in: Lua Code Discussion
Can you post a picture of what you want vs. what you got?
Also your code is a bit without context. Textures normaly have no field Type or Subtexture.
Oct 11, 2013http://wowprogramming.com/docs/widgets/Texture/SetRotationPosted in: Lua Code Discussion
Maybe thats what you need?
Oct 2, 2013Posted in: Libraries
The point is, smaller libraries are easier to maintain. If blizz adds a new continent (which is probably only a question of time, Astrolabe needs to be changed. The coordinate translation part of LMP would also need to be changed. However the minimap/worldmap pin placement can probably stay the same, that does not depend on the actual zones or zone data.
So splitting this might improve maintanabilty.
The X and Y in percent rather than 0-1 is because users are more familiar with that method. When looking at Mapster, Atlas, or other map, or TomTom, both cursor and player coordinates are given in percentages. It is just my way of keeping things simple.
Maybe. But you should not confuse addon users with library users. The average TomTom user will probably never use your library directly. When defining specification for an API it is more important to care about authors, cause they will use the API. Astrolabe uses the range [0,1] for example.
However, this is not something I feel strongly about. In the end its just a factor 100, as long as it is documented I can work with that.
areaID? What am I not knowing?
Probably we mean the same thing:
http://wowprogramming.com/docs/api/GetCurrentMapAreaID and http://wowpedia.org/MapID are the same. What I meant is we should add a reference, for example these two links, to the documentation so everyone understands what a "mapID" is.
In particular we should point out that is neithera zoneIndex, a mapTextureName nor a localized map name.
I haven't tested to make certain, but that, and similar APIs, I had hoped, would still get applied when PLAYER_ENTERING_WORLD fires when the lib parses WorldMapPins and reattaches the pins to the world map. Of course, if WorldMapPins is wiped out, then all those APIs become rather useless, and can be deleted from the library.
I am pretty sure that after a reload everything is gone from memory.
This API I am not happy with. The idea here was that in MyAddOn, you would indeed be able to find one pin among the possible hundreds or thousands. Something like "find me the repair guy in Shrine of Seven Stars". My goal was being able to hook into the travel system discussed above so you could set a waypoint directly to a single pin. But as I said, I am not happy with how it is turning out.
I see. Well. You want to do a lookup. That makes sense. But I am not sure if thats the right way to do this. I would at least suggest to use another field.
(LibMapMetaData has for example a class field, which is intended for classifying locations).
Also I would think that for most cases an iterate method would be sufficient.
We might also add a wrapper for a map reduce.
However I still think you want to solve too many distinct problems with one library.
I am all ears. There is zero point in writing this if it doesn't work the way people would want it to work.
Its difficult to estimate what people want.
I am personally looking for two things:
A way to transform zone coordinates to continent coordinates (where a continent is the largest area which can be travelled using free movement (including (flying) mounts, swimming, walking, excluding taxi, portals)). For example every instance (dungeon, raid, scenario, battleground, arena, ...) is a continent, as is Pandaria, Kalimdor, Outland, Northrend, The Eastern Kingdoms.
Also the other way round: Given a location, find every map this is in.
For example if you are in stormwing this would return at least a location in Stormwind, Elwynn forest and Eastern Kingdoms.
An easy way to add information from LibMapMetaData to the worldmap and minimap.
These two things do not have to be the same library.
To understand why I need that, let me illustrate what addons I created:
There is GraveLogMap, which is a map addon. It can display icons, lines and areas from LibMapMetaData.
There is MapMetaData_OtherPlayers. It provides icons for the position of your group and guild members (the second using LibGuildPositions).
There is MapMetaData_Quests which provides the locations of quests.
Oct 2, 2013Some questions come to mind.Posted in: Libraries
Why is the Minimap/Worldmap pin handling and the coordinate translation one library?
While pin placement needs coordinate translation to be usefull, coordinate translation does not need to know about pin management.
Personally I would split this into two libraries, at least into two files.
--- Place an icon on the world map frame. -- @paramsig icon, x, y, mapID[,mapFloor] -- @param icon Path to icon file (string) -- @param x Horizontal XX.xx coordinate for the icon (number) -- @param y Vertical YY.yy coordinate for the icon (number) -- @param mapID The mapID (number) -- @param mapFloor The map floor, default 0 (number) optional -- @usage -- Put an icon in Cleft of Shadow, Orgrimmar -- local pin = MyAddOn:CreatePinByMapID(icon, 22.84, 13.56, 321, 1) -- @return pin Shown on the world map, table of input values local function CreatePinByMapID(icon, x, y, mapID, mapFloor)
2.1: I would suggest adding texture coordinates. When trying to reuse existing blizzard POI textures I noticed that many of them have a couple of icons per texture. Without texture coordinates they are unusable.
2.2: why do you specify x and y in percent (i.e, range [0,100]) rather than range [0,1] as Astrolabe does? I think this might cause confusion. In anyway this should be documented more clearly, e.g.:
-- @param x Horizontal XX.xx coordinate for the icon (number in range [0,100] where 0 is the leftmost part of the map and 100 is the rightmost part)
2.3: For y coordinates it should be documented whether 0 is top or bottom.
(For x this is also good, but less necessary, as X generally starts with 0 on the left side)
2.4: You should probably add a reference to areaId for the mapID parameter.
return error(major.. "You cannot attach a pin to this map", 2)
I don't think error ever returns, the return keyword will never be executed.
--- Set a world pin's height. Do not call :SetHeight() directly -- because UI reloads will forget the setting. -- @param pin The world pin to adjust -- @param height Number in pixels local function SetWorldPinHeight(pin, height) local Pin = WorldMapPins[pin] if Pin then Pin.height = height Pin:SetHeight(height) WorldMapPins[pin] = Pin end end
I don't think I get what you are trying to tell me here.
Of course after a reload everything is gone, unless you had savedvariables. But since this is a library, it does not have saved variables.
So what purpose does saving the height have?
--- Hide all world map pins and labels. -- @usage MyAddOn:HideAllWorldPins() local function HideAllWorldPins()
What purpose could this function have? Is it intended to only hide the pins from one addon? (Doesn't look that way)
If not, why should I care about other addon's pins? In fact, it might be annoying if some other addon hides my pins from time to time.
I think this definitely needs to be limited to addon scope.
local function FindWorldIcon(icon)
This is a search by texture. Assuming some addon like Gatherer/GatherMate would use your library, this will, for example, return one copper node per zone.
-- Need to show pins every time player reloads UI -- These are internal functions function lib:PLAYER_ENTERING_WORLD()
Unless I am seriously overlooking something, this is pointless, as WorldMapPins will be an empty table after every reload.
This is totally ok though, your library does not need to store pins, thats the addons responsibility.
In fact it would be awkward if I decide to disable e.g. Gatherer, do a reload, and the ores/herbs wer still there.
I hope you are not overwhelmed with the feedback.
In general I think we need to invest a bit more time defining the purpose and API before implementing stuff.
Sep 30, 2013While phanx is right that it cannot be done easily, or even exact at all, it is, with a lot of work possible to get a general idea.Posted in: Addon Ideas
This is just a rough outline of what should be possible:
You will need a couple of players in the area of your target. This could work in a battleground/raid, but probably not if you are solo.
Every player can get its position and an estimate of the distance to the target.
With this information you could potentially get a rough estimate of the position of the target.
Your position and facing is easy to get, hence you can get the direction to the target.
Sep 30, 2013Also, you might want to have a look at a library I created for my personal use (and did not bother to upload yet as it is still in early stage).Posted in: Libraries
It does not display anything, it just a way for me to transfer data between my data source addons and my map addon. It is completely orthogonal to Astrolabe, and LibMapPins at its current stage.
I am not sure where exactly you want to go with LibMapPins, so this is just to give you an idea what I did.
- To post a comment, please login or register a new account.