View Single Post
07-26-08, 06:03 PM   #6
SydneyBarringer
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 7
And I'm still completely lost.
I've looked through all the stuff you guys have sent me, and, while I have a very basic grasp of it, I'm still completely lost. I attempted to write some of it into my own code, but all it did was break any progress I had made.


The addon I am making is a relatively simple addon that informs you when you have a Na'jentus Spine from High Warlord Na'jentus in BT. The frame that pops up features a hide button, a textstring saying "You have the spine!" and a large button labeled "Throw It!", which should use the spine.

For purposes of testing, I am currently using soul shards as a placeholder item. I was able to make the frame pop up as soon as one obtained a soul shard.

Here is the code I have so far. (A lot of it is borrowed from ESN_Hexer. Most instances where you see ESN_Hexer in this code are going to be replaced.)

NajentusHelper.lua

local f = CreateFrame("Frame","ESN_Hexer_Frame",WorldFrame)
f:SetFrameStrata("BACKGROUND")
f:SetAllPoints(WorldFrame)
f:SetAlpha(0)
f:SetPoint("CENTER",0,0)


f:RegisterEvent("CHAT_MSG_LOOT")


f:SetScript("OnEvent", function(frame, event, name)
if (event == "CHAT_MSG_LOOT") then
if (string.find (arg1, ESN_Hexer_String_YouCreate) and string.find(arg1, ESN_Hexer_String_SoulShard)) then
Frame1:Show();
end
end
end)

function Button2_OnClick()
Frame1:Hide();
end



localization.lua


ESN_Hexer_String_YouCreate = "You create"
ESN_Hexer_String_SoulShard = "Soul Shard"

end



Frame.xml (Before I made any changes to a secure frame)


<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Frame.lua" />
- <Frame name="Frame1" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
- <Size>
<AbsDimension x="200" y="142" />
</Size>
- <Anchors>
- <Anchor point="TOPLEFT">
- <Offset>
<AbsDimension x="100" y="-137" />
</Offset>
</Anchor>
</Anchors>
- <Scripts>
<OnEvent>Frame1_OnEvent()</OnEvent>
<OnMouseDown>self:StartMoving();</OnMouseDown>
<OnMouseUp>self:StopMovingOrSizing();</OnMouseUp>
</Scripts>
- <Layers>
- <Layer>
- <FontString name="FontString1" inherits="GameFontNormalSmall" text="You Have The Spine!">
<Size x="170" y="20" />
- <Anchors>
- <Anchor point="TOPLEFT">
<Offset x="15" y="-45" />
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
- <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
- <BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11" />
</BackgroundInsets>
- <TileSize>
<AbsValue val="32" />
</TileSize>
- <EdgeSize>
<AbsValue val="32" />
</EdgeSize>
</Backdrop>
- <Frames>
- <Button name="Button2" inherits="UIPanelButtonTemplate" text="Hide">
<Size x="53" y="24" />
- <Anchors>
- <Anchor point="TOPLEFT">
<Offset x="132" y="-15" />
</Anchor>
</Anchors>
- <Scripts>
<OnClick>Button2_OnClick();</OnClick>
</Scripts>
</Button>
- <Button name="Button1" inherits="UIPanelButtonTemplate" text="Throw It!">
<Size x="100" y="45" />
- <Anchors>
- <Anchor point="TOPLEFT">
<Offset x="52" y="-71" />
</Anchor>
</Anchors>
</Button>
</Frames>
</Frame>
</Ui>



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

The "Throw It!" button currently has no function.

I would be extremely grateful if someone could give me some pointers regarding where exactly I'm supposed to put
the scripts that make the "Throw It!"button usable. ((E.G. Where am I supposed to set the attributes?))

For now, assume that I am using a Hearthstone as a placeholder for the spine. It'd certainly be a lot easier to test than having to obtain a spine.


Thank you so much for your help so far.
  Reply With Quote