Saturday, April 21, 2012

Need help extracting data from DamageMeters

Hi guys. So basically I'm venturing into the world of creating my first custom addon. I've been looking into using Ace2 as the library and basically the premise of the addon is that I want to utilize data from DamageMeters and create an addon that allows me to compare the damage from one weapon to another.

The way I want to go about it, is basically to fight 5 or 10 battles with a certain weapon. After each battle, I wanna save the current damage done and after 10 battles, I wanna average the damage from all the battles. This way, I figure I could get a base damage estimate of each weapon. However, the problem comes from extracting information from DamageMeters. I know it can write to a text file but I was having problems getting that to work.

Does anyone have any advice on how I could possible extract information from DamageMeters in order to use in my addon? Any help would be very much appreciated. Thanks|||(Moved to correct forum.)|||Any Ideas? I would really appreciate some input. Thanks|||I don't know ACE and I don't use Damage Meters. Why don't you just collect data from the combat log and make your own calculations?|||DamageMeters broadcasts data in some form over the addon communication channel so you could probably read what you want out of that. Though the easier method would be to check if DM has any easy get methods in it for the data which you can call. Otherwise hack some in yourself. Arguably easier method again (and probably better for the end user too) is just to parse the combat log yourself as Jumpy suggests.

Started with XML and kinda confused

Hi Guyz. i was trying to make a simple square of pixels in the screen, looking for different ways to dock it. But it seems my Xml files don't work at all. It visualize the square owever it always appear on the left side of the screen even if i told him to anchor on top enter or top right. What's is wrong with this ? Can you help or explain ?

Thank you much in advance.

Arngrim




Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">

<Script file="MyFrame.lua"/>

<Frame name="MyFrame" toplevel="true" frameStrata="BACKGROUND" movable="true" enableMouse="true" hidden="false" parent="UIParent">
<Size>
<AbsDimension x="350" y="100"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<Texture file="Interface\TabardFrame\TabardFrameBackground">
<Size>
<AbsDimension x="350" y="100"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
MyFrame_OnLoad();
</OnLoad>
<OnEvent>
MyFrame_OnEvent();
</OnEvent>
</Scripts>
</Frame>
</Ui>
|||Moved as per the FAQ:
Quote:




Threads about finding, installing, using and troubleshooting mods go in the UI customisation Forum.

Threads about designing, coding and testing mods go in the UI Development Forum.

Threads about other topics should go in the relevant other forum.|||Quote:








Moved as per the FAQ:




Thank you for moving. Sorry to have posted in the wrong place. So anyone up on this ?|||You defined the frame to be moveable in your xml with


Code:
movable="true" enableMouse="true"

so why not complete your script and just move it to where you want it?


Code:
<Scripts>
<OnLoad>
this:RegisterForDrag("LeftButton")
this:SetAlpha(0.8);
</OnLoad>
<OnDragStart>
this:StartMoving();
this.isMoving = true;
</OnDragStart>
<OnDragStop>
this:StopMovingOrSizing();
this.isMoving = false;
</OnDragStop>
</Scripts>
|||Quote:








You defined the frame to be moveable in your xml with


Code:
movable="true" enableMouse="true"

so why not complete your script and just move it to where you want it?


Code:
<Scripts>
<OnLoad>
this:RegisterForDrag("LeftButton")
this:SetAlpha(0.8);
</OnLoad>
<OnDragStart>
this:StartMoving();
this.isMoving = true;
</OnDragStart>
<OnDragStop>
this:StopMovingOrSizing();
this.isMoving = false;
</OnDragStop>
</Scripts>






Basically because i want to let it pop exactly where i need or where i left it the last time the addon reloaded or frame popped. I could try to use the SetPOint() function, but I started brand new and i don't know how to set dynamic variables, and how anchor point are passed. I was wondering to do it later. It's possible that anyone don't know why i can't anchor a new frame exactly where i want ? I need just this information.|||Well here is one thing wrong


Code:
<Anchors>
<Anchor point="TOPLEFT">
</Anchors>

should be


Code:
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>

You left off the / after TOPLEFT

How do I create a button that can be dragged to the action bar ?

Hi,

I'm new to writing WOW AddOns.

I want to create a button that can be dragged to the action bar the same way items from the spell book or the inventory can be dragged and dropped into the action bar.

My question is: can this be done, and if so how ?

Thanks,

San|||You could create a macro that calls an addon. That macro icon could then be placed on the action bar.|||Thanks,

Yes I am aware of that option but that is not what I'm looking to do. For example I did that with SmartBuff, but the macro button does not get updated with the spell image the way the SmarfBuff button does.

I would also like to supply my AddOn with a popup that holds the various buttons so that they can be dragged to the action bars.|||I can't think of any mod that does this but you'd probably be best tryng to pillage someone else's code .|||Yeah I figured as such and run into the same issue myself (can't think of any). So my next thought was: "Find a forum of WOW AddOn authoring experts and ask them to point you in the right direction"...



Let's try a different approach: where will I find the most complete documentation for Blizz's framework objects / API ?|||http://www.wowwiki.com/Interface_Customization|||WowWiki has a decent API.

(EDIT: Jumpy beat me to it .)

Newbie Question: How to detect de-cloak events of monsters?

Hello,

This is my first attempt at an addon for WoW. I intend to develop a simple mod that provides a visual alternative (visual feedback) whenever the de-cloak sound is played ("Sound\\Spells\\Stealth.wav"). My reason: I know a number of players who miss the auditory cue due to a hearing impairment and therefore would appreciate a caption of some sort that communicates the stealth-sound visually.

I spend some time browsing tutorials and http://www.wowwiki.com/World_of_Warcraft_API but so far I haven't figured out how I can detect whether or not this sound file is triggered because of an enemy de-cloaking (like for instance Fen Creepers do - http://wow.allakhazam.com/db/mob.html?wmob=1040). Can anyone help me out?

Thank you!|||I don't think there is a way to detect sound events with the Blizzard API. If there is a message in the combat log about the mob becoming visible then you might be able to use that, but I don't know if there is.|||I just checked the combat log while walking around a Shadowmaw Panther (http://wow.allakhazam.com/db/mob.html?wmob=684) that was cloaking and de-cloaking, but there is nothing in the combat log unfortunately. I was thinking about maybe trying to use Unitfunctions (http://www.wowwiki.com/World_of_Warc...Unit_Functions) if that is possible. Does anyone know if this "cloaking"-behaviour (don't really what else to call it - "invisibility / stealth state"?) can be found using UnitBuff (http://www.wowwiki.com/API_UnitBuff) in some sort of way?

Thank you!|||You might able to do it in 2.3 when all target buffs will show up, but even then it'd still need to be your target/focus or a group member's target/focus (or some combination chain of targets from one of these units). And if it's stealthed then you generally can't target it so that won't really help.|||It may be possible to hook PlaySound(), have it check what sound is being played and do whatever you want if its the stealth sound.

I haven't tried hooking functions before, but this should give you the general idea:


Code:
local oldPlaySound;
function MyAddonLoad()
oldPlaySound = PlaySound;
PlaySound = MyAddonsNewPlaySound;
end
function MyAddonsNewPlaySound(sound)
if sound == "Sound\\Spells\\Stealth.wav" then
DEFAULT_CHAT_FRAME:AddMessage("Someone entered/left stealth!");
end
oldPlaySound(sound);
end

(Note this code is untested, may not work)

This assumes that blizz uses PlaySound() to play the stealth function, which I doubt they do.

Simple - How to identify the target??

Hi, I've searched the wowwiki and even screwed around but I can't seem to find the right variable. Here is some example code of what I'm trying to do:


Code:
if ("target" ==nil) then
WhatsTargetted = "Nothing";
elseif ("target" ~=nil) then
WhatsTargetted = "target"; -- This is what is always run, obviously
end;

if (WhatsTargetted ~="Nothing") then
SendChatMessage("I have you targetted", "WHISPER", this.language, WhatsTargetted);
else
DEFAULT_CHAT_FRAME:AddMessage("Nothing is targetted");
end;

I'm having trouble finding the variable that stores what the player is currently targetting. That same variable should be nil or "" if there is nothing targetted, right?

"target" obviously doesn't seem to be it..

Thanks so much in advance!|||Code:
UnitName("target")

Will return the name of the target (or nil for no target), if this is what you mean.|||Hi,

The solution towards finding out things about your current target is (mainly) the so called WoW unit functions. You can find an excellent summary here:

http://www.wowwiki.com/World_of_Warc...Unit_Functions

Each of these functions returns a specific piece of information about a unit. A unit is identified by a string and the string "target" relates to .... the current target. As mentioned int he privous reply the functions call "UnitName("target")" gives you the name of your current target, or nil if there is no target. As you can see there are some 30 to 40 other functions related to units that you might find useful.

Have a look here to find out what other units are supported by those functions:

http://www.wowwiki.com/UnitId

Skeeve|||Quote:









Code:
UnitName("target")

Will return the name of the target (or nil for no target), if this is what you mean.




This is exactly what I was looking for. Thank you!

Tooltips

Hi,

Could anyone give me a brief explanation of how they work? More specifically, what event tells the tooltip what to display? I can't find any explanation on wowwiki.

Cheers.|||Check out http://www.wowwiki.com/Widget_API#GameTooltip

Basically: You set the text of GameTooltip by GameTooltip:SetText("Title"), append with GameTooltip:AddLine("Some text"); and show it with GameTooltip:Show();|||Thanks Dinnerbone.

But what event triggers tooltips to show up in the game, say when you mouseover a mob or pet etc? And can that event be used in mods?

Cheers.|||In your xml, the OnEnter triggers it.


Code:
<Scripts> 
<OnEnter>
GameTooltip:SetText(text)
</OnEnter>
</Scripts>

http://www.wowwiki.com/API_GameTooltip_SetText

Or you have to hook some Blizzard function such as GameTooltip_ShowCompareItem(). I don't think there is any API event you can use.|||Ok thanks. So there's no way to detect specifically what mob or item in the world is under the mouse cursor? I found
Code:
GetMouseFocus()

but it just returns World frame no matter what the mouse is over.|||I don't know the answer. Maybe if you could describe what you are trying to do with your addon we can better understand what you need. Or maybe not. LOL|||I'm trying to make a basic hunter pet mod that displays extra pet info on the tooltip when you mouse over the pet. I have all the info sorted and can print it to chat or wherever, I just can't work out the tooltip bit. I can write to the tooltip, I just can't work out how to get it to show up specifically when the mouse is over the pet.|||If you look at the PetFrame in the FrameXML you will see


Code:
<OnEnter>
UnitFrame_OnEnter(self);
PartyMemberBuffTooltip:SetPoint("TOPLEFT", this, "TOPLEFT", 60, -35);
PartyMemberBuffTooltip_Update("pet");
</OnEnter>

You can look at the pet Lua and the pet xml here http://wdn.wowinterface.com/latest

You can see where or what function you might want to hook.|||Quote:








Check out http://www.wowwiki.com/Widget_API#GameTooltip

Basically: You set the text of GameTooltip by GameTooltip:SetText("Title"), append with GameTooltip:AddLine("Some text"); and show it with GameTooltip:Show();




Uhm, relatively random intermission here: would I be able to use some of this stuff to remove information from essentially all of my tooltips? Especially things like level and monster type? Maybe even names... though that'd leave awfully little tooltip, heh.

What kind of tooltip are we talking here? What kind of information is controlled by it? All "mouse-over" information? Just NPCs/PCs? What about items and such?|||Thanks guys,

I got it working using the event:


Code:
UPDATE_MOUSEOVER_UNIT

and
Code:
UnitName("mouseover") == UnitName("pet")

to see if my pet was under the cursor. Works nicely :)

English->Spanish Mod translation Offer!!!

Hi everybody, i'm a spanish guy who want to help the mod community, so as i don't own the needed skills to make a mod/addon, at least i can translate them to spanish language (you know, more languages=more potential users=more downloads :P ). If you are interested in my help, just send me a pm and i'll answer as soon as possible.

P.S.- I don't use any automatic-translation software or stuff like that :)|||Quote:








Hi everybody, i'm a spanish guy who want to help the mod community, so as i don't own the needed skills to make a mod/addon, at least i can translate them to spanish language (you know, more languages=more potential users=more downloads :P ). If you are interested in my help, just send me a pm and i'll answer as soon as possible.

P.S.- I don't use any automatic-translation software or stuff like that :)




Hey man, just a suggestion but, have you tried localizing the addons you have? Its actually a pretty decent way to get familiar with code...

They are all text files, you should be able to scan for the english text and write in the replacement text instead. Thats actually not good coding practice, and the code should be properly localized but that is a little more involved and this is something you could start right away. If you offer up your edits to the person who did the addon they might offer it as a seperate version.

And if not, at least you friends will have a spanish version to use.