Thread Tools Display Modes
05-23-10, 02:59 PM   #81
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
not sure whats going on but i changed the toc file as u specified but no changes
  Reply With Quote
05-23-10, 03:06 PM   #82
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok now ish getting error on startup of wow, will post next post. but thew addon runs fine as far as in game
but saved variables now appear

GuildBankTransactionTab1 = nil
GuildBankTransactionTab2 = nil

i hate to say it but it may have something to do with the pairing code..(although i wish i knew how it worked)(been looking at all kinds of resources including urs before u even gave them to me^^ also found a internet book of programing in lua .. apparently its legal, still not much help for my retarded mind, although i have to read it first completely.. just i wanna get this done)
  Reply With Quote
05-23-10, 03:07 PM   #83
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Originally Posted by clowcadia View Post
not sure whats going on but i changed the toc file as u specified but no changes
You logged right out of the game right ? It only reads the toc file when you first log in. So any changes to it results in a full relog and not just to character screen.

Also, you did make sure that the tables listed in the TOC were the same tables you are using in the LUA ? They need to be the same or it won't work. My example had a letter missing I think so if you copied mine exactly that would explain it.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 03:08 PM   #84
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
weird error
Code:
Message: ...dOns\GuildBankTransactions\GuildBankTransactions.lua:62: attempt to index global 'GuildBankFrame' (a nil value)
Time: 05/23/10 17:08:26
Count: 10
Stack: ...dOns\GuildBankTransactions\GuildBankTransactions.lua:62: in function <...dOns\GuildBankTransactions\GuildBankTransactions.lua:59>

Locals: self = evFrame {
 0 = <userdata>
}
event = "BAG_UPDATE"
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'GuildBankFrame' (a nil value)"
refreshLogInfo = <function> defined @Interface\AddOns\GuildBankTransactions\GuildBankTransactions.lua:5
messageCount = 0
getLogInfo = <function> defined @Interface\AddOns\GuildBankTransactions\GuildBankTransactions.lua:14
  Reply With Quote
05-23-10, 03:09 PM   #85
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
rofl, yea i relaised when i check the lua and toc, and was gonna say that too
  Reply With Quote
05-23-10, 03:13 PM   #86
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok i am assuming it worked to do the splitting of variables but it seams they use the same data rather then seperate for each tab


Code:
GuildBankTransactionsTab1 = {
	["Transaction Time"] = "< an hour",
	["Item Count"] = 17,
	["Transaction Type (tab1)"] = "move",
	["Item Name"] = "Bloodcredit",
}
GuildBankTransactionsTab2 = {
	["Item Name"] = "Bloodcredit",
	["Item Count"] = 17,
	["Transaction Time"] = "< an hour",
	["Transaction Type"] = "move",
}
source of my lua that relates tot he result

Code:
if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1);              
              GuildBankTransactionsTab1 = {              
              ["Transaction Type (tab1)"] = tType,
              ["Item Name"] = tName,
              ["Item Count"] = count,
              ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
              }               
              end                
              if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2);              
              GuildBankTransactionsTab2 = {              
              ["Transaction Type"] = tType,
              ["Item Name"] = tName,
              ["Item Count"] = count,
              ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
              }                           
              end
  Reply With Quote
05-23-10, 03:43 PM   #87
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
and a quick little question
how do i add a variable to the table that displays the time of the transaction to be displayed the same in saved variables.
when i look inside i think u noticed it says less then an hour when i paste this code into it
["somehting"] = "Time Conversion = (", RecentTimeDate(year, month, day, hour),")")

it was something liek this that didnt give me an error this might, but the adjustment to loose an erroir are nto very difficult
  Reply With Quote
05-23-10, 03:46 PM   #88
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
ah I see where you are going wrong there.

You are setting both values to whatever the last item read was as it loops through each tab.
EG.

tab1
set transactiontab1 = {...}
set transactiontab2 = {...}
tab2
set transactiontab1 = {...}
set transactiontab2 = {...}

Also, the tab1 and tab2 items in there relate to movement between 2 tabs as part of a transaction and not because it is a particular tab.

EG.
Tab No 1 transactions being read ...
movement of item1 from tab1 (Tab No 3) to tab2 ( Tab No 1) 3 days ago
Tab No 2 transactions being read ...
movement of item2 from tab1 ( Tab No 2 ) to tab2 ( Tab No 3 ) 2 days ago
Tab No 3 transactions being read ...
movement of item1 from tab1 ( Tab No 3) to tab2 ( Tab No 1) 3 days ago
movement of item2 from tab1 ( Tab No 2) to tab2 ( Tab No 3) 2 days ago

Here's the last code block you posted that is relevant and I'll highlight the for blocks you need to watch. I made some slight changes and added extra comments with an alternative block of code you could use instead to cut down the amount of almost if not identical code you are using.

Code:
local function getLogInfo()

  -- Increase how many times we have used this function
  queryCount = queryCount + 1;

  -- If we have used this function for all of the tabs as well as for the money 
  -- then we can do some work as we have all the data we need for the moment
  if queryCount == GetNumGuildBankTabs() + 1 then

     -- For each tab in the guildbank do the following stuff
     for tab = 1, GetNumGuildBankTabs() do

        -- Get the total number of transactions in this tab
        local maxTabTrans = GetNumGuildBankTransactions(tab);

        -- For each transaction in this tab extract the information required.
        for trans = 1,maxTabTrans do
            tType, tName, itemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab, trans);

            -- If this is the last transaction in this tab then we want to display
            -- it in some form
            if trans == maxTabTrans then

                -- If tab1 and tab2 exist then this was a movement transaction 
                -- and we want to know what the name of each tab is to make 
                -- things easier.
                if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end             
                if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2); end

                -- We want to keep track of the last transaction for each tab
                if ( tab == 1 ) then 
                     GuildBankTransactionsTab1 = {              
                        ["Transaction Type"] = tType,
                        ["Item Name"] = tName,
                        ["Item Count"] = count,
                        ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
                    }               
                end                
                if ( tab == 2 ) then          
                   GuildBankTransactionsTab2 = {              
                       ["Transaction Type"] = tType,
                       ["Item Name"] = tName,
                       ["Item Count"] = count,
                       ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
                   }                           
               end   

              -- Repeat the above if/end block for each tab you want to 
              -- specifically list OR you could do the following instead to do it
              -- for all tabs but remember to change the SavedVariables in
              -- TOC to the global table, in this example GuildBankTransactions
              GuildBankTransactions[tab] = {
                       ["Transaction Type"] = tType,
                       ["Item Name"] = tName,
                       ["Item Count"] = count,
                       ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
              }

              -- And just for testing purposes we can print the last transaction 
              -- we found to the screen.  We use print so that nil values will not
              -- error out but will print as nil.  This enables us to test for nils
              -- that shouldn't exist
              print("===")
              print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");  
         
          end
      end

      -- Now repeat the same process as above but for the money log
      local maxMoneyTrans = GetNumGuildBankMoneyTransactions();

      -- loop through the transactions
      for trans = 1,maxMoneyTrans do

          -- get the transaction details
          tType, tName, amount, years, months, days, hours = GetGuildBankMoneyTransaction(trans);

          -- If this is the last transaction then print the info out
          if ( trans == maxMoneyTrans ) then
             print("$$$")
             print("Last Money Transaction: ",maxMoneyTrans,tType, tName, amount, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");
             print("=>End of Transactions<=")
          end
       end

    end

  end

end
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 03:49 PM   #89
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Originally Posted by clowcadia View Post
and a quick little question
how do i add a variable to the table that displays the time of the transaction to be displayed the same in saved variables.
when i look inside i think u noticed it says less then an hour when i paste this code into it
["somehting"] = "Time Conversion = (", RecentTimeDate(year, month, day, hour),")")

it was something liek this that didnt give me an error this might, but the adjustment to loose an erroir are nto very difficult

I've not used RecentTimeDate function myself except here so I am not sure if there are pitfalls to using it. However, simply using just year, month, day, hour instead of the function around it will display each of those values.

EG. Something that was < 1 day ago could result in anything from
0 0 0 23 for something 23 hours ago
to
0 0 0 1 for something 1 hour ago

The RecentTimeDate function just turns those individual values into a more friendly value.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 04:02 PM   #90
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok i intergrated ur code but i still getting this oddly enough

Code:
GuildBankTransactionsTab1 = {
	["Item Count"] = 17,
	["Item"] = "|cffffffff|Hitem:2452:0:0:0:0:0:0:0:29|h[Swiftthistle]|h|r",
	["Transaction Type"] = "move",
	["Player's Name"] = "Bloodcredit",
}
GuildBankTransactionsTab2 = {
	["Player's Name"] = "Bloodcredit",
	["Item Count"] = 17,
	["Item"] = "|cffffffff|Hitem:2452:0:0:0:0:0:0:0:29|h[Swiftthistle]|h|r",
	["Transaction Type"] = "move",
}
this is my source
Code:
local tType, tName, itemLink, count, tab1, tab2, year, month, day, hour;
local queryCount = 0;
local messageCount = 0;

local function refreshLogInfo()
  queryCount = 0;
  for tab = 1,GetNumGuildBankTabs() do
    QueryGuildBankLog(tab);
    QueryGuildBankTab(tab);
  end		
  QueryGuildBankLog(MAX_GUILDBANK_TABS+1);
end      

local function getLogInfo()
  queryCount = queryCount + 1;
  if queryCount == GetNumGuildBankTabs() + 1 then
    for tab = 1, GetNumGuildBankTabs() do
      local maxTabTrans = GetNumGuildBankTransactions(tab);
        -- For each transaction in the current tab extract the information required.
        for trans = 1,maxTabTrans do
          tType, tName, itemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab, trans);
            -- If this is the last transaction then we want to display it in some form
            if trans == maxTabTrans then
              if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end                
              if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2);
              if ( tab == 1 ) then 
                     GuildBankTransactionsTab1 = {              
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item Count"] = count,
                       ["Item"] = itemLink,
                       ["Transaction Time"] = print( RecentTimeDate(year, month, day, hour) ),
                    }               
                end                
                if ( tab == 2 ) then          
                   GuildBankTransactionsTab2 = {              
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item Count"] = count,
                       ["Item"] = itemLink,
                       ["Transaction Time"] = print( RecentTimeDate(year, month, day, hour) ),
                   }                           
                end                           
              end   
              print("===")
              print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");           
            end
         end
      end
      -- Now repeat the same process for the money log
      local maxMoneyTrans = GetNumGuildBankMoneyTransactions();
      for trans = 1,maxMoneyTrans do
        tType, tName, amount, years, months, days, hours = GetGuildBankMoneyTransaction(trans);
        if ( trans == maxMoneyTrans ) then
          print("$$$")
          print("Last Money Transaction: ",maxMoneyTrans,tType, tName, amount, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");
          print("=>End of Transactions<=")
       end
     end
  end
end


local function onEvent(self,event,...)

             -- Only work if the Guild Bank Frame is open 
	if ( not GuildBankFrame:IsVisible() ) then
		return;
	end

	if ( event == "GUILDBANKFRAME_OPENED" ) then
                  refreshLogInfo();                  
                  messageCount = messageCount + 1;                  
                  if ( messageCount > 2 ) then
                  print("^^^")                                                   
                  elseif ( messageCount > 1 ) then
                  message("LogUpdated")  
                  elseif ( messageCount > 0 ) then
                  message("Reload Vault to make sure Addon Works Properly")                
                  end
                  
            elseif ( event == "BAG_UPDATE" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_ITEM_LOCK_CHANGED" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_MONEY" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_TABS" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_TEXT" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_WITHDRAWMONEY" ) then
                  refreshLogInfo();

	elseif ( event == "GUILDBANKLOG_UPDATE" ) then
                  getLogInfo();
                           
	end
end

local evFrame = CreateFrame("Frame","evFrame",UIParent);
evFrame:SetScript( "OnEvent", onEvent );
evFrame:RegisterEvent( "PLAYER_LOGIN" );
evFrame:RegisterEvent( "GUILDBANKLOG_UPDATE" );
evFrame:RegisterEvent( "GUILDBANKFRAME_OPENED" );
evFrame:RegisterEvent( "BAG_UPDATE" );
  Reply With Quote
05-23-10, 04:09 PM   #91
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
You've got them caught up in another if/end block. But, even if it was outside of the if/end block it could still be showing an identical detail if tab 1 and tab 2 were part of the same movement transaction. Thats why I added the function to get the name of the tab so it could be confirmed whether the same tabs were in play.

Your code
Code:
            if trans == maxTabTrans then
              if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end                
              if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2);
              if ( tab == 1 ) then 
                     GuildBankTransactionsTab1 = {              
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item Count"] = count,
                       ["Item"] = itemLink,
                       ["Transaction Time"] = print( RecentTimeDate(year, month, day, hour) ),
                    }               
                end                
                if ( tab == 2 ) then          
                   GuildBankTransactionsTab2 = {              
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item Count"] = count,
                       ["Item"] = itemLink,
                       ["Transaction Time"] = print( RecentTimeDate(year, month, day, hour) ),
                   }                           
                end                           
              end   
              print("===")
              print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");           
            end
What it should be :
Code:
            if trans == maxTabTrans then
              if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end                
              if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2); end
              if ( tab == 1 ) then 
                     GuildBankTransactionsTab1 = {              
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item Count"] = count,
                       ["Item"] = itemLink,
                       ["Transaction Time"] = print( RecentTimeDate(year, month, day, hour) ),
                    }               
                end                
                if ( tab == 2 ) then          
                   GuildBankTransactionsTab2 = {              
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item Count"] = count,
                       ["Item"] = itemLink,
                       ["Transaction Time"] = print( RecentTimeDate(year, month, day, hour) ),
                   }                           
                end                           
              print("===")
              print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");           
            end
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 04:12 PM   #92
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
hehe ok, it works
yep irealised a little after after looking at
its nice that i am getting used to understanding where is the probleme arriving
thank you so much crystal

i dont think i am completely done with the coding
but this is an amazing start from what started from
i still dont understand why ppl use the pairs function, and why u had advised me to use it(no offence jsut very confused)
  Reply With Quote
05-23-10, 04:18 PM   #93
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
trying to do the one table for all tabs and this is what happen in guild vault

Code:
Message: ...dOns\GuildBankTransactions\GuildBankTransactions.lua:31: attempt to index global 'GuildBankTransactions' (a nil value)
Time: 05/23/10 18:16:18
Count: 1
Stack: ...dOns\GuildBankTransactions\GuildBankTransactions.lua:31: in function <...dOns\GuildBankTransactions\GuildBankTransactions.lua:14>
...dOns\GuildBankTransactions\GuildBankTransactions.lua:89: in function <...dOns\GuildBankTransactions\GuildBankTransactions.lua:52>

Locals: (for index) = 1
(for limit) = 2
(for step) = 1
tab = 1
maxTabTrans = 25
(for index) = 25
(for limit) = 25
(for step) = 1
trans = 25
(*temporary) = nil
(*temporary) = <table> {
 Item Name = "Bloodcredit"
 Item Count = 17
 Transaction Time = "1 |4hour:hours;"
 Transaction Type = "move"
}
(*temporary) = "1 |4hour:hours;"
(*temporary) = 0
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = "1 |4hour:hours;"
(*temporary) = "1 |4hour:hours;"
(*temporary) = "%d |4hour:hours;"
(*temporary) = 1
(*temporary) = "1 |4hour:hours;"
(*temporary) = 1
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'GuildBankTransactions' (a nil value)"
queryCount = 3
tType = "move"
tName = "Bloodcredit"
itemLink = "[Swiftthistle]"
count = 17
tab1 = "Ingredients"
tab2 = "Ingredients"
year = 0
month = 0
day = 0
hour = 1
source

Code:
local tType, tName, itemLink, count, tab1, tab2, year, month, day, hour;
local queryCount = 0;
local messageCount = 0;

local function refreshLogInfo()
  queryCount = 0;
  for tab = 1,GetNumGuildBankTabs() do
    QueryGuildBankLog(tab);
    QueryGuildBankTab(tab);
  end		
  QueryGuildBankLog(MAX_GUILDBANK_TABS+1);
end      

local function getLogInfo()
  queryCount = queryCount + 1;
  if queryCount == GetNumGuildBankTabs() + 1 then
    for tab = 1, GetNumGuildBankTabs() do
      local maxTabTrans = GetNumGuildBankTransactions(tab);
        -- For each transaction in the current tab extract the information required.
        for trans = 1,maxTabTrans do
          tType, tName, itemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab, trans);
            -- If this is the last transaction then we want to display it in some form
            if trans == maxTabTrans then
              if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end                
              if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2); end
                GuildBankTransactions[tab] = {
                       ["Transaction Type"] = tType,
                       ["Item Name"] = tName,
                       ["Item Count"] = count,
                       ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
              }
         
              print("===")
              print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");           
            end
         end
      end
      -- Now repeat the same process for the money log
      local maxMoneyTrans = GetNumGuildBankMoneyTransactions();
      for trans = 1,maxMoneyTrans do
        tType, tName, amount, years, months, days, hours = GetGuildBankMoneyTransaction(trans);
        if ( trans == maxMoneyTrans ) then
          print("$$$")
          print("Last Money Transaction: ",maxMoneyTrans,tType, tName, amount, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");
          print("=>End of Transactions<=")
       end
     end
  end
end


local function onEvent(self,event,...)

             -- Only work if the Guild Bank Frame is open 
	if ( not GuildBankFrame:IsVisible() ) then
		return;
	end

	if ( event == "GUILDBANKFRAME_OPENED" ) then
                  refreshLogInfo();                  
                  messageCount = messageCount + 1;                  
                  if ( messageCount > 2 ) then
                  print("^^^")                                                   
                  elseif ( messageCount > 1 ) then
                  message("LogUpdated")  
                  elseif ( messageCount > 0 ) then
                  message("Reload Vault to make sure Addon Works Properly")                
                  end
                  
            elseif ( event == "BAG_UPDATE" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_ITEM_LOCK_CHANGED" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_MONEY" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_TABS" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_TEXT" ) then
                  refreshLogInfo();

            elseif ( event == "GUILDBANK_UPDATE_WITHDRAWMONEY" ) then
                  refreshLogInfo();

	elseif ( event == "GUILDBANKLOG_UPDATE" ) then
                  getLogInfo();
                           
	end
end

local evFrame = CreateFrame("Frame","evFrame",UIParent);
evFrame:SetScript( "OnEvent", onEvent );
evFrame:RegisterEvent( "PLAYER_LOGIN" );
evFrame:RegisterEvent( "GUILDBANKLOG_UPDATE" );
evFrame:RegisterEvent( "GUILDBANKFRAME_OPENED" );
evFrame:RegisterEvent( "BAG_UPDATE" );
  Reply With Quote
05-23-10, 04:19 PM   #94
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
the pairs function is a lua function that allows you loop through the table one *record* at a time.

In fact I just recalled this side of things.

for key,value in pairs(aTable)
print(key,value)
end

key can either be 1,2,3, etc for each entry or it can hold the key itself.

EG.

aTable = {
aKey = 1,
anotherKey = "something",
yetAnotherKey = true,
"somerandomevaluewithnokey",
}

the for loop above would show the following although not necessarily in that order as pairs is not an ordered list although I don't usually mix key and non keys in the same table so not 100% sure this will result exactly like this.
aKey 1
anotherKey "something"
yetAnotherKey true
4 "somerandomvaluewithnokey"
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 04:24 PM   #95
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Okay, the reason for the GuildBankTransactions = nil and trying to index it is because you haven't made sure the table exists.

At the top of the lua file add that table name in so it looks somewhat ( spelling aside ) like this:

GuildBankTransactions = GuildBankTransactions or {}

You can also add it above the line where you are trying to set the values into it so that it uses your currently stored table and not just the blank one created at the top of the file.

That should then allow you to do the following type of thing ( eg index it ):
GuildBankTransactions[tab] = { somevalues you want to set to it in a table }.

Your WTF file should then show up as something similar to this:
GuildBankTransactions = {
[1] = {
the values that you got when querying the guild bank etc
},
[2] = {
some other values for the other tab etc
}
}

This is from memory so I apologise if it isn't exactly like that.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 04:25 PM   #96
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
so the pairs function appears not too demanded for what i am trying to do. but if u dont mind what would u use it for. i notice u like me dont really see the point to it but for my future reference what is it good for
  Reply With Quote
05-23-10, 04:32 PM   #97
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
*goes on his knees to crystal and starts praying as he kisses her feet/shoes*
my goddess!!! you have powerful awesomeness

rofl, but no that awesome. thank you once more
you have no idea how lucky i am to have a person as nice as u to help me
i would of been stuck on this for weeks, and mean while i would of been flipped off by many other programmers that i came across before.. some seam to be ignorant-.-''
but you.. a man is luck to have you and you make the world better by each time u show ur kindness. propps to that girl

any idea about the error at startup of wow, when i first log in i get a BAG_UPDATE error but after that it seams to not be an error whats o ever
  Reply With Quote
05-23-10, 04:34 PM   #98
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Originally Posted by clowcadia View Post
so the pairs function appears not too demanded for what i am trying to do. but if u dont mind what would u use it for. i notice u like me dont really see the point to it but for my future reference what is it good for
Its a useful function that I use alot in my own addons when I want to run through the whole table recursively and not extract information specifically. Say, for debugging purposes or for display purposes.

EG. I have a scrolling list and I want the last transaction for each tab to be added to the list.

One way to do it is to read the transaction and add it to the scrolling list straight away. Another option is to store it all in the table and then periodically refresh the scrolling list by running through the table and displaying its contents. The code I have been showing you over the last few days are different options in one project. You can pick and choose how you want to proceed.

Print the line out when you come across it ? Then you don't need the for loop.

Print all the lines out after you have created the table as a whole ? Then the for/end pairs block would be useful as those few lines will work for a table with only 1 item and for a table with 1000 items, it just keeps going until it doesn't see any more information.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 04:39 PM   #99
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Originally Posted by clowcadia View Post
*goes on his knees to crystal and starts praying as he kisses her feet/shoes*
my goddess!!! you have powerful awesomeness

rofl, but no that awesome. thank you once more
you have no idea how lucky i am to have a person as nice as u to help me
i would of been stuck on this for weeks, and mean while i would of been flipped off by many other programmers that i came across before.. some seam to be ignorant-.-''
but you.. a man is luck to have you and you make the world better by each time u show ur kindness. propps to that girl

any idea about the error at startup of wow, when i first log in i get a BAG_UPDATE error but after that it seams to not be an error whats o ever
Hmm, hard to say, I've not needed to use BAG_UPDATE before to have come across a problem. But when I have come across a problem at start up it is usually due to what function is being called when and simply moving the function to another event or inside an event if it isn't in one usually resolves it.

EG.

Top of lua file or inside ADDON_LOADED/PLAYER_LOGIN like events
local n = GetNumGuildBankTabs()

May result in an error because the GetNumGuildBankTabs function doesn't exist yet as it may only load the GuilBank UI file when the GuildBankFrame is opened. Hence the reason for putting that specific code in the event blocks.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-23-10, 04:50 PM   #100
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
hehe ok i see what ur saying, ill play aroudn with idea till i get it right but new probleme that i cant figure out

Code:
Message: ...dOns\GuildBankTransactions\GuildBankTransactions.lua:33: attempt to index global 'GuildBankTransactionsTabs' (a nil value)
Time: 05/23/10 18:46:55
Count: 1
Stack: ...dOns\GuildBankTransactions\GuildBankTransactions.lua:33: in function <...dOns\GuildBankTransactions\GuildBankTransactions.lua:14>
...dOns\GuildBankTransactions\GuildBankTransactions.lua:97: in function <...dOns\GuildBankTransactions\GuildBankTransactions.lua:60>

Locals: (for index) = 1
(for limit) = 2
(for step) = 1
tab = 1
maxTabTrans = 25
(for index) = 25
(for limit) = 25
(for step) = 1
trans = 25
(*temporary) = nil
(*temporary) = <table> {
 Item Count = 17
 Item = "[Swiftthistle]"
 Transaction Type = "move"
 Transaction Time = "1 |4hour:hours;"
 Player's Name = "Bloodcredit"
}
(*temporary) = "1 |4hour:hours;"
(*temporary) = 0
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = "1 |4hour:hours;"
(*temporary) = "1 |4hour:hours;"
(*temporary) = "%d |4hour:hours;"
(*temporary) = 1
(*temporary) = "1 |4hour:hours;"
(*temporary) = 1
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'GuildBankTransactionsTabs' (a nil value)"
queryCount = 3
tType = "move"
tName = "Bloodcredit"
itemLink = "[Swiftthistle]"
count = 17
tab1 = "Ingredients"
tab2 = "Ingredients"
year = 0
month = 0
day = 0
hour = 1
source i am assuming

Code:
local function getLogInfo()
  queryCount = queryCount + 1;
  if queryCount == GetNumGuildBankTabs() + 1 then
    for tab = 1, GetNumGuildBankTabs() do
      local maxTabTrans = GetNumGuildBankTransactions(tab);
        -- For each transaction in the current tab extract the information required.
        for trans = 1,maxTabTrans do
          tType, tName, itemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab, trans);
            -- If this is the last transaction then we want to display it in some form
            if trans == maxTabTrans then
              if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end                
              if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2); end
               GuildBankTransactions = GuildBankTransactions or {}
                GuildBankTransactionsTabs[tab] = {
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Item"] = itemLink,
                       ["Item Count"] = count,
                       ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
              }               
              print("===")
              print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");           
            end
         end
      end
      ------SOMEWHERE BELLOW
      local maxMoneyTrans = GetNumGuildBankMoneyTransactions();
      for trans = 1,maxMoneyTrans do
        tType, tName, amount, years, months, days, hours = GetGuildBankMoneyTransaction(trans);
        if ( trans == maxMoneyTrans ) then
         GuildBankTransactions = GuildBankTransactions or {}
          GuildBankTransactionsMoney = {
                       ["Transaction Type"] = tType,
                       ["Player's Name"] = tName,
                       ["Amount"] = amount,
                       ["Transaction Time"] = RecentTimeDate(year, month, day, hour),
              }
          print("$$$")
          print("Last Money Transaction: ",maxMoneyTrans,tType, tName, amount, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");
          print("=>End of Transactions<=")
       end
     end
  end
end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Trying to see guild bank transaction information


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off