All i would like to know if addon studio is good to work with.|||THE CODE
LUA CODE
Code:
-- Author : Josh
-- Create Date : 5/2/2008 3:14:57 PM
function Frame1_OnLoad()
this.RegisterEvnt("PLAYER_TARGET_CHANGED")
end
function Frame1_OnEvent()
if (event == "PLAYER_TARGET_CHANGED") then
FontString:SetText("Hello " .. UnitName("target") .."!");
end
end
function Button1_OnClick()
Frame1:Hide();
end
XML code
Code:
<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="100" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="37" y="-39" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnMouseDown>self:StartMoving();</OnMouseDown>
<OnMouseUp>self:StopMovingOrSizing();</OnMouseUp>
<OnLoad>Frame1_OnLoad();</OnLoad>
<OnEvent>Frame1_OnEvent();</OnEvent>
</Scripts>
<Layers>
<Layer>
<FontString name="FontString1" inherits="GameFontNormalSmall" text="Hello World!">
<Size x="100" y="20" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="48" y="-27" />
</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="Button1" inherits="UIPanelButtonTemplate" text="Close">
<Size x="71" y="20" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="114" y="-65" />
</Anchor>
</Anchors>
<Scripts>
<OnClick>Button1_OnClick();</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>
TOC file
Code:
## X-AutoGenerated: true
## X-GeneratorComment: Basic project properties and project files will be automatically added during deployment. Properties added by the user will be copied without changes.
## Interface: 20300
## Title: MyFirstAddOn
## Notes: Basic WoW Addon
## Author: Josh
## Version: 1.0
Frame.xml
Frame.lua
Plez tell me what wroung|||What does "the text never changed" mean? Can you describe exactly what the issue is?|||Yea the Lable say Hello world and when u click on a tagert it change text to say hello The targets name|||You have some typos. I haven't tested your code, but this is what I saw:
Code:
function Frame1_OnLoad()
this.RegisterEvnt("PLAYER_TARGET_CHANGED")
end
RegisterEvent is spelled wrong. Change it to:
Code:
function Frame1_OnLoad()
this.RegisterEvent("PLAYER_TARGET_CHANGED")
end
Code:
function Frame1_OnEvent()
if (event == "PLAYER_TARGET_CHANGED") then
FontString:SetText("Hello " .. UnitName("target") .."!");
end
end
The FontString object doesn't exist in your addon. In your XML file, you created "FontString1" ... so you need to change this code to:
Code:
function Frame1_OnEvent()
if (event == "PLAYER_TARGET_CHANGED") then
FontString1:SetText("Hello " .. UnitName("target") .."!");
end
end
But even then, I'm unsure if it will find the FontString1 object, so if that doesn't work, try this instead:
Code:
function Frame1_OnEvent()
if (event == "PLAYER_TARGET_CHANGED") then
getglobal("FontString1"):SetText("Hello " .. UnitName("target") .."!");
end
end
With the "Frame1" "Button1" and "FontString1" names, you might run into other addons using the same global names and you might get some unexpected results. But for learning, this should be okay for now. Let me know if these code changes did nothing :)|||Ok ty ill try it to night|||did not seem to work ill load my project file to but here the code
http://rapidshare.com/files/11261483...AddOn.rar.html
LUA CODE:
Code:
-- Author : Josh
-- Create Date : 5/2/2008 3:14:57 PM
function myfram1_OnLoad()
this.RegisterEvent("PLAYER_TARGET_CHANGED")
end
function myfram1_OnEvent()
if (event == "PLAYER_TARGET_CHANGED") then
getglobal("LblTxt"):SetText("Hello " .. UnitName("target") .."!");
end
end
function BtnClose_OnClick()
myfram1:Hide();
end
XML Code:
Code:
<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/">|||Code:
<Script file="Frame.lua" />
<Frame name="myfram1" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
<Size>
<AbsDimension x="200" y="100" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="37" y="-39" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnMouseDown>self:StartMoving();</OnMouseDown>
<OnMouseUp>self:StopMovingOrSizing();</OnMouseUp>
<OnLoad>Frame1_OnLoad();</OnLoad>
<OnEvent>Frame1_OnEvent();</OnEvent>
</Scripts>
<Layers>
<Layer>
<FontString name="LblTxt" inherits="GameFontNormalSmall" text="Hello World!">
<Size x="100" y="20" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="48" y="-27" />
</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="BtnClose" inherits="UIPanelButtonTemplate" text="Close">
<Size x="71" y="20" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="114" y="-65" />
</Anchor>
</Anchors>
<Scripts>
<OnClick>BtnClose_OnClick();</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>
<OnLoad>Frame1_OnLoad();</OnLoad>
<OnEvent>Frame1_OnEvent();</OnEvent>
These functions don't exist. Check your spellings.|||I did not write that code the Program did so idk|||It makes no difference who/what wrote the code, those functions do not exist because they're spelt differently in the Lua.
No comments:
Post a Comment