I feel crazy but i can t find the bug
Bugsack says in Localization.lua:16 unexpected symbol near '='
and in BattleGrounds.lua:6 attempt to index local 'L' (a nil value) and
BattleGrounds.lua:6 in main chunk
I have made all other suggestion that you told me too but i dont know how it works until i have solved this issue.
My BattleGrounds.lua file is used by BattleGrounds.xml when i click an icon in the Frame. Soo i was thinking if my <OnClick> event goes direct too that function in code and not read whole BattleGrounds.lua file. Then i maybe have too put code in BattleGrounds.xml. Can i put it in the beginning (1 time) or in <OnLoad> then i have to do it 4 times. I have 4 frames that load different depends on what bg you enter.
I will send you all files too
--------------------------------
BGCallouts.toc
## Interface: 60000
## Title: BGCallouts
## Version: 3.0
## Author: Txty
## Notes: Calls out if a base needs help or is safe in 'Arathi Basin', 'Deewind Gorge', 'The Battle for Gilneas and 'Eye of the Storm'.
BGCallouts.show = function()
ArathiBasin:Show(true)
DeepwindGorge:Show(true)
Gilneas:Show(true)
EotStorm:Show(true)
return
end
BGCallouts.hide = function()
ArathiBasin:Hide(true)
DeepwindGorge:Hide(true)
Gilneas:Hide(true)
EotStorm:Hide(true)
return
end
BGCallouts.func = function(self, msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") or (msg=="Arathibecken") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") or (msg=="Tiefenwindschlucht") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") or (msg=="Die Schlacht um Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") or (msg=="Auge des Sturms") then
EotStorm:Show(true)
else
BGCallouts:hide()
end
return
end
-- Slash commands
SLASH_BGC1 = "/BGCallouts"
SlashCmdList["BGC"] = function (msg)
if (msg=="show") then
BGCallouts:show()
elseif (msg=="hide") then
BGCallouts:hide()
else
BGCallouts:Print("Only works with 'show' or 'hide'.")
end
end
function BGCallouts:OnInitialize()
-- Called when the addon is loaded
-- Print a message to the chat frame
BGCallouts:Print("Loaded")
end
function BGCallouts:OnEnable()
-- Called when the addon is enabled
-- Print a message to the chat frame
self:Print("OnEnable Event Fired: Hello, again ;)")
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
BGCallouts:func(GetZoneText())
end
function BGCallouts:OnDisable()
-- Called when the addon is disabled
end
function BGCallouts:ZONE_CHANGED()
BGCallouts:func(GetZoneText())
end
-- addon nme = BGCallouts.lua
-- file name = Battlegrounds.lua
-- and i have localization. lua
local m=L["needs help!!!"]
local n=L["is safe."]
local s="{skull}"
local t="{triangle}"
local o=" "
-- Arathi Basin
function Blacksmith_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Blacksmith"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Blacksmith"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Farm_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Farm"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Farm"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Lumbermill_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Lumbermill"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Lumbermill"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Mine_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Stable_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Stable"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Stable"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
-- Deepwind Gorge
function Pandaren_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Pandaren Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Pandaren Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Center_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Center Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Center Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Goblin_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Goblin Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Goblin Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
-- Eye of the Sorm
function FelReaver_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Fel Reaver ruins"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Fel Reaver ruins"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function MageTower_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Mage tower"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Mage tower"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Draenei_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Draenei ruins"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Draenei ruins"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function BloodElf_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Blood Elf tower"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Blood Elf tower"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
-- The Battle for Gilneas
function Mine2_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Lighthouse_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Lighthouse"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Lighthouse"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Waterworks_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Waterworks"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Waterworks"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
---------------------------------------------
Localization.lua
local _, namespace = ...
local L = setmetatable({}, { __index = function(t, k)
local v = tostring(k)
rawset(t, k, v)
return v
end })
namespace.L = L
local LOCALE = GetLocale()
if LOCALE:match("^en") then
return end
if LOCALE == "deDE" then
-- German translations go here
L["needs help!!!"] = "braucht Hilfe!!!",
L["is safe."] = "ist wieder sicher.",
L["Blacksmith"] = "Schmiede",
L["Farm"] = "Hof",
L["Lumbermill"] = "Sägewerk",
L["Mine"] = "Mine",
L["Stable"] = "Stall",
L["Pandaren Mine"] = "Pandaren Mine",
L["Center Mine"] = "Mittlere Mine",
L["Goblin Mine"] = "Goblin Mine",
L["Fel Reaver ruins"] = "Teufelshäscherruine",
L["Mage tower"] = "Magierturm",
L["Draenei ruins"] = "Draeneiruine",
L["Blood Elf tower"] = "Turm der Blutelfen",
L["Lighthouse"] = "Leuchtturm",
L["Waterworks"] = "Wasserwerk",
return end
if LOCALE == "frFR" then
-- French translations go here
L["Hello!"] = "Bonjour!"
return end
a noobish question
should i replace ADDON_NAME with name of addon or with filename where i use it and should i have any ".lua" extension and should it then all be capitals or is it good as it is?
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
local ADDON_NAME, namespace = ...
local L = namespace.L
-- addon nme = BGCallouts.lua
-- file name = Battlegrounds.lua
-- and i have localization. lua
Hi
i made changes following that guide but i cant get it work
"attempt to index local 'L' (a nil value)"
Localization.lua
local _, namespace = ...
local L = setmetatable({}, { __index = function(t, k)
local v = tostring(k)
rawset(t, k, v)
return v
end })
namespace.L = L
local LOCALE = GetLocale()
if LOCALE:match("^en") then
return end
if LOCALE == "deDE" then
-- German translations go here
L["needs help!!!"] = "braucht Hilfe!!!",
L["is safe."] = "ist wieder sicher.",
L["Blacksmith"] = "Schmiede",
L["Farm"] = "Hof",
...
and BattleGrounds.lua
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
local ADDON_NAME, namespace = ...
local L = namespace.L
-- addon nme = BGCallouts.lua
-- file name = Battlegrounds.lua
-- and i have localization. lua
local m=(L["needs help!!!"])
local n=(L["is safe."])
local s="{skull}"
local t="{triangle}"
local o=" "
-- Arathi Basin
function Blacksmith_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=(L["Blacksmith"]); SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
....
and main file is BGCallouts.lua but there is no code writing to chat there.
I try use a metatable as a language selector for my addon. I have tried alot and i am stuck. I dont really understand this with metatable. However on row 118 i think i try to print out and it fails.
ex self:Print(L.[" Blacksmith"])
i want it to print out " Schmeide". Can you see what i messed up with in this addon?
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
BGCallouts = LibStub("AceAddon-3.0"):NewAddon("BGCallouts", "AceConsole-3.0", "AceEvent-3.0" );
-- Language ----------------------------------------------------------------------------
BGCallouts.language = function (self, locale)
if locale == "deDE" then
setmetatable({
[" Blacksmith"] = " Schmiede",
[" needs help!!!"] = " braucht Hilfe!!!",
[" is safe."] = " ist wieder sicher.",
[" Farm"] = " Hof",
[" Lumbermill"] = " Sägewerk",
[" Mine"] = " Mine",
[" Stable"] = " Stall",
[" Pandaren Mine"] = " Pandaren Mine",
[" Center Mine"] = " Mittlere Mine",
[" Goblin Mine"] = " Goblin Mine",
[" Fel Reaver ruins"] = " Teufelshäscherruine",
[" Mage tower"] = " Magierturm",
[" Draenei ruins"] = " Draeneiruine",
[" Blood Elf tower"] = " Turm der Blutelfen",
[" Lighthouse"] = " Leuchtturm",
[" Waterworks"] = " Wasserwerk",
},
{
__index = function(L, index)
return index
end
})
else
setmetatable({
[" Blacksmith"] = " Schmeide",
[" needs help!!!"] = " needs help!!!",
[" is safe."] = " is safe.",
[" Farm"] = " Farm",
[" Lumbermill"] = " Lumbermill",
[" Mine"] = " Mine",
[" Stable"] = " Stable",
[" Pandaren Mine"] = " Pandaren Mine",
[" Center Mine"] = " Center Mine",
[" Goblin Mine"] = " Goblin Mine",
[" Fel Reaver ruins"] = " Fel Reaver ruins",
[" Mage tower"] = " Mage tower",
[" Draenei ruins"] = " Draenei ruins",
[" Blood Elf tower"] = " Blood Elf tower",
[" Lighthouse"] = " Lighthouse",
[" Waterworks"] = " Waterworks",
},
{
__index = function(L, index)
return index
end
})
end
end
---------------------------------------------------------------------------------------
BGCallouts.show = function()
ArathiBasin:Show(true)
DeepwindGorge:Show(true)
Gilneas:Show(true)
EotStorm:Show(true)
return
end
BGCallouts.hide = function()
ArathiBasin:Hide(true)
DeepwindGorge:Hide(true)
Gilneas:Hide(true)
EotStorm:Hide(true)
return
end
BGCallouts.func = function(self, msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") or (msg=="Arathibecken") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") or (msg=="Tiefenwindschlucht") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") or (msg=="Die Schlacht um Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") or (msg=="Auge des Sturms") then
EotStorm:Show(true)
else
BGCallouts:hide()
end
return
end
-- Slash commands
SLASH_BGC1 = "/BGCallouts"
SlashCmdList["BGC"] = function (msg)
if (msg=="show") then
BGCallouts:show()
elseif (msg=="hide") then
BGCallouts:hide()
else
BGCallouts:Print("Only works with 'show' or 'hide'.")
end
end
function BGCallouts:OnInitialize()
-- Called when the addon is loaded
-- Print a message to the chat frame
BGCallouts:Print("Loaded")
end
function BGCallouts:OnEnable()
-- Called when the addon is enabled
-- Print a message to the chat frame
self:Print("OnEnable Event Fired: Hello, again ;)")
self:Print(GetLocale())
L = {}
--local mt = { __index = L }
BGCallouts:language(GetLocale())
self:Print(L.[" Blacksmith"])
self:Print("---------------")
self:Print(mt)
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
BGCallouts:func(GetZoneText())
end
function BGCallouts:OnDisable()
-- Called when the addon is disabled
end
function BGCallouts:ZONE_CHANGED()
BGCallouts:func(GetZoneText())
end
function BGCallouts:ZONE_CHANGED_NEW_AREA()
BGCallouts:func(GetZoneText())
end
I have made a lot of changes and now i get error
attempt to call method 'BGCallouts_func' (a nil value)
If i get it right the function cant be found so i must have made a fail in how to declare the function i guess . Can i get a hint what i missed and why function has a nil value?
function BGCallouts:ZONE_CHANGED_NEW_AREA()
self:BGCallouts_func(GetZoneText()) -- error
end
....
local function BGCallouts_func(msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") then
EotStorm:Show(true)
else
self:BGCallouts_hide()
end
return
end
I have made a lot of changes and now i get error
attempt to call method 'BGCallouts_func' (a nil value)
If i get it right the function cant be found so i must have made a fail in how to declare the function i guess . Can i get a hint what i missed and why function has a nil value?
function BGCallouts:ZONE_CHANGED_NEW_AREA()
self:BGCallouts_func(GetZoneText()) -- error
end
....
local function BGCallouts_func(msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") then
EotStorm:Show(true)
else
self:BGCallouts_hide()
end
return
end
-- Slash commands
SLASH_BGC1 = "/BGCallouts"
SlashCmdList["BGC"] = function (msg)
if (msg=="show") then
BGCallouts:show()
elseif (msg=="hide") then
BGCallouts:hide()
else
BGCallouts:Print("Only works with 'show' or 'hide'.")
end
end
function BGCallouts:OnInitialize()
-- Called when the addon is loaded
-- Print a message to the chat frame
self:Print("Loaded")
end
function BGCallouts:OnEnable()
-- Called when the addon is enabled
-- Print a message to the chat frame
self:Print("OnEnable Event Fired: Hello, again ;)")
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:func(GetZoneText())
end
function BGCallouts:ZONE_CHANGED()
self:func(GetZoneText())
end
function BGCallouts:ZONE_CHANGED_NEW_AREA()
self:func(GetZoneText())
end
function BGCallouts:show()
ArathiBasin:Show(true)
DeepwindGorge:Show(true)
Gilneas:Show(true)
EotStorm:Show(true)
return
end
function BGCallouts:hide() ----- LINE 50------
ArathiBasin:Hide(true)
DeepwindGorge:Hide(true)
Gilneas:Hide(true)
EotStorm:Hide(true)
return
end
function BGCallouts:func(msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") then
EotStorm:Show(true)
else
self:hide()
end
return
end
function BGCallouts:OnDisable()
-- Called when the addon is disabled
end
0
0
L["is safe."] = "ist wieder sicher.",
0
Bugsack says in Localization.lua:16 unexpected symbol near '='
and in BattleGrounds.lua:6 attempt to index local 'L' (a nil value) and
BattleGrounds.lua:6 in main chunk
I have made all other suggestion that you told me too but i dont know how it works until i have solved this issue.
0
0
I want too thank you for helping me out.
My BattleGrounds.lua file is used by BattleGrounds.xml when i click an icon in the Frame. Soo i was thinking if my <OnClick> event goes direct too that function in code and not read whole BattleGrounds.lua file. Then i maybe have too put code in BattleGrounds.xml. Can i put it in the beginning (1 time) or in <OnLoad> then i have to do it 4 times. I have 4 frames that load different depends on what bg you enter.
I will send you all files too
--------------------------------
BGCallouts.toc
## Interface: 60000
## Title: BGCallouts
## Version: 3.0
## Author: Txty
## Notes: Calls out if a base needs help or is safe in 'Arathi Basin', 'Deewind Gorge', 'The Battle for Gilneas and 'Eye of the Storm'.
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceAddon-3.0\AceAddon-3.0.xml
Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceEvent-3.0\AceEvent-3.0.xml
Localization.lua
BattleGrounds.xml
BGCallouts.lua
----------------------------------
BGCallouts.lua
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
BGCallouts = LibStub("AceAddon-3.0"):NewAddon("BGCallouts", "AceConsole-3.0", "AceEvent-3.0" );
BGCallouts.show = function()
ArathiBasin:Show(true)
DeepwindGorge:Show(true)
Gilneas:Show(true)
EotStorm:Show(true)
return
end
BGCallouts.hide = function()
ArathiBasin:Hide(true)
DeepwindGorge:Hide(true)
Gilneas:Hide(true)
EotStorm:Hide(true)
return
end
BGCallouts.func = function(self, msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") or (msg=="Arathibecken") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") or (msg=="Tiefenwindschlucht") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") or (msg=="Die Schlacht um Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") or (msg=="Auge des Sturms") then
EotStorm:Show(true)
else
BGCallouts:hide()
end
return
end
-- Slash commands
SLASH_BGC1 = "/BGCallouts"
SlashCmdList["BGC"] = function (msg)
if (msg=="show") then
BGCallouts:show()
elseif (msg=="hide") then
BGCallouts:hide()
else
BGCallouts:Print("Only works with 'show' or 'hide'.")
end
end
function BGCallouts:OnInitialize()
-- Called when the addon is loaded
-- Print a message to the chat frame
BGCallouts:Print("Loaded")
end
function BGCallouts:OnEnable()
-- Called when the addon is enabled
-- Print a message to the chat frame
self:Print("OnEnable Event Fired: Hello, again ;)")
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
BGCallouts:func(GetZoneText())
end
function BGCallouts:OnDisable()
-- Called when the addon is disabled
end
function BGCallouts:ZONE_CHANGED()
BGCallouts:func(GetZoneText())
end
function BGCallouts:ZONE_CHANGED_NEW_AREA()
BGCallouts:func(GetZoneText())
------------------------------------------
BattleGrounds.xml
<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="BattleGrounds.lua" />
<Frame name="ArathiBasin" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
<Size x="67" y="252" />
<Anchors>
<Anchor point="CENTER">
<Offset x="-67" y="-26" />
</Anchor>
</Anchors>
<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="Blacksmith" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-105" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Blacksmith_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\blacksmith.tga" />
</Button>
<Button name="Farm" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-13" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Farm_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\farm.tga" />
</Button>
<Button name="Lumbermill" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-59" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Lumbermill_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\lumbermill.tga" />
</Button>
<Button name="Mine" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-151" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Mine_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\mine.tga" />
</Button>
<Button name="Stable" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-196" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Stable_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\stable.tga" />
</Button>
</Frames>
<Scripts>
<OnLoad>
Blacksmith:RegisterForClicks("AnyUp");
Farm:RegisterForClicks("AnyUp");
Lumbermill:RegisterForClicks("AnyUp");
Mine:RegisterForClicks("AnyUp");
Stable:RegisterForClicks("AnyUp");
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
self:StartMoving();
</OnDragStart>
<OnDragStop>
self:StopMovingOrSizing();
</OnDragStop>
</Scripts>
</Frame>
<Frame name="DeepwindGorge" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
<Size x="64" y="160" />
<Anchors>
<Anchor point="CENTER">
<Offset x="-67" y="-1" />
</Anchor>
</Anchors>
<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="Center" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="AnyUp">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-59" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Center_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\BGCallouts\Icons\center.tga" />
</Button>
<Button name="Goblin" inherits="UIPanelButtonTemplate" enableMouse="true" propagateKeyboardInput="true" text="" registerForClicks="AnyUp">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-105" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Goblin_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\BGCallouts\Icons\goblin.tga" />
</Button>
<Button name="Pandaren" inherits="UIPanelButtonTemplate" enableMouse="true" text="" registerForClicks="AnyUp">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-13" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Pandaren_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\BGCallouts\Icons\pandaren.tga" />
</Button>
</Frames>
<Scripts>
<OnLoad>
Pandaren:RegisterForClicks("AnyUp");
Center:RegisterForClicks("AnyUp");
Goblin:RegisterForClicks("AnyUp");
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
self:StartMoving();
</OnDragStart>
<OnDragStop>
self:StopMovingOrSizing();
</OnDragStop>
</Scripts>
</Frame>
<Frame name="EotStorm" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
<Size x="63" y="207" />
<Anchors>
<Anchor point="CENTER">
<Offset x="-67" y="-3" />
</Anchor>
</Anchors>
<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="FelReaver" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-13" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
FelReaver_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\felreaver.tga" />
</Button>
<Button name="MageTower" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-59" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
MageTower_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\magetower.tga" />
</Button>
<Button name="Draenei" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-105" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Draenei_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\draenei.tga" />
</Button>
<Button name="BloodElf" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-151" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
BloodElf_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\bloodelf.tga" />
</Button>
</Frames>
<Scripts>
<OnLoad>
FelReaver:RegisterForClicks("AnyUp");
MageTower:RegisterForClicks("AnyUp");
Draenei:RegisterForClicks("AnyUp");
BloodElf:RegisterForClicks("AnyUp");
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
self:StartMoving();
</OnDragStart>
<OnDragStop>
self:StopMovingOrSizing();
</OnDragStop>
</Scripts>
</Frame>
<Frame name="Gilneas" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
<Size x="66" y="157" />
<Anchors>
<Anchor point="CENTER">
<Offset x="-66" y="22" />
</Anchor>
</Anchors>
<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="Mine2" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-13" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Mine2_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\mine.tga" />
</Button>
<Button name="Lighthouse" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-59" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Lighthouse_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\lighthouse.tga" />
</Button>
<Button name="Waterworks" inherits="UIPanelButtonTemplate" enableMouse="true" text="">
<Size x="40" y="40" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="15" y="-105" />
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="1" right="1" top="1" bottom="1" />
</HitRectInsets>
<Scripts>
<OnClick>
Waterworks_OnClick()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\BGCallouts\Icons\waterworks.tga" />
</Button>
</Frames>
<Scripts>
<OnLoad>
Mine2:RegisterForClicks("AnyUp");
Lighthouse:RegisterForClicks("AnyUp");
Waterworks:RegisterForClicks("AnyUp");
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
self:StartMoving();
</OnDragStart>
<OnDragStop>
self:StopMovingOrSizing();
</OnDragStop>
</Scripts>
</Frame>
</Ui>
----------------------------------
BattleGrounds.lua
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
local ADDON_NAME, namespace = ...
local L = namespace.L
-- addon nme = BGCallouts.lua
-- file name = Battlegrounds.lua
-- and i have localization. lua
local m=L["needs help!!!"]
local n=L["is safe."]
local s="{skull}"
local t="{triangle}"
local o=" "
-- Arathi Basin
function Blacksmith_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Blacksmith"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Blacksmith"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Farm_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Farm"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Farm"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Lumbermill_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Lumbermill"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Lumbermill"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Mine_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Stable_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Stable"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Stable"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
-- Deepwind Gorge
function Pandaren_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Pandaren Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Pandaren Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Center_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Center Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Center Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Goblin_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Goblin Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Goblin Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
-- Eye of the Sorm
function FelReaver_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Fel Reaver ruins"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Fel Reaver ruins"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function MageTower_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Mage tower"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Mage tower"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Draenei_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Draenei ruins"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Draenei ruins"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function BloodElf_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Blood Elf tower"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Blood Elf tower"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
-- The Battle for Gilneas
function Mine2_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Mine"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Mine"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Lighthouse_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Lighthouse"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Lighthouse"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
function Waterworks_OnClick()
if (GetMouseButtonClicked()=="LeftButton") then
z=L["Waterworks"]; SendChatMessage(s..o..z..o..m, "INSTANCE_CHAT");
else z=L["Waterworks"]; SendChatMessage(t..o..z..o..n, "INSTANCE_CHAT");
end
end
---------------------------------------------
Localization.lua
local _, namespace = ...
local L = setmetatable({}, { __index = function(t, k)
local v = tostring(k)
rawset(t, k, v)
return v
end })
namespace.L = L
local LOCALE = GetLocale()
if LOCALE:match("^en") then
return end
if LOCALE == "deDE" then
-- German translations go here
L["needs help!!!"] = "braucht Hilfe!!!",
L["is safe."] = "ist wieder sicher.",
L["Blacksmith"] = "Schmiede",
L["Farm"] = "Hof",
L["Lumbermill"] = "Sägewerk",
L["Mine"] = "Mine",
L["Stable"] = "Stall",
L["Pandaren Mine"] = "Pandaren Mine",
L["Center Mine"] = "Mittlere Mine",
L["Goblin Mine"] = "Goblin Mine",
L["Fel Reaver ruins"] = "Teufelshäscherruine",
L["Mage tower"] = "Magierturm",
L["Draenei ruins"] = "Draeneiruine",
L["Blood Elf tower"] = "Turm der Blutelfen",
L["Lighthouse"] = "Leuchtturm",
L["Waterworks"] = "Wasserwerk",
return end
if LOCALE == "frFR" then
-- French translations go here
L["Hello!"] = "Bonjour!"
return end
0
should i replace ADDON_NAME with name of addon or with filename where i use it and should i have any ".lua" extension and should it then all be capitals or is it good as it is?
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
local ADDON_NAME, namespace = ...
local L = namespace.L
-- addon nme = BGCallouts.lua
-- file name = Battlegrounds.lua
-- and i have localization. lua
0
i made changes following that guide but i cant get it work
"attempt to index local 'L' (a nil value)"
Localization.lua
and BattleGrounds.lua
and main file is BGCallouts.lua but there is no code writing to chat there.
0
ex self:Print(L.[" Blacksmith"])
i want it to print out " Schmeide". Can you see what i messed up with in this addon?
0
BGCallouts.func = function(self, msg)
0
i used
BGCallouts.func = function(msg)
and for call
BGCallouts:func(GetZoneText)
0
0
attempt to call method 'BGCallouts_func' (a nil value)
If i get it right the function cant be found so i must have made a fail in how to declare the function i guess . Can i get a hint what i missed and why function has a nil value?
function BGCallouts:ZONE_CHANGED_NEW_AREA()
self:BGCallouts_func(GetZoneText()) -- error
end
....
local function BGCallouts_func(msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") then
EotStorm:Show(true)
else
self:BGCallouts_hide()
end
return
end
0
attempt to call method 'BGCallouts_func' (a nil value)
If i get it right the function cant be found so i must have made a fail in how to declare the function i guess . Can i get a hint what i missed and why function has a nil value?
function BGCallouts:ZONE_CHANGED_NEW_AREA()
self:BGCallouts_func(GetZoneText()) -- error
end
....
local function BGCallouts_func(msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") then
EotStorm:Show(true)
else
self:BGCallouts_hide()
end
return
end
0
i dont have that bug can u help me?
-- Author : Txty
-- Create Date : 9/23/2014 12:27:36 AM
BGCallouts = LibStub("AceAddon-3.0"):NewAddon("BGCallouts", "AceConsole-3.0", "AceEvent-3.0");
-- Slash commands
SLASH_BGC1 = "/BGCallouts"
SlashCmdList["BGC"] = function (msg)
if (msg=="show") then
BGCallouts:show()
elseif (msg=="hide") then
BGCallouts:hide()
else
BGCallouts:Print("Only works with 'show' or 'hide'.")
end
end
function BGCallouts:OnInitialize()
-- Called when the addon is loaded
-- Print a message to the chat frame
self:Print("Loaded")
end
function BGCallouts:OnEnable()
-- Called when the addon is enabled
-- Print a message to the chat frame
self:Print("OnEnable Event Fired: Hello, again ;)")
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:func(GetZoneText())
end
function BGCallouts:ZONE_CHANGED()
self:func(GetZoneText())
end
function BGCallouts:ZONE_CHANGED_NEW_AREA()
self:func(GetZoneText())
end
function BGCallouts:show()
ArathiBasin:Show(true)
DeepwindGorge:Show(true)
Gilneas:Show(true)
EotStorm:Show(true)
return
end
function BGCallouts:hide() ----- LINE 50------
ArathiBasin:Hide(true)
DeepwindGorge:Hide(true)
Gilneas:Hide(true)
EotStorm:Hide(true)
return
end
function BGCallouts:func(msg)
-- BGCallouts:Print(msg)
if (msg=="Arathi Basin") then
ArathiBasin:Show(true)
elseif (msg=="Deepwind Gorge") then
DeepwindGorge:Show(true)
elseif (msg=="The Battle for Gilneas") then
Gilneas:Show(true)
elseif (msg=="Eye of the Storm") then
EotStorm:Show(true)
else
self:hide()
end
return
end
function BGCallouts:OnDisable()
-- Called when the addon is disabled
end
0
on this forum Announcements