Thread Tools Display Modes
08-10-12, 11:56 PM   #1
ZopeX
A Murloc Raider
Join Date: Aug 2012
Posts: 6
LUA Newb

Hello im new to LUA and I got a Problem:
Code:
local CharCheckButton = CreateFrame("CheckButton", "CharCheckButton", UIParent, "ChatConfigCheckButtonTemplate");
CharCheckButton:SetPoint("RIGHT", CharFenster);
CharCheckButton.tooltip = "Versteckt das Charakterfenster.";
CharCheckButton:SetFrameStrata("OVERLAY")

local function CheckIt()
local isChecked = CharCheckButton:GetChecked()
if isChecked == 1 then
	PlayerFrame:Hide()
	else
	PlayerFrame:Show()
end
CharCheckButton:SetScript("OnClick", CheckIt)
where is my Mistake?
Edit: Its not working,thats the problem ofc
Edit2: Okay,i see the Button again... i missed an END after IF... but it wont work at all anyway,why?!

Last edited by ZopeX : 08-11-12 at 12:50 AM.
  Reply With Quote
08-11-12, 12:47 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
You're missing another end.

Also, if you're posting code here, please use [ code ] or [ highlight=lua ]
  Reply With Quote
08-11-12, 12:51 AM   #3
ZopeX
A Murloc Raider
Join Date: Aug 2012
Posts: 6
Edit2: Okay,i see the Button again... i missed an END after IF... but it wont work at all anyway,why?!
Originally Posted by p3lim View Post
You're missing another end.
Found that mistake already,wont work anyway
  Reply With Quote
08-11-12, 12:54 AM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
You missed another end, and don't edit your first post that much, if you did some small change most people won't be able to notice it.

Code:
local CharCheckButton = CreateFrame("CheckButton", "CharCheckButton", UIParent, "ChatConfigCheckButtonTemplate");
CharCheckButton:SetPoint("RIGHT", CharFenster);
CharCheckButton.tooltip = "Versteckt das Charakterfenster.";
CharCheckButton:SetFrameStrata("OVERLAY")

local function CheckIt()
	local isChecked = CharCheckButton:GetChecked()
	if isChecked == 1 then
		PlayerFrame:Hide()
	else
		PlayerFrame:Show()
	end
end

CharCheckButton:SetScript("OnClick", CheckIt)
  Reply With Quote
08-11-12, 12:58 AM   #5
ZopeX
A Murloc Raider
Join Date: Aug 2012
Posts: 6
Yeah, havent edited the code after i found the mistake-> i got 2 ends now one for IF and one for function-> it wont work anyway

Okay, thought to post the code over and over will be more crazy than just an edit but im fine with that, now i know that ^^

so:
Code:
local CharCheckButton = CreateFrame("CheckButton", "CharCheckButton", UIParent, "ChatConfigCheckButtonTemplate");
CharCheckButton:SetPoint("RIGHT", CharFenster);
CharCheckButton.tooltip = "Versteckt das Charakterfenster.";
CharCheckButton:SetFrameStrata("OVERLAY")

local function CheckIt()
	local isChecked = CharCheckButton:GetChecked()
	if isChecked == 1 then
		PlayerFrame:Hide()
	else
		PlayerFrame:Show()
	end
end

CharCheckButton:SetScript("OnClick", CheckIt)
wont work(its your changed code) ->The checkbox doesnt do anything
  Reply With Quote
08-11-12, 01:17 AM   #6
ZopeX
A Murloc Raider
Join Date: Aug 2012
Posts: 6
Im that stupid... i stopped the "LUA-Errors" in the interfacemenu.... i turned it on and it told me something is wrong ith my frame strata OVERLAY... i took it away and it works... thx anyway xD
  Reply With Quote
08-11-12, 10:18 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,335
Originally Posted by ZopeX View Post
Im that stupid... i stopped the "LUA-Errors" in the interfacemenu.... i turned it on and it told me something is wrong ith my frame strata OVERLAY... i took it away and it works... thx anyway xD
OVERLAY is a draw layer, not a frame strata. Here's a list of acceptable values for a frame strata.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-12-12, 01:59 AM   #8
ZopeX
A Murloc Raider
Join Date: Aug 2012
Posts: 6
Yeah thank you. After I found my mistake I took a look why it wasnt working and found a page like the one you linked! And just turning on the LUA-Failures should help me alot now

Maybe you can tell me why this isnt working:
Code:
local CharCheckButton = MenueRight:CreateFrame("CheckButton", "CharCheckButton", UIParent, "ChatConfigCheckButtonTemplate");
Its working without MenueRight: but i want to make it a child of "MenueRight" so i can HIDE it whenever it is needed(if i hide the parent) to be hide
  Reply With Quote
08-12-12, 02:13 AM   #9
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
CreateFrame is a function, not a method.

You can do this:
Code:
local CharCheckButton = CreateFrame('CheckButton', 'CharCheckButton', MenueRight, 'ChatConfigCheckButtonTemplate')
  Reply With Quote
08-12-12, 02:16 AM   #10
ZopeX
A Murloc Raider
Join Date: Aug 2012
Posts: 6
AH, Zopex...just open your eyes next time Thanks guys.. i hope i dont have that much questions till I know everything what you guys know
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LUA Newb


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