Saturday, April 14, 2012

need help with my addon

[:1]I'm working on an addon that does a couple things when I am whispered. Basically when I am whispered I set a variable based on the message of the whisper. I have the majority of the addon working fine I just need to add a slash command to the addon to clear the variables set but my slash command isn't working.... The name of my files are:

LAAuciton.toc

LAAuction.lua

LAAuction.xml

Here is my code :

---------------------------------------------------

MyFrame = CreateFrame("Frame", "MyFrame", UIParent); ---create the frame

MyFrame:RegisterEvent("CHAT_MSG_WHISPER"); --register this event to be notified you have been whispered

MyFrame:SetScript("OnEvent", function() MyFrame_OnEvent() end); --assign a function to handle events

function LAAuction_OnLoad(self)

SLASH_LAAuction1 = "/laauction";

SLASH_LAAuction2 = "/laa";

SlashCmdList["LAAuction"] = LAAuction_SlashCommand;

end

function LAAuction_SlashCommand(msg)

if (msg == "reset")

then

highBid = 0;

highbidder = "";

end

end





----------------------------------------------------------------

then it goes on with the working part of the addon...|||Wait sorry that was missing one line..... It looks like this but it is still not working....





MyFrame = CreateFrame("Frame", "MyFrame", UIParent); ---create the frame

MyFrame:RegisterEvent("CHAT_MSG_WHISPER"); --register this event to be notified you have been whispered

MyFrame:SetScript("OnEvent", function() MyFrame_OnEvent() end); --assign a function to handle events

MyFrame:SetScript("OnLoad", function() MyFrame_OnLoad() end); --assign a function to handle events

function LAAuction_OnLoad(self)

SLASH_LAAuction1 = "/laauction";

SLASH_LAAuction2 = "/laa";

SlashCmdList["LAAuction"] = LAAuction_SlashCommand;

end

function LAAuction_SlashCommand(msg)

if (msg == "reset")

then

highBid = 0;

highbidder = "";

end

end|||Code:
SlashCmdList["LAAuctionSLASH"] = function(msg) LAAuction:SlashHandler(msg) end 

SLASH_LAAuctionSLASH1 = "/laa"
SLASH_LAAuctionSLASH2 = "/laauction"

function LAAuction:SlashHandler(input)
local input = string.lower(input)
if input == "reset" then
-- do somethind
end
end
|||Thanks a ton Bangerz that helped and I now have my mod fully operational. I still have a couple pieces to put in but all of it's main pieces are working great!


Quote:









Code:
SlashCmdList["LAAuctionSLASH"] = function(msg) LAAuction:SlashHandler(msg) end 

SLASH_LAAuctionSLASH1 = "/laa"
SLASH_LAAuctionSLASH2 = "/laauction"

function LAAuction:SlashHandler(input)
local input = string.lower(input)
if input == "reset" then
-- do somethind
end
end
|||Hmmm one other question, is there a way to hide an outgoing whispers from the chat channel?

Not sure if you could hide a singular whisper or if you would need to hide all outgoing whispers, then do the whisper, then unhide all outgoing whispers.

Either way I can't find an active api function to do this. Any thoughts?|||Ok let me ask this could I do this to keep the outgoing whispers from appearing in my chat frame?

RemoveChatWindowMessages(1, "WHISPER");

SendChatMessage("text", "WHISPER", "COMMON", "someone");

AddChatWindowMessages(1, "WHISPER");

To me that should remove the message display from showing in the channel send a message, and hten turn the messages display back on in my channel.|||ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", YourFilterFunction)



local function YourFilterFunction(chatframeself, event, ...)

local msg = string.lower(tostring(arg1))

if string.find(msg, "string of stuff that when seen will be filtered out all in lowercase") then

return true

end

end

No comments:

Post a Comment