Thread Tools Display Modes
05-27-10, 05:36 AM   #241
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
hehe and also relaised that we should have not used guild bank slots as an event to run actions we should just have it as a green light for bag update to do its stuff, also under a count but a count has to be reset at guild vault window visible

and come to think of it bank change should also be a green light.. i shall play with the idesa
  Reply With Quote
05-27-10, 09:38 AM   #242
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Thats the best way to learn Play with ideas, try them out. Use Print or Message to see what the values are. Print will be better though in case of nil values

You've come a long way in a short time and with an area relatively new and somewhat limited you have done pretty well.
__________________


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-28-10, 12:32 AM   #243
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Aha, just found something else out with some browsing on the wowprogramming site.

QueryGuildBankLog(tab) triggers GUILDBANKLOG_UPDATE event which then allows you to use the various log functions.

QueryGuildBankTab(tab) triggers GUILDBANKBAGSLOTS_CHANGED event

QueryGuildBankText(tab) triggers GUILDBANK_UPDATE_TEXT event which then allows you to get the text by using text = GetGuildBankText(tab)

They also mention that because we are querying a remote server the information may not be immediately available. So, the fact that we are calling the first 2 in a for loop for each tab may explain why we have problems getting the same number each time.

It might be that we will have to use an update routine to help time the queries so that they are apart enough to deal with the data one tab at a time and not in a big clump and hope we got it all.
__________________


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-28-10, 11:07 AM   #244
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ah now make sense
i am also assuming we are talking about this 2
if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end

witch i also got a question, i know one of them is the tab1 values that will appear under our tables, but did u say they should give me the tab name? because the tab names i get tab 1 and 2 , where as they are really ingredient and rares

i am gonna write a new code yours is simple yet many functions that i dont understand how they work. so by making my own maybe i will understand how the whole thing runs
  Reply With Quote
05-28-10, 01:20 PM   #245
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok, so if we try and prevent updates from being cluttered is this possible
if recordingTime(d,+1,m) then---day,hour,minute

another question, what is the difference between then and do, else and elseif. and what do they really mean or do
  Reply With Quote
05-28-10, 02:56 PM   #246
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by clowcadia View Post
ok, so if we try and prevent updates from being cluttered is this possible
if recordingTime(d,+1,m) then---day,hour,minute

another question, what is the difference between then and do, else and elseif. and what do they really mean or do
Yes, when we read the transaction you can get an approximate transaction time based on the time we recorded when we started reading them. The difference will be minimal enough to not be a big problem. My earlier post I think gave a good example that seemed to work with a few tests I did. If the transaction datetime is earlier than an hour ago include it in the list of transactions otherwise we have finished and can go away and play rofl.

Code:
if ( statement is true ) then 
   FirstFunctionHere        -- as this test resulted in a correct result
elseif ( this statement is true ) then
  SecondFunctionHere     -- as that test failed but this one succeeded
else
   LastFunctionHere        -- none of the previous tests passed so do this
end
To understand elseif further .. the above can also be written as follows:

Code:
if ( statement is true ) then 
   FirstFunctionHere        -- as this test resulted in a correct result
else                             -- that statement was false so check the next
  if ( this statement is true ) then
     SecondFunctionHere     -- this statement passed so do something
   else
     LastFunctionHere        -- none of the previous tests passed so do this
   end
end
The result is the same but the code is more euch ( a technical term I assure you rofl ). elseif basically puts the else and if on the same line allowing you to remove an end that is no longer necessary.

This for loop is when we want to repeat the same process with just a number order being different. Step defaults to 1 so is not needed if we are incrementing index by 1.
We are basically saying for each number that occurs between start and end and increasing by step each time do the following block of code

Code:
for index = start,end,step do
  print( index, " of ", end )              -- prints ( 1 of 10 ) if start is 1 and end is 10 and repeats until index is more than end
end
This is similar but this time we are traversing through a list of values in a table format. Each *pair* is an index and value variable. These hold the values you want to validate and use for each pair in the list.

Code:
for index,value in pairs(tableName) do
   print(index,value)                    -- prints the value of index and value in the current pair of values
end
The general rule is that each if needs a then and end to be value, each for needs a do and 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-28-10, 03:01 PM   #247
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by clowcadia View Post
ah now make sense
i am also assuming we are talking about this 2
if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end

witch i also got a question, i know one of them is the tab1 values that will appear under our tables, but did u say they should give me the tab name? because the tab names i get tab 1 and 2 , where as they are really ingredient and rares

i am gonna write a new code yours is simple yet many functions that i dont understand how they work. so by making my own maybe i will understand how the whole thing runs
I haven't actually confirmed what valid results are outputted with the tab ID and Names.

This is the wowwiki info on that function :
name, icon, isViewable, canDeposit, numWithdrawals, remainingWithdrawals = GetGuildBankTabInfo(tab);

This basically gives us the name of the chosen tab.

So if you want the name for tab 1 you could just do tab1Name = GetGuildBankTabInfo(1).

Looking at this page may help you understand things further : http://www.wowwiki.com/API_GetGuildBankTransaction

But basically we can use this function to get something mroe descriptive for the tabs instead of 1 and 2. But the choice is yours.
__________________


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-28-10, 03:12 PM   #248
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok some what understand another though i had though, in the pairs function what does value stand for is it
Code:
{[value] = blah(blah will be displayed?)}
or is it
Code:
{[value](its name will display)}
under print(index,value)
something tells me this is it
Code:
{[index] = value}
but if this is the case then i am assuming this is the function index,value in
Code:
pairs(tableName[subTableTag])
  Reply With Quote
05-28-10, 03:21 PM   #249
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ahh ok now i am fully understanding that function
since u duplicated, not sure if u have more tabs in ur guild, but do u have more then 2 appear? if no is there a function that querys guild for the bumber of tabs(if yes and its in the code just say check the code.. studdieng my math atm) so i was thinknig query guild and put number of tabs in a count, and use the count instead of entering in the
Code:
if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end
have it
do some kind of sequence that says for each tab make a table that has each tab in it
  Reply With Quote
05-28-10, 03:56 PM   #250
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by clowcadia View Post
ok some what understand another though i had though, in the pairs function what does value stand for is it
Code:
{[value] = blah(blah will be displayed?)}
or is it
Code:
{[value](its name will display)}
under print(index,value)
something tells me this is it
Code:
{[index] = value}
but if this is the case then i am assuming this is the function index,value in
Code:
pairs(tableName[subTableTag])
Yep, you're getting there.

you use pairs wherever you have a table. Sometimes value in that example will be a subtable so this is where that example pairs function a few pages back comes into play as it repeats itself until it has run out of things to look at.

EG.
Code:
tableName = {
   subTableName = {
      subsubTableName = {
          subsubKey1 = "A Value",
          subsubKey2 = 12,
      },
      subKey1 = "Another Value",
      subKey2 = true,
   },
   key1 = "Yet Another Value",
   key2 = 34,
}
Code:
for key,value in pairs(tableName) do
    print(key,value)
end
This will print out something similar to the following:
Code:
subTableName,table:xxxxx
key1,"Yet AnotherValue"
key2,34
Because the subtables are all within each other it won't display them because, with the for loop above we have not told it to keep looking through tables ( recursive search ). So lets change things a bit.

Code:
for key,value in pairs(tableName) do
    if ( type(value) == "table" ) then
       for key1,value1 in pairs(value) do 
           print(key1,value1)
       end
    else
       print(key,value)
    end
end
This version will print out the following ( or similar )
Code:
subTableName,table:xxxxx
subsubTableName, table:xxxxx
subKey1, "Another Value"
subKey2, true
key1,"Yet AnotherValue"
key2,34
But still we haven't got all the details. And what if in a big addon the number of tables within tables and other values are a lot more complex. We need a recursive table function. You could probably get fancy with one function to print, validate and change table values but we will do one recursive function per requirement for now.

Code:
function printTableContents(tableName)
  for key,value in pairs(tableName) do
     if ( type(value) == "table" ) then
        printTableContents(value)
     else
        print(key,value)
     end
  end
end
This function can be copied to do anything you want pretty much, just change the print(key,value) section to do what you want with the ["key"]=value match.
__________________


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-28-10, 04:02 PM   #251
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by clowcadia View Post
ahh ok now i am fully understanding that function
since u duplicated, not sure if u have more tabs in ur guild, but do u have more then 2 appear? if no is there a function that querys guild for the bumber of tabs(if yes and its in the code just say check the code.. studdieng my math atm) so i was thinknig query guild and put number of tabs in a count, and use the count instead of entering in the
Code:
if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end
have it
do some kind of sequence that says for each tab make a table that has each tab in it
That particular example I used purely for the 2 tab values that are in each transaction line for each tab. Sometimes they are nil values but other times I believe they show the number of the tab the movement came from and to.

But the function is able to be used on any variable that is an existing tab number.

So if you have 4 tabs you could use that function to get the name of each tab and use that as the key to the tabs entries in the table instead of using just tab. Choice is yours. But where I used them was for the tabs mentioned in each transaction of which there are only 2. Source Tab and Destination Tab.

And yes, go read the code again. The function is in there at least once If you can't find it then check this thread again because its here several times too rofl.
__________________


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-28-10, 06:09 PM   #252
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
Code:
    if ( type(value) == "table" ) then ---what does this do?
       for key1,value1 in pairs(value) do---what does this do?
i think i understand most but a few entries
  Reply With Quote
05-28-10, 06:13 PM   #253
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
Originally Posted by Xrystal View Post
That particular example I used purely for the 2 tab values that are in each transaction line for each tab. Sometimes they are nil values but other times I believe they show the number of the tab the movement came from and to.

And yes, go read the code again. The function is in there at least once If you can't find it then check this thread again because its here several times too rofl.
lol i am not sure if i got this right? but maybe u have not realized when i asked i was wondering if there was a key and value set for az tab in guild bank is there a code. but the first paragraph said no, we only made 2 values for for our own keys instead having a system determined value for the given key we asked it to find
  Reply With Quote
05-28-10, 06:44 PM   #254
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by clowcadia View Post
Code:
    if ( type(value) == "table" ) then ---what does this do?
       for key1,value1 in pairs(value) do---what does this do?
i think i understand most but a few entries

if ( type(value) == "table" ) then ...
This means, if the value is a table type then do the next block of code

for key1,value1 in pairs(value ) do ...
This means, for each key,value pair in the table called value do the next block of code
__________________


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-28-10, 06:45 PM   #255
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
i tryd to make anew frame, or make my own frame instead and it doesn't seam to work, so what so special about evFrame
(i changed al evFrame s to gvltFrame)get errors
  Reply With Quote
05-28-10, 06:46 PM   #256
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
I think many of the questions in this thread would be unnecessary if you'd read Programming in Lua - even when you are more familiar with Lua it's still a very good reference.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-28-10, 08:36 PM   #257
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by Torhal View Post
I think many of the questions in this thread would be unnecessary if you'd read Programming in Lua - even when you are more familiar with Lua it's still a very good reference.
Yep, my brother loaned me a copy of his, and I conveniently still have it in my room rofl.
__________________


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-28-10, 09:06 PM   #258
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
hehe, i like how they have it for free online
i am getting a book soon too
but i got a question that i may not find in documentations, i read somethings online about the pairs function but i doing think i found anything about this
i managed to make it work but i have 2 keys and values, and it only shows me 1 for each
and i am assuming doing the pairs function we cant use subtables like this like we did table[sub]
  Reply With Quote
05-28-10, 09:31 PM   #259
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,933
Originally Posted by clowcadia View Post
hehe, i like how they have it for free online
i am getting a book soon too
but i got a question that i may not find in documentations, i read somethings online about the pairs function but i doing think i found anything about this
i managed to make it work but i have 2 keys and values, and it only shows me 1 for each
and i am assuming doing the pairs function we cant use subtables like this like we did table[sub]
Yep, my example earlier explains how you can repeat the process for as many sub tables you have although I am not sure if there is a depth limit. There also was another thread on here somewhere that was talking about it as well which is where I initially learned how to do 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-29-10, 02:18 AM   #260
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
hehe i am sorry for asking u for the questions i should be finding myself
but i think this one is legit

i got this error
Code:
Message: Interface\AddOns\GVLT\core.lua:32: attempt to perform arithmetic on local 'key1' (a string value)
Time: 05/29/10 04:15:25
Count: 1
Stack: Interface\AddOns\GVLT\core.lua:32: in function <Interface\AddOns\GVLT\core.lua:19>
Interface\AddOns\GVLT\core.lua:73: in function <Interface\AddOns\GVLT\core.lua:47>

Locals: (for generator) = <function> defined =[C]:-1
(for state) = <table> {
 currentDate = <table> {
 }
}
(for control) = "currentDate"
key = "currentDate"
value = <table> {
 sessionCount = <table> {
 }
}
(for generator) = <function> defined =[C]:-1
(for state) = <table> {
 sessionCount = <table> {
 }
}
(for control) = "sessionCount"
key1 = "sessionCount"
value1 = <table> {
}
(*temporary) = 1
(*temporary) = <table> {
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to perform arithmetic on local 'key1' (a string value)"
sessionCount = 1
recordingNewSession = <function> defined @Interface\AddOns\GVLT\core.lua:19
currentDate = "05/29/10"
and this is my source dcode highlighting the line
i am totally confudled

Code:
-- Author      : Andrew
-- Create Date : 5/28/2010 8:26:28 PM
local addonLoadedCount= 0;
local sessionCount= 0;
local currentDate = date("%m/%d/%y")
local currentTime = date("%H:%M:%S")


local function recordingSessionInfo()
sessionInfo = sessionInfo or {}

sessionInfo = {
 currentDate = {   
 }
}

end

local function recordingNewSession()

sessionInfo = {
 currentDate = { 
  sessionCount = { 
  }
 }
}

end



local function onEvent(self,event,...)
----------------------------------------------
 if ( event == "ADDON_LOADED" ) then
addonLoadedCount = addonLoadedCount + 1;

  if ( sessionInfo == nil ) then
   recordingSessionInfo()
   print("New Log File Begun")
  else
  if ( addonLoadedCount == 3 ) then
  print("GVLT Loaded")
   for key,value in pairs(sessionInfo) do 
    if not( value == currentDate ) then
    print("Current Day Log Loaded")
    else
	tinsert(sessionInfo)                      
    end           
   end
   else      
   end    
  end
  end
   
 ---------------------------------------------
  if ( event == "GUILDBANKFRAME_OPENED" ) then 
  sessionCount = sessionCount + 1;
  recordingNewSession()   
  
   for key,value in pairs(sessionInfo) do
    if ( type(value) == "table" ) then
      for key1,value1 in pairs(value) do
       if not ( key1 == sessionCount ) then
        sessionCount = sessionCount + key1;
        recordingNewSession()
        print("Session Continuesion")
       else
       tinsert( sessionInfo, currentDate, sessionCount )
       print("Succesfully Created a New Session")
       end       
      end    
     end
   end 
   
  end
 
 -----------------------------------------------
if ( event == "GUILDBANKFRAME_OPENED" ) then

end

end

local evFrame = CreateFrame("Frame","evFrame",UIParent);
evFrame:SetScript( "OnEvent", onEvent );
evFrame:RegisterEvent( "ADDON_LOADED" );
evFrame:RegisterEvent( "GUILDBANKFRAME_OPENED" );
evFrame:RegisterEvent( "GUILDBANKFRAME_CLOSED" );
  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