Wednesday, April 18, 2012

Need some help.

Okay, this is probaly an very obvious problem, but it 'aint workin.

This is my code, but the messageframe isn't even showing up.

The frame show up, but without any sign of a messageframe.

The frame isn't closing when I press ESC, like it's supposed to do.

And the slash commands aren't working either.

It probally are small mistakes or something, but it ain't workin as it's now.


Code:
local frame = CreateFrame("Frame", "TGMT");
frame:SetWidth(600);
frame:SetHeight(600);
frame:SetPoint("CENTER", UIParent, "CENTER");
frame:SetBackdrop({bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }});
frame:SetScript("OnEvent", TGMT_OnEvent);
frame:SetScript("OnLoad", TGMT_OnLoad);
frame:RegisterEvent("GUILDBANKFRAME_OPENED");
frame:RegisterEvent("GUILDBANKLOG_UPDATE");
local payed = CreateFrame("MessageFrame", "TGMT_Payed", frame);
payed:SetWidth(550);
payed:SetHeight(550);
payed:SetPoint("TOPLEFT", frame, "TOPLEFT", 25, 25);
payed:SetInsertMode("TOP");
payed:SetFading(false);

function TMGT_OnLoad()
SLASH_TGMT1 = "/tgmt";
SLASH_TGMT2 = "/payed";
SLASH_TGMT3 = "/taxes";
SlashCmdList["TGMT"] = TGMT_Show();
tinsert(UISpecialFrames,"frame");
end

function TGMT_Show()
frame:Show();
payed:Show();
payed:Clear();
TGMT_CheckPayments();
end

function TGMT_OnEvent()
if (event=="GUILDBANKFRAME_OPENED") then
QueryGuildBankLog(MAX_GUILDBANK_TABS+1);
end
if (event=="GUILDBANKLOG_UPDATE") then
TGMT_GuildBankCheck();
end
end

function TGMT_GuildBankCheck()
local lType, lUser, lAmount = GetGuildBankMoneyTransaction(1);
if (lUser~=lastUser) and (lAmount~=lastAmount) and (lType~=lastType) then
nName = "";
nAmount = "";
nType = "";
num = 1;
count = 1;
while (nName~=lastName) and (nAmount~=lastAmount) and (nType~=lastType) do
nType, nName, nAmount = GetGuildBankMoneyTransaction(num);
num = num + 1
count = count + 1
end
num = 1;
while (count~=0) do
local trans, name, amount = GetGuildBankMoneyTransaction(num);
if (trans=="deposit") then
GuildRoster();
SortGuildRoster("rank");
num2 = 1;
name2 = "";
while(name2~=name) do
name2 = GetGuildRosterInfo(num2);
num2 = num2 + 1;
end
rank = GetGuildRosterInfo(num2);
if (rank=="Silver Manster") and (amount>9999) then
GuildRosterSetOfficerNote("Payed");
end
if (rank=="Golden Manster") and (amount>19999) then
GuildRosterSetOfficerNote("Payed");
end
end
count = count - 1;
num = num + 1;
end
lastType, lastUser, lastAmount = GetGuildBankMoneyTransaction(1);
end
end

function TGMT_CheckPayments()
GuildRoster();
SortGuildRoster("rank");
count2 = 1;
num3 = GetNumGuildMembers(true);
while (count2~=num3) do
local name = GetGuildRosterInfo(count2);
local rank = GetGuildRosterInfo(count2);
local officernote = GetGuildRosterInfo(count2);
if ((rank=="Silver Manster") or (rank=="Golden Manster")) and (officernote~="Payed") then
payed:AddMessage(name);
end
count2 = count2 + 1;
end
end

If someone could help me with this, that would be greatly appreciated.

T.I.A.

Greetz MaienM|||Edit: I fixed one of the problems by myself.

The messageframe now gets showed.


Code:
local frame = CreateFrame("Frame", "TGMT");
frame:SetWidth(600);
frame:SetHeight(600);
frame:SetPoint("CENTER", UIParent, "CENTER");
frame:SetBackdrop({bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }});
frame:SetScript("OnEvent", TGMT_OnEvent);
frame:SetScript("OnLoad", TGMT_OnLoad);
frame:RegisterEvent("GUILDBANKFRAME_OPENED");
frame:RegisterEvent("GUILDBANKLOG_UPDATE");
frame:EnableMouseWheel(true);
local payed = CreateFrame("MessageFrame", "TGMT_Payed");
payed:SetWidth(550);
payed:SetHeight(550);
payed:SetPoint("CENTER", frame, "CENTER");
payed:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }});
payed:SetBackdropColor(0,0,0,1);
payed:SetInsertMode("TOP");
payed:SetFading(false);
payed:EnableMouseWheel(true);

function TMGT_OnLoad()
SLASH_TGMT1 = "/tgmt";
SLASH_TGMT2 = "/payed";
SLASH_TGMT3 = "/taxes";
SlashCmdList["TGMT"] = TGMT_Show();
tinsert(UISpecialFrames,"frame");
end

function TGMT_Show()
frame:Show();
payed:Show();
payed:Clear();
TGMT_CheckPayments();
end

function TGMT_OnEvent()
if (event=="GUILDBANKFRAME_OPENED") then
QueryGuildBankLog(MAX_GUILDBANK_TABS+1);
end
if (event=="GUILDBANKLOG_UPDATE") then
TGMT_GuildBankCheck();
end
end

function TGMT_GuildBankCheck()
local lType, lUser, lAmount = GetGuildBankMoneyTransaction(1);
if (lUser~=lastUser) and (lAmount~=lastAmount) and (lType~=lastType) then
nName = "";
nAmount = "";
nType = "";
num = 1;
count = 1;
while (nName~=lastName) and (nAmount~=lastAmount) and (nType~=lastType) do
nType, nName, nAmount = GetGuildBankMoneyTransaction(num);
num = num + 1
count = count + 1
end
num = 1;
while (count~=0) do
local trans, name, amount = GetGuildBankMoneyTransaction(num);
if (trans=="deposit") then
GuildRoster();
SortGuildRoster("rank");
num2 = 1;
name2 = "";
while(name2~=name) do
name2 = GetGuildRosterInfo(num2);
num2 = num2 + 1;
end
rank = GetGuildRosterInfo(num2);
if (rank=="Silver Manster") and (amount>9999) then
GuildRosterSetOfficerNote("Payed");
end
if (rank=="Golden Manster") and (amount>19999) then
GuildRosterSetOfficerNote("Payed");
end
end
count = count - 1;
num = num + 1;
end
lastType, lastUser, lastAmount = GetGuildBankMoneyTransaction(1);
end
end

function TGMT_CheckPayments()
GuildRoster();
SortGuildRoster("rank");
count2 = 1;
num3 = GetNumGuildMembers(true);
while (count2~=num3) do
local name = GetGuildRosterInfo(count2);
local rank = GetGuildRosterInfo(count2);
local officernote = GetGuildRosterInfo(count2);
if ((rank=="Silver Manster") or (rank=="Golden Manster")) and (officernote~="Payed") then
payed:AddMessage(name);
end
count2 = count2 + 1;
end
end

P.S. If anyone could tell me where I can find the edit button on this forum, that would be greatly appreciated.

That is, if there is a edit button.|||I just realized after typing all of this that this post is almost a month old. If you check this, awesome. If you have it figured out already, awesome again. If you still needed help, I took a shot in the dark on some of this, since I'm not near my main computer to test.

- To add your frame to the UISpecialFrames table, you need to specify your frame "name", not the variable that stores the frame reference. Your frame name was set to "TGMT" in your CreateFrame function call, so use:

tinsert(UISpecialFrames,"TGMT");

- I could be wrong on this one, but the slash handling you are using might be the wrong format. I think it should just be:

SlashCmdList["TGMT"] = TGMT_Show;

If you include the parenthesis in TGMT_Show(), you are assigning the return value of the function TGMT_Show. Example:

function a ()

return "hi!"

end

b = a -- (This will make b point or refer to the a function)

b = a() -- (This will make b equal whatever a() returns, which is "hi!"

You want the reference to the function, not the value returned.|||Thanks for your reply, even though I figured out most of it allready, and even decided to rewrite it (twice actually).


Quote:








SlashCmdList["TGMT"] = TGMT_Show;

If you include the parenthesis in TGMT_Show(), you are assigning the return value of the function TGMT_Show. Example:

function a ()

return "hi!"

end

b = a -- (This will make b point or refer to the a function)

b = a() -- (This will make b equal whatever a() returns, which is "hi!"

You want the reference to the function, not the value returned.




Didn't know that one yet, thanks.

My addon is now somewhat close to being finished, I just removed the whole frame stuff, and ACE'ed it.

I think I'll add the frame back in, now I know what I was doing wrong;)

Once again, thanks.

Still wondering where the edit button is though.... :P|||Quote:








Still wondering where the edit button is though.... :P




Here is what the forum FAQ says:


Quote:




If you have registered, you will be able to edit and delete your posts. Note that the administrator can disable this ability as he desires. Your ability to edit your posts may also be time-limited, depending on how the administrator has set up the forum.

To edit or delete your posts, click the button by the post you want to edit. If your post was the first in the thread, then deleting the post may result in the removal of the entire thread.




It appears that there is indeed a time limit because I know I have modified some of my posts, but as I look through some of them I can't edit them any more.

This line was just edited so it is there. Just have to be quick about it :)|||There's a time limit of about five minutes, to stop context editing and such.

No comments:

Post a Comment