### Author Topic: A Graph Bot  (Read 4284 times)

0 Members and 1 Guest are viewing this topic.

#### Herodes

• Guest
##### A Graph Bot
« on: 27 May, 2004, 19:11:39 »
hey I was trying to get the code below to show the user count like this ...
Code: [Select]
`  100% (200 users)             -- ------   50% (100 users)--                                         79--                                          ?--                                          ?--                                          ?   no users                             ?`Is there something that I am doing terribly wrong? because it doesn't come up with any feedback or even errors when the command is typed ... ?(
Here is what I can't get to work ....

Code: [Select]
`gBot = "CountGraph"userCount = frmHub:GetUsersCount()maxU = frmHub:GetMaxUsers()midU = maxU/2function Main() frmHub:UnregBot(gBot) frmHub:RegBot(gBot)endfunction DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if (cmd=="!graph") then GiveGraph() end endendfunction GiveGraph() if userCount >= maxU then SendFull() elseif userCount == (maxU*90/2) then Send90Prc() elseif userCount == (maxU*80/2) then Send80Prc() elseif userCount == (maxU*70/2) then Send70Prc() elseif userCount == (maxU*60/2) then Send60Prc() elseif userCount == (maxU*50/2) then Send50Prc() elseif userCount == (maxU*40/2) then Send40Prc() elseif userCount == (maxU*30/2) then Send30Prc() elseif userCount == (maxU*20/2) then Send20Prc() elseif userCount == (maxU*10/2) then Send10Prc() elseif userCount == 1 then SendToAll(gBot, "Where did everybody go ?") endendend function Send10Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send20Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send30Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send40Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send50Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send60Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send70Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send80Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)endfunction Send90Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t?" tMsg = tMsg.."\r\n\t"..userCount tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n - \t?" tMsg = tMsg.."\r\n   0%(0 users)\t?" SendToAll(gBot, tMsg)end`
pls help .. .I am trying to learn how to do this

#### PtokaX forum

##### A Graph Bot
« on: 27 May, 2004, 19:11:39 »

#### tezlo

• Triple Ace
• Posts: 225
• Karma: +1/-0
##### (No subject)
« Reply #1 on: 27 May, 2004, 20:00:12 »
in your script, userCount only gets assigned once at start
if you want the actual value you'll need to frmHub:GetUsersCount() everytime the command is typed

i'm sure you'll find a more elegant way of coding this
for now i came up with a horizontal bar, maybe it could help you on the way

Code: [Select]
`local length = 10local ratio = frmHub:GetUsersCount()/(frmHub:GetMaxUsers()/length)SendToAll(">> ["..strrep(" ", ratio).."?"..strrep(" ", length-ratio).."]")`

#### Herodes

• Guest
##### (No subject)
« Reply #2 on: 27 May, 2004, 21:00:41 »
Thanks for the Input tezlo .. ;)
I 'll keep it in mind for later .. :D
Quote
for now I managed :getting the user count and producing one graph on full hub ...
and one graph on less than that ... this is a problem since I need it to get it on the appropriate line. Look below  pls ...
ex:

On full Hub it shows:
Code: [Select]
`    100% (3 users)       3  - ?  - ?  - ?  - ?   50% (1.5 users)      ?  - ?  - ?  - ?  - ?    0%(0 users) ? `
--On 50% currently shows :
Code: [Select]
`    100% (6 users)  -  -  -  -   50% (3 users)  -  -  - 3    0%(0 users) ?`
This is the code so far ... pls help .. I got lot's of ideas for it but I don't have enough knowledge of Lua ..
For example I would want to get a !snapcount command and a way to be able to get older usercounts ...
After all, what good is a graph if u have nothing to compare it with ... :D

[*edit*] I was stupid enough to think that 2 is the same with 100 ... edited all the parts that were like (maxU*90/2)  to (maxU*90/100)     :rolleyes:

Code: [Select]
`-- GraphBot-- by HerodesgBot = "CountGraph"function Main() frmHub:UnregBot(gBot) frmHub:RegBot(gBot)endfunction DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if (cmd=="!graph") then GiveGraph() end endendfunction GiveGraph() userCount, maxU = "" GetNumbers() if userCount >= maxU then SendFull() elseif userCount < maxU then if userCount <= (maxU*90/100) and userCount > (maxU*80/100)  then Send90Prc() elseif userCount <= (maxU*80/100) and userCount > (maxU*70/100) then Send80Prc() elseif userCount <= (maxU*70/100) and userCount > (maxU*60/100) then Send70Prc() elseif userCount <= (maxU*60/100) and userCount > (maxU*50/100) then Send60Prc() elseif userCount <= (maxU*50/100) and userCount > (maxU*40/100) then Send50Prc() elseif userCount <= (maxU*40/100) and userCount > (maxU*30/100) then Send40Prc() elseif userCount <= (maxU*30/100) and userCount > (maxU*20/100) then Send30Prc() elseif userCount <= (maxU*20/100) and userCount > (maxU*10/100) then Send20Prc() elseif userCount <= (maxU*10/100) and userCount > 1then Send10Prc() elseif userCount <= 1 then SendToAll(gBot, "Where did everybody go ?") end endend function GetNumbers() userCount, maxU = "" userCount = frmHub:GetUsersCount() maxU = frmHub:GetMaxUsers() midU = maxU/2 return userCount, maxU, midUendfunction Send10Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n  50% ("..midU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send20Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n  50% ("..midU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send30Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n  50% ("..midU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send40Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n  50% ("..midU.." users)" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send50Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -?" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send60Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n  50% ("..midU.." users)\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send70Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send80Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n -" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction Send90Prc() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)" tMsg = tMsg.."\r\n\t\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)endfunction SendFull() tMsg = "\r\n" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t"..userCount tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n  50% ("..midU.." users)\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n - \t\t ?" tMsg = tMsg.."\r\n   0%(0 users)\t ?" SendToAll(gBot, tMsg)end`
« Last Edit: 27 May, 2004, 21:28:20 by Herodes »

#### Herodes

• Guest
##### (No subject)
« Reply #3 on: 27 May, 2004, 21:35:12 »
The last posted piece of code is working as expected ..
Now I will try to make it remember the previous 2 (+1 the current) and display them all at once ... in the same message ...
I 'll need some help with tables but I wish I can surprise me ...

#### Herodes

• Guest
##### (No subject)
« Reply #4 on: 28 May, 2004, 05:22:50 »
Some more work on tables proved worthy ...

They brought the code amount down.
Code: [Select]
`-- GraphBot-- by Herodes-- optimised version ( is/was 120/291 lines)gBot = "CountGraph" fullcell = "    ?\t"emptycell = "\t"tTable = {}function Main() frmHub:UnregBot(gBot) frmHub:RegBot(gBot)endfunction DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd~=nil then if cmd=="!graph" then GiveGraph() end endendendfunction AddValues() tTable = {} GetNumbers() tTable[11] = Time tTable[12] = hubshare if userCount >= maxU then tTable[1] = userCount tTable[2] = fullcell tTable[3] = fullcell tTable[4] = fullcell tTable[5] = fullcell tTable[6] = fullcell tTable[7] = fullcell tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount < maxU then if userCount <= (maxU*90/100) and userCount > (maxU*80/100)  then tTable[1] = emptycell tTable[2] = userCount tTable[3] = fullcell tTable[4] = fullcell tTable[5] = fullcell tTable[6] = fullcell tTable[7] = fullcell tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*80/100) and userCount > (maxU*70/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = userCount tTable[4] = fullcell tTable[5] = fullcell tTable[6] = fullcell tTable[7] = fullcell tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*70/100) and userCount > (maxU*60/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = userCount tTable[5] = fullcell tTable[6] = fullcell tTable[7] = fullcell tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*60/100) and userCount > (maxU*50/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = emptycell tTable[5] = userCount tTable[6] = fullcell tTable[7] = fullcell tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*50/100) and userCount > (maxU*40/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = emptycell tTable[5] = emptycell tTable[6] = userCount tTable[7] = fullcell tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*40/100) and userCount > (maxU*30/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = emptycell tTable[5] = emptycell tTable[6] = emptycell tTable[7] = userCount tTable[8] = fullcell tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*30/100) and userCount > (maxU*20/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = emptycell tTable[5] = emptycell tTable[6] = emptycell tTable[7] = emptycell tTable[8] = userCount tTable[9] = fullcell tTable[10] = fullcell elseif userCount <= (maxU*20/100) and userCount > (maxU*10/100) then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = emptycell tTable[5] = emptycell tTable[6] = emptycell tTable[7] = emptycell tTable[8] = emptycell tTable[9] = userCount tTable[10] = fullcell elseif userCount <= (maxU*10/100) and userCount > 1 then tTable[1] = emptycell tTable[2] = emptycell tTable[3] = emptycell tTable[4] = emptycell tTable[5] = emptycell tTable[6] = emptycell tTable[7] = emptycell tTable[8] = emptycell tTable[9] = emptycell tTable[10] = userCount elseif userCount == 1 then SendToAll(gBot, "Where did everybody go ?") end end return tTableendfunction GiveGraph() AddValues() tMsg = "\r\n" tMsg = tMsg.."\r\nShare\t:\t"..tTable[12].." gb" tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t"..tTable[1] tMsg = tMsg.."\r\n -\t\t"..tTable[2] tMsg = tMsg.."\r\n -\t\t"..tTable[3] tMsg = tMsg.."\r\n -\t\t"..tTable[4] tMsg = tMsg.."\r\n -\t\t"..tTable[5] tMsg = tMsg.."\r\n  50% ("..midU.." users)\t"..tTable[6] tMsg = tMsg.."\r\n -\t\t"..tTable[7] tMsg = tMsg.."\r\n -\t\t"..tTable[8] tMsg = tMsg.."\r\n -\t\t"..tTable[9] tMsg = tMsg.."\r\n -\t\t"..tTable[10] tMsg = tMsg.."\r\n   0%(0 users)\t    ?" tMsg = tMsg.."\r\nTime\t:\t"..tTable[11] SendToAll(gBot, tMsg)endfunction GetNumbers() h, m, Time, userCount, maxU, hubshare = "" h = date("%H") m = date("%M") Time = h..":"..m userCount = frmHub:GetUsersCount() maxU = frmHub:GetMaxUsers() midU = maxU/2 hubshare = format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024))) return Time, userCount, maxU, midU, hubshareend`
I was hoping for a way to get the values in the tTable stored for three different timings ... I don't know how to do it . .
Can someone give me a hint ... ? .. pls?  :D
I want it to display something like ...
Code: [Select]
` Share : 43.35 gb 35.00 gb ... 100% (10 users)     ... - ... - ... - 7 ... -        ? 6 ...  50% (5 users)   ?   ? ... -    ?    ? ... -    ?    ? ... -    ?    ? ... -    ?    ? ...   0%(0 users)    ?        ? ...Time : 04:08 03:15      ...`could make the proper tabbing in this font ..

[*edit*] removed 7 lines of scrap code I had posted with it..
« Last Edit: 28 May, 2004, 05:37:45 by Herodes »

#### NotRabidWombat

• Lord
• Posts: 384
• Karma: +2/-0
##### (No subject)
« Reply #5 on: 28 May, 2004, 06:32:56 »
Code: [Select]
`function AddValues()   tTable = {}   GetNumbers()   tTable[11] = Time   tTable[12] = hubshare   local pivot = 11 - floor(userCount / maxU * 10);   for i , 1, 10 do      if ( i < pivot ) then         tTable[i] = emptycell;      elseif ( i == pivot ) then         tTable[i] = userCount;      else         tTable[i] = fullcell;      end            end   -- Do anything else you want   return tTable;end`

I like childish behavior. Maybe this post will be deleted next.

#### Herodes

• Guest
##### (No subject)
« Reply #6 on: 28 May, 2004, 07:29:29 »
Yep, it is true .. it can be further optimised in this way .. although I haven't completely understood this part:
Code: [Select]
`...floor(userCo...`
This is the script up to now ... :) it has been updated .. but I still need a way to get the output values in tmpTable into tTime1, tTime2, tTime3 ....
this is something I don't know how to do ..
I want to know which is the best way to go for that , whatever I tried had most of the times made it in to an error in PtokaX ... like       attempt to concat a nil value .. :(
!! Help me !!   :D :D

Code: [Select]
`-- GraphBot-- by Herodes-- optimised version ( is/was 120/291 lines)-- fixed correction of gb&tb display-- now the user count centers on top of the column...-- input from NotRambitWombat made it even shorter.. :)gBot = "CountGraph" fullcell = "    ?\t"emptycell = "\t"tTime1 = {}tTime2 = {}tTime3 = {}tmpTable = {}function Main() frmHub:UnregBot(gBot) frmHub:RegBot(gBot)endfunction DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd~=nil then if cmd=="!graph" then GiveGraph() end end endendfunction AddValues() tmpTable = {} GetNumbers() tmpTable[11] = Time tmpTable[12] = hubshrS if usrC > 1 then local pivot = 11 - floor(usrC / maxU * 10) for i = 1,10 do if ( i < pivot ) then tmpTable[i] = emptycell elseif ( i == pivot ) then tmpTable[i] = userCount else tmpTable[i] = fullcell end         end end if usrC == 1 then SendToAll(gBot, "Where did everybody go ?") end   return tTableendfunction GiveGraph() AddValues() tMsg = "\r\n\t\t\t"..frmHub:GetHubBotName() tMsg = tMsg.."\r\nShare\t:\t"..tmpTable[12] tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t"..tmpTable[1] tMsg = tMsg.."\r\n -\t\t"..tmpTable[2] tMsg = tMsg.."\r\n -\t\t"..tmpTable[3] tMsg = tMsg.."\r\n -\t\t"..tmpTable[4] tMsg = tMsg.."\r\n -\t\t"..tmpTable[5] tMsg = tMsg.."\r\n  50% ("..midU.." users)\t"..tmpTable[6] tMsg = tMsg.."\r\n -\t\t"..tmpTable[7] tMsg = tMsg.."\r\n -\t\t"..tmpTable[8] tMsg = tMsg.."\r\n -\t\t"..tmpTable[9] tMsg = tMsg.."\r\n -\t\t"..tmpTable[10] tMsg = tMsg.."\r\n   0%(0 users)\t    ?" tMsg = tMsg.."\r\nTime\t:\t"..tmpTable[11] SendToAll(gBot, tMsg)endfunction GetNumbers() h, m, Time, userCount, maxU, hubshare = "" h = date("%H") m = date("%M") Time = h..":"..m usrC = frmHub:GetUsersCount() userCount = AddSpacesToKey(usrC) maxU = frmHub:GetMaxUsers() midU = maxU/2 hubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024))) hubshrS = hubshare.." gb" if tonumber(hubshare) >= 1024 then hubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024*1024))) hubshrS = hubshare.." tb" end return Time, userCount, maxU, midU, hubshare, usrC, hubshrSendfunction AddSpacesToKey(data) local cell = "" if strlen(data) == 2 then cell = "  "..data.."\t" elseif strlen(data) == 3 then cell = " "..data.."\t" elseif strlen(data) == 4 then cell = data.."\t" elseif strlen(data) == 5 then cell = data.."\t" elseif strlen(data) == 1 then cell = "   "..data.."\t" end return cellend`

#### Herodes

• Guest
##### (No subject)
« Reply #7 on: 28 May, 2004, 15:07:20 »
I forgot to say thanks to NotRambitWombat on a previous post ... so here it is :D!
Thanks a million man .. :)

So far I have been trying ALL night to get this script working with tables ...
I don't have the slightest Idea why is bringing up this error ...
I had a look throught the forum but to no avail ..
All of my efforts end up in a

--Syntax error: table index is nil
--stack traceback:
--   1:  main of file -- `...kaX-0.330.b15.25.dbg\scripts\TabletryRAmbit.lua' at line 29

The following code is the last in-big-need-of-help script ...

Code: [Select]
`-- GraphBot by Herodes-- Not Working Version (syntax Errors "table index is nil")-- Correct gb&tb display + the user count centers on top of the column...-- Input from NotRambitWombat made it even shorter.. :)-- Tried to get the extra tables working but I couldn't .. :(gBot = "CountGraph"fullcell = "    ?\t"emptycell = "\t"tmpTable = {}tHold = {tLine10 = { [1] = "", [2] = "", [3] = "" },tLine9 = { [1] = "", [2] = "", [3] = "" },tLine8 = { [1] = "", [2] = "", [3] = "" },tLine7 = { [1] = " ", [2] = "", [3] = "" },tLine6 = { [1] = " ", [2] = "", [3] = "" },tLine5 = { [1] = " ", [2] = "", [3] = "" },tLine4 = { [1] = " ", [2] = "", [3] = "" },tLine3 = { [1] = " ", [2] = "", [3] = "" },tLine2 = { [1] = " ", [2] = "", [3] = "" },tLine1 = { [1] = " ", [2] = "", [3] = "" },tTime = { [1] = " ", [2] = "", [3] = "" },tShare = { [1] = " ", [2] = "", [1] = "" },tCheck = { "n", "n", "n" } };tmpMain1 = { [1] = tHold[tLine1][1], [2] = tHold[tLine2][1], [3] = tHold[tLine3][1], [4] = tHold[tLine4][1], [5] = tHold[tLine5][1], [6] = tHold[tLine6][1], [7] = tHold[tLine7][1], [8] = tHold[tLine8][1], [9] = tHold[tLine9][1], [10] = tHold[tLine10][1], [11] = tHold[tTime][1], [12] = tHold[tShare][1] };tmpMain2 = {   [1] = tHold[tLine1][2], [2] = tHold[tLine2][2], [3] = tHold[tLine3][2], [4] = tHold[tLine4][2], [5] = tHold[tLine5][2], [6] = tHold[tLine6][2], [7] = tHold[tLine7][2], [8] = tHold[tLine8][2], [9] = tHold[tLine9][2], [10] = tHold[tLine10][2], [11] = tHold[tTime][2], [12] = tHold[tShare][2] };tmpMain3 = { [1] = tHold[tLine1][3], [2] = tHold[tLine2][3], [3] = tHold[tLine3][3], [4] = tHold[tLine4][3], [5] = tHold[tLine5][3], [6] = tHold[tLine6][3], [7] = tHold[tLine7][3], [8] = tHold[tLine8][3], [9] = tHold[tLine9][3], [10] = tHold[tLine10][3], [11] = tHold[tTime][3], [12] = tHold[tShare][3] };function Main() frmHub:UnregBot(gBot) frmHub:RegBot(gBot)endfunction DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd~=nil then if cmd=="!agraph" then GiveAGraph() elseif cmd=="!graph" then GiveGraph() end end endendfunction AddValues() tmpTable = {} GetNumbers() tmpTable[11] = Time tmpTable[12] = hubshrS if usrC > 1 then local pivot = 11 - floor(usrC / maxU * 10) for i = 1,10 do if ( i < pivot ) then tmpTable[i] = emptycell elseif ( i == pivot ) then tmpTable[i] = userCount else tmpTable[i] = fullcell end end elseif usrC == 1 then SendToAll(gBot, "Where did everybody go ?") end return tmpTableendfunction GiveAGraph() tMsg = "\r\n\t\t\t"..frmHub:GetHubName().. " History Info" tMsg = tMsg.."\r\nShare\t:\t"..tmpTable[12] tMsg = tMsg.."\r\n 100% ("..maxU.." users)\t"..tmpTable[1] tMsg = tMsg.."\r\n -\t\t"..tmpTable[2] tMsg = tMsg.."\r\n -\t\t"..tmpTable[3] tMsg = tMsg.."\r\n -\t\t"..tmpTable[4] tMsg = tMsg.."\r\n -\t\t"..tmpTable[5] tMsg = tMsg.."\r\n  50% ("..midU.." users)\t"..tmpTable[6] tMsg = tMsg.."\r\n -\t\t"..tmpTable[7] tMsg = tMsg.."\r\n -\t\t"..tmpTable[8] tMsg = tMsg.."\r\n -\t\t"..tmpTable[9] tMsg = tMsg.."\r\n -\t\t"..tmpTable[10] tMsg = tMsg.."\r\n   0%(0 users)\t    ?\t" tMsg = tMsg.."\r\nTime\t:\t"..tmpTable[11] SendToAll(gBot, tMsg) WriteTables()endfunction GiveGraph() tMsg = "\r\n" tMsg = tMsg.."\r\nShare : "..tmpMain1[11].." "..tmpMain2[11].." "..tmpMain3[11] tMsg = tMsg.."\r\n 100% ("..maxU.." users) "..tmpMain1[10].." "..tmpMain2[10].." "..tmpMain3[10] tMsg = tMsg.."\r\n - "..tmpMain1[9].." "..tmpMain2[9].." "..tmpMain3[9] tMsg = tMsg.."\r\n - "..tmpMain1[8].." "..tmpMain2[8].." "..tmpMain3[8] tMsg = tMsg.."\r\n - "..tmpMain1[7].." "..tmpMain2[7].." "..tmpMain3[7] tMsg = tMsg.."\r\n - "..tmpMain1[6].." "..tmpMain2[6].." "..tmpMain3[6] tMsg = tMsg.."\r\n  50% ("..midU.." users) "..tmpMain1[5].." "..tmpMain2[5].." "..tmpMain3[5] tMsg = tMsg.."\r\n - "..tmpMain1[4].." "..tmpMain2[4].." "..tmpMain3[4] tMsg = tMsg.."\r\n - "..tmpMain1[3].." "..tmpMain2[3].." "..tmpMain3[3] tMsg = tMsg.."\r\n - "..tmpMain1[2].." "..tmpMain2[2].." "..tmpMain3[2] tMsg = tMsg.."\r\n - "..tmpMain1[1].." "..tmpMain2[1].." "..tmpMain3[1] tMsg = tMsg.."\r\n   0%(0 users)    ?    ?    ?" tMsg = tMsg.."\r\nTime : "..tmpMain1[12].." "..tmpMain2[12].." "..tmpMain3[12] SendToAll(gBot, tMsg) WriteTables()endfunction GetNumbers() h, m, Time, userCount, maxU, hubshare = "" h = date("%H") m = date("%M") Time = h..":"..m usrC = frmHub:GetUsersCount() userCount = AddSpacesToKey(usrC) maxU = frmHub:GetMaxUsers() midU = maxU/2 hubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024))) hubshrS = hubshare.." gb" if tonumber(hubshare) >= 1024 then hubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024*1024))) hubshrS = hubshare.." tb" end return Time, userCount, maxU, midU, hubshare, usrC, hubshrSendfunction WriteTables() AddValues() if tHold[tCheck][1] == "d" then if tHold[tCheck][2] == "d" then if tHold[tCheck][3] == "d" then tmpMain1 = {} tmpTable = tmpMain1 tHold[tCheck][1] = 1 elseif tHold[tCheck][3] == "n" then tmpMain3 = {} tmpTable = tmpMain3 tHold[tCheck][3] = 1 end elseif tHold[tCheck][2] == "n" then tmpMain2 = {} tmpTable = tmpMain2 tHold[tCheck][2] = 1 end elseif tHold[tCheck][1] == "n" then tmpMain1 = {} tmpTable = tmpMain1 tHold[tCheck][1] = 1 endendfunction AddSpacesToKey(data) local cell = "" if strlen(data) == 2 then cell = "  "..data.."\t" elseif strlen(data) == 3 then cell = " "..data.."\t" elseif strlen(data) == 4 then cell = data.."\t" elseif strlen(data) == 5 then cell = data.."\t" elseif strlen(data) == 1 then cell = "   "..data.."\t" end return cellend`
C'mon someone give me a hint pls ... ! :)

#### NotRabidWombat

• Lord
• Posts: 384
• Karma: +2/-0
##### (No subject)
« Reply #8 on: 28 May, 2004, 15:18:21 »
As there states, the error is on line 29:

tmpMain1 = { [1] = tHold[tLine1][1],

The problem here is you have indexed improperly. If you put table[foo], foo is interpreted as a variable and will evaluate the value of foo. In your case, tLine1 is nil. You could say table["foo"], which will look for the index with key "foo". This is the _same_ as table.foo.

So to solve your problem change to:

tmpMain1 = { [1] = tHold.tLine1[1],

OR

tmpMain1 = { [1] = tHold["tLine1"][1],

Same goes for all other instances.

-NotRabidWombat

I like childish behavior. Maybe this post will be deleted next.

#### Herodes

• Guest
##### (No subject)
« Reply #9 on: 28 May, 2004, 16:00:27 »
I won't make the same mistake again ....
cheers for the help once again ...
I have this part completely clear now ...
One more trivial question !
Is there any particular difference between the following two ?

tmpMain1 = { [1] = tHold.tLine1[1],
tmpMain1 = { [1] = tHold["tLine1"][1],

...or are they working in the same manner in every case ?

I am able to get the Full Table (in GiveGraph) displayed after this...

#### NotRabidWombat

• Lord
• Posts: 384
• Karma: +2/-0
##### (No subject)
« Reply #10 on: 28 May, 2004, 16:58:59 »
"Is there any particular difference between the following two ?

tmpMain1 = { [1] = tHold.tLine1[1],
tmpMain1 = { [1] = tHold["tLine1"][1],"

Nope. table.foo is just syntactical sugar for table["foo"] so you can treat a table like you would an object.

-NotRabidWombat
« Last Edit: 28 May, 2004, 16:59:32 by NotRabidWombat »

I like childish behavior. Maybe this post will be deleted next.

#### Herodes

• Guest
##### (No subject)
« Reply #11 on: 29 May, 2004, 02:53:17 »
Code: [Select]
`-- GraphBot by Herodes-- -- ! Not Working Version (  no syntax Errors :(   ) !-- Correct gb&tb display + the user count centers on top of the column...-- Input from NotRambitWombat made it even shorter.. :)-- -- Tried to get the extra tables working but I couldn't .. :(-- Retry (after a lot of them) to get a smaller version of the script to work ...--again with 1 only column but this time I am looking how to be able to read&write the table valuesgBot = "CountGraph"fullcell = "    ?\t"emptycell = "\t"tTable = {}tLine10 = { [1] = "", [2] = "", [3] = "", }tLine9 = { [1] = "", [2] = "", [3] = "", }tLine8 = { [1] = "", [2] = "", [3] = "", }tLine7 = { [1] = "", [2] = "", [3] = "", }tLine6 = { [1] = "", [2] = "", [3] = "", }tLine5 = { [1] = "", [2] = "", [3] = "", }tLine4 = { [1] = "", [2] = "", [3] = "", }tLine3 = { [1] = "", [2] = "", [3] = "", }tLine2 = { [1] = "", [2] = "", [3] = "", }tLine1 = { [1] = "", [2] = "", [3] = "", }tTime = { [1] = "", [2] = "", [3] = "", }tShare = { [1] = "", [2] = "", [1] = "", }outMain1 = { [1] = tLine1[1], [2] = tLine2[1], [3] = tLine3[1], [4] = tLine4[1], [5] = tLine5[1], [6] = tLine6[1], [7] = tLine7[1], [8] = tLine8[1], [9] = tLine9[1], [10] = tLine10[1], [11] = tTime[1], [12] = tShare[1] };function Main() frmHub:UnregBot(gBot) frmHub:RegBot(gBot)endfunction DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd~=nil then if cmd=="!graph" then AddValues() GiveGraph() end end endendfunction AddValues()outMain1 = {}GetNumbers()tTime[1] = TimetShare[1] = hubshrS if usrC > 1 then local pivot = 11 - floor(usrC / maxU * 10); for i = 1,10 do if ( i < pivot ) then outMain1[i] = emptycell elseif ( i == pivot ) then outMain1[i] = userCount else outMain1[i] = fullcell end end end if usrC == 1 then SendToAll(gBot, "Where did everybody go ?") endreturn outMain1endfunction GetValues1()for i = 1, getn(outMain1) do tTable[i] = vendendfunction GiveGraph()GetValues()local tMsg = "\r\n\t\t\t"..frmHub:GetHubName().. " History Info" tMsg = tMsg.."\r\nShare\t:\t"..tShare[1] tMsg = tMsg.."\r\n 100% ("..frmHub:GetMaxUsers().." users)\t"..tLine1[1] tMsg = tMsg.."\r\n\t -\t"..tLine2[1] tMsg = tMsg.."\r\n\t -\t"..tLine3[1] tMsg = tMsg.."\r\n\t -\t"..tLine4[1] tMsg = tMsg.."\r\n\t -\t"..tLine5[1] tMsg = tMsg.."\r\n  50% ("..(frmHub:GetMaxUsers()/2).." users)\t"..tLine6[1] tMsg = tMsg.."\r\n\t -\t"..tLine7[1] tMsg = tMsg.."\r\n\t -\t"..tLine8[1] tMsg = tMsg.."\r\n\t -\t"..tLine9[1] tMsg = tMsg.."\r\n\t -\t"..tLine10[1] tMsg = tMsg.."\r\n   0%(0 users)\t"..fullcell tMsg = tMsg.."\r\nTime\t:\t"..tTime[1] SendToAll(gBot, tMsg) SendToAll(gBot, "thats us!")endfunction GetNumbers() Time, usrC, maxU, hubshare = "" h = date("%H") m = date("%M") Time = h..":"..m usrC = frmHub:GetUsersCount() userCount = AddSpacesToKey(usrC) maxU = frmHub:GetMaxUsers() hubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024))) hubshrS = hubshare.." gb" if tonumber(hubshare) >= 1024 then hubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024*1024))) hubshrS = hubshare.." tb" end return Time, usrC, userCount, maxU, hubshare, hubshrSendfunction AddSpacesToKey(data) local cell = "" if strlen(data) == 2 then cell = "  "..data.."\t" elseif strlen(data) == 3 then cell = " "..data.."\t" elseif strlen(data) == 4 then cell = data.."\t" elseif strlen(data) == 5 then cell = data.."\t" elseif strlen(data) == 1 then cell = "   "..data.."\t" end return cellend`help me finish this please ...
I can't understand why it is not coming up with the correct values in the graph ..
I think it has to do with the Add/GetValues  functions ...

#### Herodes

• Guest
##### (No subject)
« Reply #12 on: 30 May, 2004, 05:35:00 »
Question :  Are the values in the tables below "linked" to each other ?
Code: [Select]
`tLine5 = { [1] = "-", [2] = "", }tLine4 = { [1] = "-", [2] = "", }tLine3 = { [1] = "-", [2] = "", }tLine2 = { [1] = "-", [2] = "", }tLine1 = { [1] = "-", [2] = "", }tTime = { [1] = "-", [2] = "", }tShare = { [1] = "-", [2] = "", }outMain1 = { [1] = tLine1[1], [2] = tLine2[1], [3] = tLine3[1], [4] = tLine4[1], [5] = tLine5[1], [6] = tTime[1], [7] = tShare[1] };outMain2 = { [1] = tLine1[2], [2] = tLine2[2], [3] = tLine3[2], [4] = tLine4[2], [5] = tLine5[2], [6] = tTime[2], [7] = tShare[2] };`Meaning if I outMain2[5] = "whatever"  then will tLine5[2] == "whatever" be true or not ??
--Please someone help me with this ... I am trying to find hair (on my head) to pull by now ... --

#### Herodes

• Guest
##### Old News
« Reply #13 on: 30 May, 2004, 21:34:35 »
Sorry for possible spamming of the thread .. but I need help with this
I see progress every time and the thing is that I always feel stupid after when I solve my problems and in the code I have posted ...
I hope someone understands and tries to help me ..
Guess what !
I have some new probs ...
Code: [Select]
`-- GraphBot by Herodes-- Working Version (but after repeating the cmd x 5 times u don't get any refresh on the tables ...)-- fixed correction of kb, mb, gb, tb display-- now the user count centers on top of the column...-- input from NotRambitWombat made it even shorter.. :)-- Tried to get the extra tables working but I couldn't .. :(-- Making progress on this ... Added tables tried to get them to work again .. -- It gets the values to the tables but it has an error (indicated in script)  [ 8:20 pm 30-5-2004 ]gBot = "CountGraph"fullcell = "     ?\t"emptycell = "\t"tTab = { [1] = "", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", };tTable = { [1] = "", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", };tCol1= { [1] = "", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", };tCol2= { [1] = "", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", };tCol3= { [1] = "", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", };----------------------------------------------------------------------- the command function DataArrival(user, data) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd~=nil then if cmd=="!graph" then GiveGraph() end end endend----------------------------------------------------------------------- place the values in table and return table function AddValues()tTable = {}GetNumbers()if usrC > 1 then local pivot = 11 - floor(usrC / maxU * 10) for i = 1,10 do if ( i < pivot ) then tTable[i] = emptycell elseif ( i == pivot ) then tTable[i] = userCount else tTable[i] = fullcell end         endendif usrC == 1 then SendToAll(gBot, "Where did everybody go ?")endtTable[11] = TimetTable[12] = hubshrSreturn tTableend----------------------------------------------------------------------- push the values in a > b > cfunction FixTable(table1, table2)for i, v in table1 do tinsert ( table2, i, v )endend----------------------------------------------------------------------- push the tables ..  (this is the part that the problem is ... :S)function DoTranferTab()if tTable[11] ~= "" then if tCol1[11] == "" then --- tCol1 has no values FixTable(tTable, tCol1) ---      then from tmp > 1 elseif tCol1[11] ~= "" and tCol2[11] == "" then --- tCol1 has values FixTable(tCol1, tCol2) ---       then Move 1 > 2                <---there is a problem in this line .. FixTable(tTable, tCol1) ---           and from tmp > 1 if tCol2[11] ~= "" and tCol3[11] == ""then --- --- tCol2 has values FixTable(tCol2, tCol3) --- ---      then Move 2 >3 FixTable(tCol1, tCol2) --- ---          and from 1 > 2 FixTable(tTable, tCol1) --- ---                and from  tmp > 1 end else tCol1 = {} end tTable = {}endend----------------------------------------------------------------------- the graph showing the values of previous tablefunction GiveGraph()DoTranferTab()AddValues() tMsg = "\r\n\t\t\t- "..frmHub:GetHubName().." User Count Graph -" tMsg = tMsg.."\r\nShare\t:\t"..tTable[12].."\t\t"..tCol1[12].."\t\t"..tCol2[12].."\t\t"..tCol3[12] tMsg = tMsg.."\r\n 100% ("..maxU..")\t"..tTable[1].."\t"..tCol1[1].."\t"..tCol2[1].."\t"..tCol3[1] tMsg = tMsg.."\r\n     -\t\t"..tTable[2].."\t"..tCol1[2].."\t"..tCol2[2].."\t"..tCol3[2] tMsg = tMsg.."\r\n     -\t\t"..tTable[3].."\t"..tCol1[3].."\t"..tCol2[3].."\t"..tCol3[3] tMsg = tMsg.."\r\n     -\t\t"..tTable[4].."\t"..tCol1[4].."\t"..tCol2[4].."\t"..tCol3[4] tMsg = tMsg.."\r\n     -\t\t"..tTable[5].."\t"..tCol1[5].."\t"..tCol2[5].."\t"..tCol3[5] tMsg = tMsg.."\r\n  50% ("..midU..")\t\t"..tTable[6].."\t"..tCol1[6].."\t"..tCol2[6].."\t"..tCol3[6] tMsg = tMsg.."\r\n     -\t\t"..tTable[7].."\t"..tCol1[7].."\t"..tCol2[7].."\t"..tCol3[7] tMsg = tMsg.."\r\n     -\t\t"..tTable[8].."\t"..tCol1[8].."\t"..tCol2[8].."\t"..tCol3[8] tMsg = tMsg.."\r\n     -\t\t"..tTable[9].."\t"..tCol1[9].."\t"..tCol2[9].."\t"..tCol3[9] tMsg = tMsg.."\r\n     -\t\t"..tTable[10].."\t"..tCol1[10].."\t"..tCol2[10].."\t"..tCol3[10] tMsg = tMsg.."\r\n   0% (0)\t\t"..fullcell.."\t"..fullcell.."\t"..fullcell.."\t"..fullcell tMsg = tMsg.."\r\nTime\t:\t"..tTable[11].."\t\t"..tCol1[11].."\t\t"..tCol2[11].."\t\t"..tCol3[11] SendToAll(gBot, tMsg)end----------------------------------------------------------------------- get the data (numbers) needed, format and return them function GetNumbers() Time, userCount, maxU, hubshare = "" Time = date("%H")..":"..date("%M") usrC = frmHub:GetUsersCount() userCount = AddSpacesToKey(usrC) maxU = frmHub:GetMaxUsers() midU = maxU/2 thubshare = format("%0.1f", ( frmHub:GetCurrentShareAmount() / 1024)) hubshrS = thubshare.." kb" if tonumber(thubshare) >= 1024 and tonumber(thubshare) < (1024^2) then hubshrS = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024^2))).." mb" elseif tonumber(thubshare) >= (1024^2) and tonumber(thubshare) < (1024^3) then hubshrS = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024^3))).." gb" elseif tonumber(thubshare) >= (1024^3) then hubshrS = format("%0.1f", ( frmHub:GetCurrentShareAmount() / (1024^4))).." tb" end return Time, userCount, maxU, midU, hubshare, usrC, hubshrSend----------------------------------------------------------------------- adding appropriate number of spaces to userCount stringfunction AddSpacesToKey(data)local ratio = (5 - strlen(data))local tcell  = strrep(" ", ratio)..data.."\t"return tcellend`Up to now with this one I am geting another error :

Syntax error: bad argument #2 to `tinsert' (number expected, got string)
stack traceback:
1:  function `tinsert' [C]
2:  function `FixTable' at line 83 [file `...Graph.lua']
3:  function `DoTranferTab' at line 93 [file `...Graph.lua']
4:  function `GiveGraph' at line 108 [file `...Graph.lua']
5:  function `DataArrival' at line 54 [file `...Graph.lua']

#### PtokaX forum

##### Old News
« Reply #13 on: 30 May, 2004, 21:34:35 »