silvanas
07-06-2006, 12:07 AM
i got this code
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ \FrameXML\UI.xsd">
<Script file="BagSlotType.lua"/>
<Frame name="BSTMainFrame">
<Scripts>
<OnLoad>
BagSlotType_Load();
</OnLoad>
<OnEvent>
BagSlotType_Event();
</OnEvent>
</Scripts>
</Frame>
</Ui>
VERSION = "|cffffffffversion: (|cff9900000|cffffffff.|cff9900000|cffffffff.|cff990000-1|cffffffff)"
function BagSlotType_Load()
printf("|cffffffffBag Slot Types %s loaded.",VERSION)
--register events
this:RegisterEvent("BAG_OPEN")
this:RegisterEvent("BAG_CLOSED")
this:RegisterEvent("BAG_UPDATE")
this:RegisterEvent("BAG_UPDATE_COOLDOWN")
this:RegisterEvent("ITEM_LOCK_CHANGED")
this:RegisterEvent("ITEM_PUSH")
--this:RegisterEvent("ITEM_")
end
function BagSlotType_Event()
--select event
message(VarPrint(event) .." ,".. VarPrint(arg1) .." ,".. VarPrint(arg2))
if event == "BAG_OPEN" then
--messagef("BagSlotTypes: u opent bag slot %d!",arg1)
bst_bag_open(arg1)
elseif event == "BAG_CLOSED" then
--messagef("BagSlotTypes: u closed bag slot %d!",arg1)
bst_bag_close(arg1)
elseif event == "BAG_UPDATE" then
--messagef("BagSlotTypes: u updated bag slot %d!",arg1)
bst_bag_update(arg1)
elseif event == "BAG_UPDATE_COOLDOWN" then
--messagef("BagSlotTypes: u updated bag slot %d cooldown!",arg1)
bst_bag_update_cd(arg1)
end
end
function bst_bag_open(bagnum) end
function bst_bag_close(bagnum) end
function bst_bag_update(bagnum) end
function bst_bag_update_cd(bagnum) end
function bst_lock_chanced() end
function bst_item_push(maxstacksize,iconpath) end
function VarPrint(variable)
local vartype = type(variable)
if vartype == "string" then
return variable
elseif vartype == "number" then
return tostring(variable)
elseif vartype == "boolean" then
if variable then
return "true"
else
return "false"
end
else
return vartype
end
end
function printf(...)
print(string.format(unpack(arg)))
end
function print(msg)
if msg then
DEFAULT_CHAT_FRAME:AddMessage(msg)
end
end
but ehne i open or close a bag i never get BAG-OPEn or BAG_CLOSE i only get BAD_CLOSe whne i wlak into an instance ???
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ \FrameXML\UI.xsd">
<Script file="BagSlotType.lua"/>
<Frame name="BSTMainFrame">
<Scripts>
<OnLoad>
BagSlotType_Load();
</OnLoad>
<OnEvent>
BagSlotType_Event();
</OnEvent>
</Scripts>
</Frame>
</Ui>
VERSION = "|cffffffffversion: (|cff9900000|cffffffff.|cff9900000|cffffffff.|cff990000-1|cffffffff)"
function BagSlotType_Load()
printf("|cffffffffBag Slot Types %s loaded.",VERSION)
--register events
this:RegisterEvent("BAG_OPEN")
this:RegisterEvent("BAG_CLOSED")
this:RegisterEvent("BAG_UPDATE")
this:RegisterEvent("BAG_UPDATE_COOLDOWN")
this:RegisterEvent("ITEM_LOCK_CHANGED")
this:RegisterEvent("ITEM_PUSH")
--this:RegisterEvent("ITEM_")
end
function BagSlotType_Event()
--select event
message(VarPrint(event) .." ,".. VarPrint(arg1) .." ,".. VarPrint(arg2))
if event == "BAG_OPEN" then
--messagef("BagSlotTypes: u opent bag slot %d!",arg1)
bst_bag_open(arg1)
elseif event == "BAG_CLOSED" then
--messagef("BagSlotTypes: u closed bag slot %d!",arg1)
bst_bag_close(arg1)
elseif event == "BAG_UPDATE" then
--messagef("BagSlotTypes: u updated bag slot %d!",arg1)
bst_bag_update(arg1)
elseif event == "BAG_UPDATE_COOLDOWN" then
--messagef("BagSlotTypes: u updated bag slot %d cooldown!",arg1)
bst_bag_update_cd(arg1)
end
end
function bst_bag_open(bagnum) end
function bst_bag_close(bagnum) end
function bst_bag_update(bagnum) end
function bst_bag_update_cd(bagnum) end
function bst_lock_chanced() end
function bst_item_push(maxstacksize,iconpath) end
function VarPrint(variable)
local vartype = type(variable)
if vartype == "string" then
return variable
elseif vartype == "number" then
return tostring(variable)
elseif vartype == "boolean" then
if variable then
return "true"
else
return "false"
end
else
return vartype
end
end
function printf(...)
print(string.format(unpack(arg)))
end
function print(msg)
if msg then
DEFAULT_CHAT_FRAME:AddMessage(msg)
end
end
but ehne i open or close a bag i never get BAG-OPEn or BAG_CLOSE i only get BAD_CLOSe whne i wlak into an instance ???