I see, thanks I have put the scripts code first and then my code but still nothing happens.
Code:
ColLabWoW = CreateFrame("Frame", "ColLabWoW", UIParent)
ColLabWoW:SetWidth(384)
ColLabWoW:SetHeight(512)
ColLabWoW:SetPoint("CENTER", UIParent, "CENTER")
ColLabWoW:SetBackdrop({
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
});
-- Positionate window to the left, make it movable always and visible when the character is dead
UIPanelWindows["ColLabWoW"] = {
area = "left",
pushable = 1,
whileDead = 1,
}
ColLabWoW:SetScript("OnEvent", ColLabWoW_OnEvent)
ColLabWoW:SetScript("OnUpdate", ColLabWoW_Update)
ColLabWoW:Show()
-- Get group name
local groupName, grouptype = "MyGuild", "Guild" -- TODO getGroupInfo()
addon_prefix = GenerateChannelName(groupName, grouptype)
print (addon_prefix .. " is the generated prefix")
local success = RegisterAddonMessagePrefix(addon_prefix)
if (success) then
print ("Prefix registered")
ColLabWoW:RegisterEvent("CHAT_MSG_ADDON")
SendAddonMessage(addon_prefix, "Test Message","WHISPER", (UnitName("player")))
--SendAddonMessage(addon_prefix, "time: " .. tostring(curtime))
else
print ("Error: the prefix registration failed")
end
The last message on the chat window is "Prefix registered". My On_Event now looks like this:
Code:
-- Run whenever an event fires for which the frame is registered (wowprogramming.com)
function ColLabWoW_OnEvent(frame, event, ...)
print "Event caught"
if (event == "CHAT_MSG_ADDON") then
-- Arguments: "prefix", "message", "channel", "sender"
local prefix_received, message, channel, sender = ...
if (prefix_received == addon_prefix) then
local time = tonumber(message:match("time: (%d+)"))
if time then
print("Timestamp received: " + curtime)
elseif (message == "Test Message") then
print ("Test message received")
end
end
end
end
So I'm probably missing something else. I will work more on this later and edit this post whenever I solve it. Thanks for everything!
EDIT: When I tried to generate several Editboxes, I couldn't close the game by pressing Esc, etc. I have commented it till I go back to work on the UI