Now go, add a '/bagscale' chat command to it and release it for other people, too :-D
Totally untested, but here ya go. /bagscale N where N is an number greater than 0 and no greater than 2. Defaults to 1 if you haven't set a custom scale yet.
local function ScaleEm(scale)
local i = 1
local f
while true do
f = _G['ContainerFrame'..i]
if f then
if not f.origSetScale then
f.origSetScale = f.SetScale
end
f.SetScale = function()
f:origSetScale(scale)
end
f:SetScale(scale)
else
break
end
i = i + 1
end
end
local addon = CreateFrame("Frame")
addon:RegisterEvent("VARIABLES_LOADED")
addon:SetScript("OnEvent", function(self, event, ...)
if not BagScaleSetting then
BagScaleSetting = 1
end
ScaleEm(BagScaleSetting)
self:UnregisterEvent("VARIABLES_LOADED")
end)
SLASH_BAGSCALE1 = "/bagscale"
SlashCmdList.BAGSCALE = function(input)
input = tonumber(input)
if input and input > 0 and input <= 2 then
ScaleEm(input)
end
end
[2008/03/19 16:52:06-2500-x1]: Bagscale\BagScale.lua:11: attempt to index global 'self' (a nil value)
Bagscale\BagScale.lua:13: in function <Interface\AddOns\Bagscale\BagScale.lua:1>
Bagscale\BagScale.lua:27: in function <Interface\AddOns\Bagscale\BagScale.lua:23>
[2008/03/20 15:49:14-2502-x1]: Bagscale\BagScale.lua:11: attempt to index upvalue 'f' (a nil value)
Interface\FrameXML\ContainerFrame.lua:527: in function `updateContainerFrameAnchors':
Interface\FrameXML\ContainerFrame.lua:474: in function `ContainerFrame_GenerateFrame':
Interface\FrameXML\ContainerFrame.lua:67: in function `ToggleBag':
Interface\FrameXML\ContainerFrame.lua:85: in function `ToggleBackpack':
<string>:"TOGGLEBACKPACK":1: in function <[string "TOGGLEBACKPACK"]:1>
local function ScaleEm(scale)
local f
for i = 1, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS do
f = _G['ContainerFrame'..i]
if f then
if not f.origSetScale then
f.origSetScale = f.SetScale
end
f.SetScale = function(self, scale)
self:origSetScale(BagScaleSetting or scale)
end
f:SetScale(scale)
end
end
end
local addon = CreateFrame("Frame")
addon:RegisterEvent("VARIABLES_LOADED")
addon:SetScript("OnEvent", function(self, event, ...)
if not BagScaleSetting then
BagScaleSetting = 1
end
ScaleEm(BagScaleSetting)
self:UnregisterEvent("VARIABLES_LOADED")
end)
SLASH_BAGSCALE1 = "/bagscale"
SlashCmdList.BAGSCALE = function(input)
input = tonumber(input)
if input and input > 0 then -- There's no reason why you shouldn't allow someone to set this to a really high number. :)
BagScaleSetting = input
ScaleEm(input)
end
end
P.S. @Phanx : You forgot to set the SavedVariable value to "input" in the SlashCmdList.BAGSCALE function.
Totally untested, but here ya go. /bagscale N where N is an number greater than 0 and no greater than 2. Defaults to 1 if you haven't set a custom scale yet.
BagScale.toc
BagScale.lua
I still can't open my bags, tho :(
to
P.S. @Phanx : You forgot to set the SavedVariable value to "input" in the SlashCmdList.BAGSCALE function.
Edit: Fixed indentation.