Hi, new member here. I hope there are some active scripters in the forum.
Basically the script I want should have the following functionality:
1)Right click menu and !sharegraph command.
2)It is a horizontal histogram graph. Would look something like this:
000-100 GB |------------------
100-200 GB |--------------
200-300 GB |----------
(and so on, where '-' = 10 number of sharers)
3) Additional: Should have an option for replying in main chat or PM
If no one wants to make the script, then you can help me guide it as to how to make such a script.
TIA :yes:
I could get into this...would you script it to match the action? or would it just be general random actions?
--[[
Share'Tool' 2.1 LUA 5.1x [Strict] [API 2]
By Mutor 05/15/06
More nonsense...
Graphs user share at login.
See how you hub 'measures' up
Feel free to change the graph
charachters I won't mind :P
+Changes from 1.0 11/01/06
+Added total ,average and percent of hubshare stats [DoStats]
~Changed ShareTab a bit.
+Added parting share message [percent of hubshare lost]
+Changes from 1.c 08/16/08
~Converted to API 2 strict.
+Changes from 2.0 08/16/08
~Rebuilt code using my FmtSz function
~A few optimizations
]]
-- Set share levels and responses here
ShareTab = {
[1] = {500,"Careful usr you'll poke your eye out with that thing!\r\n"},
[2] = {250,"Is that your share in your pocket or are you just happy to be here usr?\r\n"},
[3] = {125,"Wow usr, thats impressive.\r\n"},
[3] = {75,"Hey Now!, usr's sporting some wood!\r\n"},
[4] = {35,"Not bad, but you won't win any prizes with that.\r\n"},
[5] = {20,"Average huh. It's nothing to be ashamed of usr ...*snicker*\r\n"},
[6] = {10,"Hey usr , does that come in adult size?\r\n"},
[7] = {5,"Awwwww usr, isn't that cute?\r\n"},
}
OnStartup = function()
for i,v in ipairs(ShareTab) do v[1] = v[1] * (1024^3) end
local hs,hu = DoStats()
if hs > 0 and hu > 0 then
local hm = FmtSz(hs/hu)
local stats = "Share'Tool' 1.0b has started. There are "..hu..
" users are sharing "..FmtSz(hs).." of data. Mean share per user: "..hm
Core.SendToAll("<ShareTool> "..stats.."|")
end
end
UserConnected = function(user)
local hs,hu,us = DoStats(user)
if hs > 0 and hu and us > 0 then
local hm,pct = FmtSz(hs/hu),string.format("%.2f %% ",(us/hs) * 100)
local stats = "Welcome "..user.sNick.." there are "..hu.." user(s) are sharing "..
FmtSz(hs).." of data. Thats an average of "..hm.." per user."
local i,prof = user.iProfile,"Unregistered User"
if i ~= -1 then prof = ProfMan.GetProfile(i).sProfileName end
local reply = "Boasting "..pct.." of the total hubshare, lets see how the "..
prof.." "..user.sNick.."'s share measures up... \r\n"
local sharesize = Core.GetUserValue(user,16) or 0
local output = "\r\n"..FmtSz(sharesize).." 8=D\r\n\r\n Hey Shorty... 8-)\r\n\r\n"
for a,b in ipairs(ShareTab) do
if sharesize > b[1] then
local goof,r = string.gsub(b[2],"usr",user.sNick),"="
output = "\r\n"..FmtSz(sharesize).." 8"..r:rep(sharesize/8).."D\r\n\r\n "..goof.."\r\n"
break
end
end
Core.SendToAll("<ShareTool> "..reply..output.."|")
Core.SendToUser(user,"<ShareTool> "..stats.."|")
Core.SendToUser(user,"<ShareTool> "..reply..output.."|")
end
end
RegConnected,OpConnected = UserConnected,UserConnected
UserDisconnected = function(user)
local msg = "See ya "..user.sNick..", there is no loss to hubshare when you leave."
local hs,us = Core.GetCurrentSharedSize() or 0,Core.GetUserValue(user,16) or 0
if hs > 0 and us > 0 then
local pct = string.format("%.2f %% ",(us/hs) * 100)
msg = "Goodbye "..user.sNick..", uh oh, there goes "..pct.." of the hub's share."
end
Core.SendToAll("<ShareTool> "..msg.."|")
end
RegDisconnected,OpDisconnected = UserDisconnected,UserDisconnected
DoStats = function(user)
local hs,hu = Core.GetCurrentSharedSize(),#Core.GetOnlineUsers()
if user then
local us = Core.GetUserValue(user,16) or 0
hs,hu = us+hs, hu+1
return hs,hu,us
end
return hs,hu
end
FmtSz = function(int)
local i,u,x=tonumber(int) or 0,{"","K","M","G","T","P"},1
while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u