Ok, i'm using this and couldn't live without it, i'm trying to update it to use LibSink-2.0 instead of SinkLib
raidReRoute = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0","AceDB-2.0","AceHook-2.1","Sink-1.0")
DEFAULT_CHATFRAME_ALPHA = 0
local addon = raidReRoute
addon:RegisterDB("RRRdb")
function addon:OnEnable()
self:SecureHook("RaidWarningFrame_OnEvent")
self:RegisterChatCommand( "/rrr", self.options )
end
function addon:RaidWarningFrame_OnEvent( orig , event, message, ... )
if event == "CHAT_MSG_RAID_WARNING" then
self:Pour( message ) --add [, red , blue , green , alpha ] to this to add color.
return RaidWarningFrame:Hide()
end
end
I tried to replace Sink-1.0 with LibSink-2.0 but then it gave this error.
[2008/04/26 12:42:11-8208-x1]: raidReRoute-1.0\raidReRoute.lua:1: AceAddon: AceOO-2.0: table: 10843E88 is not an appropriate mixin
Ace2\AceLibrary\AceLibrary.lua:122: in function <Interface\AddOns\Ace2\AceLibrary\AceLibrary.lua:75>
(tail call): ?:
(tail call): ?:
AceAddon-2.0-57245 (Ace2):973: in function `new'
raidReRoute-1.0\raidReRoute.lua:1: in main chunk
Thanks a lot, gonna give this a try right now.
I was also wondering, since sooner or later everything will be Ace3'ed, how difficult would that be for coders to translate/adapt this very small piece of code :)
If i'm asking this it's because this is not on the svn, very few ppl use it if there is any so no one will ever update it, unfortunately i don't have the knowledge to do it myself.
Ace3 is quite similar to Ace2. Unfortunatly there isn't alot of the documentation for it in the wiki but the actual files are very well commented so you'll need to look through them to find the mixins and how to use them. Here are a few links that may help:
Well after a few tries i'm giving up, i don't plan to become a lua coder, was just hoping someone could help me move this small code to Ace3, thanks anyway.
Well after a few tries i'm giving up, i don't plan to become a lua coder, was just hoping someone could help me move this small code to Ace3, thanks anyway.
Well i deleted it now, but ok i'll try again, but to be honnest it's like asking a french to speak chinese just because he seen a chinese movie, i'm writing/copy/pasting things that i barely understand so.
raidReRoute = LibStub("AceAddon-3.0"):NewAddon("raidReRoute", "AceConsole-3.0, LibSink-2.0")
function addon:OnEnable()
self:SecureHook("RaidWarningFrame_OnEvent")
self.db = LibStub("AceDB-3.0"):New("WelcomeHomeDB", defaults, "Default")
end
function addon:RaidWarningFrame_OnEvent( orig , event, message, ... )
if event == "CHAT_MSG_RAID_WARNING" then
self:Pour( message ) --add [, red , blue , green , alpha ] to this to add color.
return RaidWarningFrame:Hide()
end
end
[2008/04/26 19:59:51-8228-x1]: raidReRoute-1.0\core.lua:1: Usage: EmbedLibrary(addon, libname, silent, offset): 'libname' - Cannot find a library instance of "AceConsole-3.0, LibSink-2.0".
AceAddon-3.0\AceAddon-3.0.lua:126: in function `EmbedLibrary'
AceAddon-3.0\AceAddon-3.0.lua:114: in function `EmbedLibraries'
AceAddon-3.0\AceAddon-3.0.lua:88: in function `NewAddon'
raidReRoute-1.0\core.lua:1: in main chunk
---
It's chinese for me really i don't understand, i'ts not even giving up, it's just that i don't speak chinese :(
raidReRoute = LibStub("AceAddon-3.0"):NewAddon("raidReRoute", "AceConsole-3.0, LibSink-2.0")
function addon:OnEnable()
self:SecureHook("RaidWarningFrame_OnEvent")
self.db = LibStub("AceDB-3.0"):New("WelcomeHomeDB", defaults, "Default")
end
function addon:RaidWarningFrame_OnEvent( orig , event, message, ... )
if event == "CHAT_MSG_RAID_WARNING" then
self:Pour( message ) --add [, red , blue , green , alpha ] to this to add color.
return RaidWarningFrame:Hide()
end
end
[2008/04/26 19:59:51-8228-x1]: raidReRoute-1.0\core.lua:1: Usage: EmbedLibrary(addon, libname, silent, offset): 'libname' - Cannot find a library instance of "AceConsole-3.0, LibSink-2.0".
AceAddon-3.0\AceAddon-3.0.lua:126: in function `EmbedLibrary'
AceAddon-3.0\AceAddon-3.0.lua:114: in function `EmbedLibraries'
AceAddon-3.0\AceAddon-3.0.lua:88: in function `NewAddon'
raidReRoute-1.0\core.lua:1: in main chunk
---
It's chinese for me really i don't understand, i'ts not even giving up, it's just that i don't speak chinese :(
local sink = LibStub("LibSink-2.0")
local function OnEvent(frame, event, msg)
if event == "CHAT_MSG_RAID_WARNING" then
sink:Pour(msg)
end
end
hooksecurefunc("RaidWarningFrame_OnEvent", OnEvent)
RaidWarningFrame:SetScript("OnShow", RaidWarningFrame.Hide) --Prevent the frame from showing
RaidWarningFrame:Hide()
Should work.
What was the database set up for? Was it to disable the addon on chat command?
First off, this was made to allow the user to redirect the messages sent to the blizzard "ugly" raid warning frame to any LibSink compatible addons, like Parrot, MSBT or anything else.
The database well i'm not sure, i guess to save the output settings.
@ Slakah Your code works but i have no way to set up the output frame and i don't see anything related to chatcommands or options, how do i select the output frame ? and how do i get the settings to be saved please ?
Anyway i really gotta learn this, jut wonder where to start.
I think you're doing too much using sink, choose what frame you want outputed and hardcode that frame in.
I'm not sure to understand but i wish i could :)
About doing too much, well, all the addons i use allow me to choose in which frame i want them to output, the only thing that won't are the simple /rw sent by raid leaders for example, raidReRoute helps me to do that.
local RWF = RaidWarningFrame
local addmsg = RWF.AddMessage
function RWF:AddMessage(text,r,g,b, ...)
MikSBT.DisplayMessage(text, nil, nil, r * 255, g * 255, b * 255)
return addmsg(self, text,r,g,b,...)
end
RWF:SetScript("OnShow",RWF.Hide)
RWF:Hide
This should work for MSBT, check the MSBT API page for more info on MikSBT.DisplayMessage()
Well not any specific frame, i mean, have the usual choice offered by sink: msbt, parrot, sct, hide, chatframe and so on.
@Slakah but, i'm not using msbt.
your above code is working fine:
local sink = LibStub("LibSink-2.0")
local function OnEvent(frame, event, msg)
if event == "CHAT_MSG_RAID_WARNING" then
sink:Pour(msg)
end
end
hooksecurefunc("RaidWarningFrame_OnEvent", OnEvent)
RaidWarningFrame:SetScript("OnShow", RaidWarningFrame.Hide) --Prevent the frame from showing
RaidWarningFrame:Hide()
all i want is to add output frame selection "sink" and save settings, basically what the original code does, all i asked was to make it ace3 and dependant of LibSink-2.0 instead of Sink-1.0, nothing else.
So as noob i assume these lines have to be included/translated:
addon:RegisterDB("RRRdb")
self:RegisterChatCommand( "/rrr", self.options )
if event == "CHAT_MSG_RAID_WARNING" then
self:Pour( message ) --add [, red , blue , green , alpha ] to this to add color.
return RaidWarningFrame:Hide()
end
local sink = LibStub("LibSink-2.0")
RaidReRoute = RaidReRoute or "SCT" --Set default
local chat = DEFAULT_CHAT_FRAME
SLASH_RAIDREROUTE1 = "/raidreroute"
SLASH_RAIDREROUTE2 = "/rrr" -- A shortcut or alias
SlashCmdList["RAIDREROUTE"] = function(msg)
if msg and sink.handlers[msg] then
RaidReRouteDB = msg
else
chat:AddMessage("Type /rrr <Output area> to set the RaidWarningFrame output area /n Output Areas:")
for k, v in pairs(sink.handlers) do
chat:AddMessage(k)
end
end
end
function RaidWarningFrame:AddMessage(msg,r,g,b)
sink:Pour(RaidReRouteDB, msg,r,g,b)
end
This should work, you would need to create a variable in Saved Variables field in the toc of this addon called "RaidReRouteDB". Fingers Crossed.
@Slakah No errors, chat commands for /rrr are displayed but nothing i type like for example /rrr Parrot works, the output is still being made to the normal RWF.
What weird also is that there's no scroll area selection, the choices list for addons is displayed but no areas. But your code is the closest thing to something working
@Xinhuan, i tried to add your corrected line to the original code
raidReRoute = LibStub("AceAddon-3.0"):NewAddon("raidReRoute", "AceConsole-3.0", "LibSink-2.0")
local addon = raidReRoute
addon:RegisterDB("RRRdb")
function addon:OnEnable()
self:SecureHook("RaidWarningFrame_OnEvent")
self:RegisterChatCommand( "/rrr", self.options )
end
function addon:RaidWarningFrame_OnEvent( orig , event, message, ... )
if event == "CHAT_MSG_RAID_WARNING" then
self:Pour( message ) --add [, red , blue , green , alpha ] to this to add color.
return RaidWarningFrame:Hide()
end
end
but:
[2008/04/27 01:15:57-8256-x1]: raidReRoute-1.0\core.lua:4: attempt to call method 'RegisterDB' (a nil value)
---
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I tried to replace Sink-1.0 with LibSink-2.0 but then it gave this error.
[2008/04/26 12:42:11-8208-x1]: raidReRoute-1.0\raidReRoute.lua:1: AceAddon: AceOO-2.0: table: 10843E88 is not an appropriate mixin
Ace2\AceLibrary\AceLibrary.lua:122: in function <Interface\AddOns\Ace2\AceLibrary\AceLibrary.lua:75>
(tail call): ?:
(tail call): ?:
AceAddon-2.0-57245 (Ace2):973: in function `new'
raidReRoute-1.0\raidReRoute.lua:1: in main chunk
---
Could anyone help please ?
I was also wondering, since sooner or later everything will be Ace3'ed, how difficult would that be for coders to translate/adapt this very small piece of code :)
If i'm asking this it's because this is not on the svn, very few ppl use it if there is any so no one will ever update it, unfortunately i don't have the knowledge to do it myself.
http://www.wowace.com/wiki/Ace3
http://www.wowace.com/wiki/Differences_from_Ace2_to_Ace3
http://www.wowace.com/wiki/WelcomeHome_-_Your_first_Ace3_Addon
Don't give up, where are you stuck?
[2008/04/26 19:59:51-8228-x1]: raidReRoute-1.0\core.lua:1: Usage: EmbedLibrary(addon, libname, silent, offset): 'libname' - Cannot find a library instance of "AceConsole-3.0, LibSink-2.0".
AceAddon-3.0\AceAddon-3.0.lua:126: in function `EmbedLibrary'
AceAddon-3.0\AceAddon-3.0.lua:114: in function `EmbedLibraries'
AceAddon-3.0\AceAddon-3.0.lua:88: in function `NewAddon'
raidReRoute-1.0\core.lua:1: in main chunk
---
It's chinese for me really i don't understand, i'ts not even giving up, it's just that i don't speak chinese :(
Ofc i do
Should work.
What was the database set up for? Was it to disable the addon on chat command?
The database well i'm not sure, i guess to save the output settings.
@ Slakah Your code works but i have no way to set up the output frame and i don't see anything related to chatcommands or options, how do i select the output frame ? and how do i get the settings to be saved please ?
Anyway i really gotta learn this, jut wonder where to start.
I'm not sure to understand but i wish i could :)
About doing too much, well, all the addons i use allow me to choose in which frame i want them to output, the only thing that won't are the simple /rw sent by raid leaders for example, raidReRoute helps me to do that.
This should work for MSBT, check the MSBT API page for more info on MikSBT.DisplayMessage()
Well not any specific frame, i mean, have the usual choice offered by sink: msbt, parrot, sct, hide, chatframe and so on.
@Slakah but, i'm not using msbt.
your above code is working fine:
all i want is to add output frame selection "sink" and save settings, basically what the original code does, all i asked was to make it ace3 and dependant of LibSink-2.0 instead of Sink-1.0, nothing else.
So as noob i assume these lines have to be included/translated:
addon:RegisterDB("RRRdb")
self:RegisterChatCommand( "/rrr", self.options )
if event == "CHAT_MSG_RAID_WARNING" then
self:Pour( message ) --add [, red , blue , green , alpha ] to this to add color.
return RaidWarningFrame:Hide()
end
But i don't know where, and how.
raidReRoute = LibStub("AceAddon-3.0"):NewAddon("raidReRoute", "AceConsole-3.0, LibSink-2.0")
It should be
raidReRoute = LibStub("AceAddon-3.0"):NewAddon("raidReRoute", "AceConsole-3.0", "LibSink-2.0")
Why didn't anyone notice it and instead offered lots of different solutions? :o
This should work, you would need to create a variable in Saved Variables field in the toc of this addon called "RaidReRouteDB". Fingers Crossed.
What weird also is that there's no scroll area selection, the choices list for addons is displayed but no areas. But your code is the closest thing to something working
@Xinhuan, i tried to add your corrected line to the original code
but:
[2008/04/27 01:15:57-8256-x1]: raidReRoute-1.0\core.lua:4: attempt to call method 'RegisterDB' (a nil value)
---