Thread Tools Display Modes
05-29-09, 05:06 PM   #1
Zaxer
A Defias Bandit
Join Date: May 2009
Posts: 3
Im new to WOW Iterface

Hello there,
I have just started to make my own custom addons, I dont know ANYTHING about LUA, but i have this AddOn Studio that i tried, But it just seem to make the XML [design], But i want to learn about LUA. But i script Visual Basic, If that mathers. So if anyone could post a small beginning tutorial/guide, I would really be thankful,
Thanks,

/Zaxer
  Reply With Quote
05-29-09, 05:40 PM   #2
Yhor
A Pyroguard Emberseer
 
Yhor's Avatar
Join Date: May 2007
Posts: 1,077
Last time I used addOn studio it was kind of buggy. There's a lot of information about Lua programming at Lua.org, but if you pretty much just want to learn for making addons, I'd recommend the book http://www.amazon.com/World-Warcraft.../dp/0470229810

I don't think there's a better place to start.
  Reply With Quote
05-29-09, 06:29 PM   #3
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
http://www.wowwiki.com/api
http://www.lua.org/pil/
http://lua-users.org/wiki/TutorialDirectory
http://wowprogramming.com

Are all fantastic reasources, and if you have a question post it up on here or go to the IRC channel (http://www.wowinterface.com/forums/s...ead.php?t=2651) and you'll probably find someone willing to help.
  Reply With Quote
05-29-09, 07:54 PM   #4
Exawatt
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 36
I'm going to echo the other posters: Programming in Lua (and the demo page) was the best introductory guide for me, but I had some programming background...
  Reply With Quote
05-30-09, 02:23 PM   #5
Zaxer
A Defias Bandit
Join Date: May 2009
Posts: 3
Thanks,
Im learning a bit more now.
But i have a problem here,
Im trying to make this just as a test but it doesnt work, It says this:

Well, Here is the code:
Code:
function Frame1.Load
this:RegisterEvent("AddFriend")

function Button1_OnClick()
this:AddFriend("Zaxer")
end
What am i doing wrong?

P.S Can you please give me your MSN so it will be easier to discuss this?

Last edited by Zaxer : 05-30-09 at 02:26 PM.
  Reply With Quote
05-30-09, 03:11 PM   #6
Recluse
A Cliff Giant
 
Recluse's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 70
Originally Posted by Zaxer View Post
Code:
function Frame1.Load
this:RegisterEvent("AddFriend")

function Button1_OnClick()
this:AddFriend("Zaxer")
end
I'm not sure what the rest of the code looks like, but you didn't end the first function for starters. Also, from the error there, it looks like your Button1 doesn't exist yet, so you can't make an OnClick() function for it unless it exists.

Here's some simple code that makes a box on the screen that you can click. You'll have to define what it will do, though. Right now, all it will do is put some text in your chat box to know it is working.

MyAddon.toc:
Code:
## Interface: 30100
## Author: recluse
## Title: MyAddon

MyAddon.lua
MyAddon.lua:
Code:
MyAddon = {}

function MyAddon:AddFriend(name)
	DEFAULT_CHAT_FRAME:AddMessage("Called AddFriend() with tne name "..name)
end

local function Button1_OnClick(button, click)
	MyAddon:AddFriend("Zaxer")
end

do
	MyAddon.Frame1 = CreateFrame("Frame", nil, UIParent)
	MyAddon.Frame1:SetHeight(100); MyAddon.Frame1:SetWidth(100)
	MyAddon.Frame1:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
	MyAddon.Frame1:SetBackdrop({
		bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
		edgeFile = nil, edgeSize = 0,
		insets = {left = 0, right = 0, top = 0, bottom = 0},
	})
	

	MyAddon.Button1 = CreateFrame("Button", nil, MyAddon.Frame1)
	MyAddon.Button1:SetAllPoints(MyAddon.Frame1)
	MyAddon.Button1:RegisterForClicks("AnyUp")
	MyAddon.Button1:SetScript("OnClick", Button1_OnClick)
	MyAddon.Button1:Show()
	
	MyAddon.Frame1:Show()
end
__________________
We'd be together, but only diamonds last forever...
  Reply With Quote
05-30-09, 05:50 PM   #7
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Zaxer View Post
Thanks,
Well, Here is the code:
Code:
function Frame1.Load
this:RegisterEvent("AddFriend")

function Button1_OnClick()
this:AddFriend("Zaxer")
end
What am i doing wrong?

P.S Can you please give me your MSN so it will be easier to discuss this?
"AddFriend" isn't an event, I'm guessing you've got an XML file which must be working, but either your lua file isn't being loaded because it's not referenced in the toc or it's loading and just erroring because of the errors in the code posted above i.e.

Frame1.Load is missing the () and an end to close the function.

As for your request for msn address's, why not just go on IRC?
  Reply With Quote
05-31-09, 01:28 AM   #8
Zaxer
A Defias Bandit
Join Date: May 2009
Posts: 3
Hmm, I use WoWAddOn Studio to create the XML. I just drag the Button to the frame. And then doubleclick it and then this appears in the code:
Code:
function Button1_OnClick()
  --put your event handler logic here
end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Im new to WOW Iterface


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off