|
| 03 Mar 2014 08:12 PM |
First of all, I'm horrible at math.
I'm trying to convert a loop to a percentage, like here
for i = 1, #assets do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..assets[i]) script.Parent.Text = (i/100) * 100 .."%" wait(0.5) end
I want it to output to script.Parent.Text the percentage to which it is out of 100
So it loads the assets, and shows it on the screen as the percentage done instead of the number of assets done
This just shows the number of assets done. |
|
|
| Report Abuse |
|
|
jetlogan
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1423 |
|
|
| 03 Mar 2014 08:16 PM |
for i = 1, #assets do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..assets[i]) script.Parent.Text = i / 2.."%" wait(0.5) end |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 08:20 PM |
@Jet Outputs 1% instead of 100% |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 08:27 PM |
Turn a decimal into a percent;
0.05 * 100 = 5% |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 08:29 PM |
| Yeah but how can I make it so, that if it finishes all the items in the table "assets" it will be 100% |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 08:32 PM |
| depends, how many asserts are there? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 08:33 PM |
| 2, but it will change a lot, is there a way to get a number of how many items are in the table? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 08:42 PM |
table = {}
a=0 for I, v inpairs(table) do a = a+1 end print(a)
Wait...Did I do that right? I think I messed up the for loop... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 03 Mar 2014 08:48 PM |
| Sorry that threw me way off |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 09:03 PM |
I found a different way, but I still require a way for the script to count all the items in the table
Is there a way to do that? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 09:06 PM |
| Figured it out table.maxn (table id) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 09:48 PM |
| you can simply do #assets. That will give you the number of elements in the table... |
|
|
| Report Abuse |
|
|
| |
|
| |
|