-
Posted by xerxes452 on Mon, 03 Aug 2009 06:55:10
In the addon im making for my friends RP tavern, im trying to make a starting frame with 2 buttons, each of which will bring up a different frame for each of the locations and hide the starting frame and stuff on it.
-- Author : ???? -- Create Date : 8/2/2009 8:14:46 PM function StormwindButton_OnClick() StartingFrame.Hide(); StartingText.Hide(); StormwindButton.Hide(); IronforgeButton.Hide(); StormwindButton.Disable(); IronforgeButton.Disable(); StormwindFrame.Show(); StormwindHi.Show(); StormwindMenu.Show(); StormwindBye.Show(); end function IronforgeButton_OnClick() StartingFrame.Hide(); StartingText.Hide(); StormwindButton.Hide(); IronforgeButton.Hide(); StormwindButton.Disable(); IronforgeButton.Disable(); Ironforgeframe.Show(); IronforgeHi.Show(); IronforgeMenu.Show(); IronforgeBye.Show(); end --these are suppost to say the line of code when the button is clicked function StormwindHi_OnClick() CHAT_MSG_SAY("Welcome to the Four Totem Tavern %t. Would you like to sit on the this floor, the top floor or at the bar?"); end function StormwindMenu_OnClick() CHAT_MSG_SAY(""); end function StormwindBye_OnClick() CHAT_MSG_SAY("Good Bye"); CHAT_MSG_SAY("Tell your friends about us"); end function IronforgeHi_OnClick() CHAT_MSG_SAY("Welcome to the Four Totem Tavern %t. Would you like to sit on the this floor, the top floor or at the bar?"); end function IronforgeMenu_OnClick() CHAT_MSG_SAY("hello"); end function IronforgeBye_OnClick() CHAT_MSG_SAY("Good Bye"); CHAT_MSG_SAY("Tell your friends about us"); end
heres the error
Date: 2009-08-03 01:34:06 ID: 1 Error occured in: Global Count: 1 Message: [string "StartingFrame:OnLoad"] line 1: attempt to call global 'Frame1_OnLoad' (a nil value) Debug: (tail call): ?
[string "*:OnLoad"]:1
AddOns:
this is my first addon (not counting the books examples) so im sorry if this seems really obvious
-
Posted by jnwhiteh on Mon, 03 Aug 2009 07:10:52
Somewhere (probably in your XML) you have something calling
Frame1_OnLoad
.. but it isn't defined anywhere. -
Posted by xerxes452 on Mon, 03 Aug 2009 19:30:20
well that got rid of one but now i have 3 Date: 2009-08-03 14:32:31 ID: 1 Error occured in: Global Count: 1 Message: [string "*:OnLoad"] line 1: '=' expected near 'Frame_OnLoad' Debug: (tail call): ? AddOns:
Date: 2009-08-03 14:32:59 ID: 3 Error occured in: Global Count: 1 Message: ..\AddOns\WowAddon1\Frame.lua line 6: Attempt to find 'this' in non-table object (used '.' instead of ':' ?) Debug: (tail call): ? WowAddon1\Frame.lua:6: StormwindButton_OnClick()
[string "*:OnClick"]:1
AddOns: Date: 2009-08-03 14:33:18 ID: 4 Error occured in: Global Count: 1 Message: ..\AddOns\WowAddon1\Frame.lua line 20: Attempt to find 'this' in non-table object (used '.' instead of ':' ?) Debug: (tail call): ? WowAddon1\Frame.lua:20: IronforgeButton_OnClick()
[string "*:OnClick"]:1
AddOns:
-
Posted by jnwhiteh on Mon, 03 Aug 2009 21:24:37
well that got rid of one but now i have 3 Date: 2009-08-03 14:32:31 ID: 1 Error occured in: Global Count: 1 Message: [string "*:OnLoad"] line 1: '=' expected near 'Frame_OnLoad' Debug: (tail call): ? [C]: ? AddOns:
I'm not sure what code is causing this error, I'd have to see whatever code happens with Frame_OnLoad.
Date: 2009-08-03 14:32:59 ID: 3 Error occured in: Global Count: 1 Message: ..\AddOns\WowAddon1\Frame.lua line 6: Attempt to find 'this' in non-table object (used '.' instead of ':' ?) Debug: (tail call): ? [C]: ? [C]: Hide() WowAddon1\Frame.lua:6: StormwindButton_OnClick() [string "*:OnClick"]:1:
[string "*:OnClick"]:1
AddOns: Date: 2009-08-03 14:33:18 ID: 4 Error occured in: Global Count: 1 Message: ..\AddOns\WowAddon1\Frame.lua line 20: Attempt to find 'this' in non-table object (used '.' instead of ':' ?) Debug: (tail call): ? [C]: ? [C]: Hide() WowAddon1\Frame.lua:20: IronforgeButton_OnClick() [string "*:OnClick"]:1:
[string "*:OnClick"]:1
AddOns:
You shouldn't be using this.. but again I need to see the code to know what's going on. you can paste the code at http://pastey.net.
-
Posted by xerxes452 on Mon, 03 Aug 2009 21:43:59
-
Posted by jnwhiteh on Mon, 03 Aug 2009 22:55:45
You're not using methods when you should be .. for example:
function StormwindButton_OnClick() StartingFrame.Hide(); StartingText.Hide(); StormwindButton.Hide(); IronforgeButton.Hide(); StormwindButton.Disable(); IronforgeButton.Disable(); StormwindFrame.Show(); StormwindHi.Show(); StormwindMenu.Show(); StormwindBye.Show(); end
You have to ensure that you change all of those to a colon (:) instead of a period (.). Basically what is happening is you are calling the StartingFrame.Hide function, but your'e not passing any arguments, so it doesn't know what to hide. When you call it StartingFrame:Hide() instead, the frame ia passed as the first argument:
StartingFrame:Hide() basically becomes StartingFrame.Hide(StartingFrame). That way the code know what frame to hide. That's the first big thing I see.
-
Posted by xerxes452 on Mon, 03 Aug 2009 23:46:40
ah thank you im used to Java so some of these things arent what im used to and java used the period