Lua 5.3/5.2/5.1 Scripts (for PtokaX and newer) > HOW-TO's

HOW-TO: Run a loop to get user share size and display it on main hub chat


Basically I want to create a script where when the user types !sharegraph , the following things should happen:

* Get the online users share size using Core.GetUserData and iShareSize and store it in an array
* Create another array called size_count which will contain the count of share size of each user according to size category
* Size categories will be: 0GB-200GB,200GB-400GB,400GB-600GB,600GB-800GB,800GB-1000GB,1000GB+
* Run a comparison loop and update size_count array
* Print on main hub chat the size by printing "*" for each user[li]If a category has more than 50 users, it will print "+" at the end of 30 "*"
So lets say if the hub has 10 users where 2 users have less than 200GB , 4 users have 400-600GB and the rest have 1000GB+ , the output should be:
0GB-200GB:      **
400GB-600GB:  ****
1000GB+:         ****
Can someone please help me out?


[0] Message Index

Go to full version