View Single Post
06-20-10, 06:04 AM   #2
Soulofsin_007
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 125
1.
Code:
Events = CreateFrame("Frame")
Events:SetScript("OnEvent", function(self, event, ...)
     if event == "PLAYER_ENTERING_WORLD" then
         print("Hello"...UnitName("player"))
     end
end)
Events:RegisterEvent("PLAYER_ENTERING_WORLD")
2. Here

3.
Code:
Parent = CreateFrame("Frame", "ParentingFrames", WorldFrame)
Parent:SetWidth(300)
Parent:SetHeight(300)
Parent:SetPoint("CENTER")
Parent:SetBackdrop(StaticPopup1:GetBackdrop())
Parent:EnableMouse(true)
Parent:SetMovable(true)
Parent:Show()
Parent:SetScript("OnMouseDown", function()
  Parent:StartMoving()
end)
Parent:SetScript("OnMouseUp", function()
  Parent:StopMovingOrSizing()
end)


Parent.text = Parent:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
Parent.text:SetPoint("CENTER",25,0)


CheckButton = CreateFrame("CheckButton", "Button2", Parent, "OptionsCheckButtonTemplate") 
CheckButton:SetWidth("25") 
CheckButton:SetHeight("25")
CheckButton:SetPoint("CENTER") 
CheckButton:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up") 
CheckButton:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down") 
CheckButton:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight", "ADD") 
CheckButton:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check") 
CheckButton:Show()

local checkbutton = 0

local function onUpdate(self,elapsed)
    local isChecked = CheckButton:GetChecked()

    
    checkbutton = checkbutton + elapsed
    if checkbutton >= 0.1 then -- how often it checks to see what is checked.
       if(isChecked == 1) then
        Parent.text:SetText("Checked")
        Parent.text:SetPoint("CENTER",35,0)
       else
        Parent.text:SetText("Unchecked")
        Parent.text:SetPoint("CENTER",45,0)
       end
        checkbutton = 0
    end
end

local f = CreateFrame("frame")
f:SetScript("OnUpdate", onUpdate)
4. I didn't see anything were it says what you want your addon to do. Both the lua/xml files are empty
when I open them.

Also the timer part in the end is pry alittle messy, I bet there is a better way to do it. Thats just how I had it saved.

Last edited by Soulofsin_007 : 06-20-10 at 07:53 AM.
  Reply With Quote