Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 02:15 PM |
i have seen its something like
for i = 1,10
something, and i have seen the i be an o to...but what does the numbers do whats the difference whats te difference between i and o |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2012 02:17 PM |
i can be defined as anything. For example
for i = 1,10 do print(i) end
Output:
1 2 3 4 5 6 7 8 9 10 |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2012 02:18 PM |
for i=1, 10 do --Does this 10 times --the vairable 'i' is the current number of times it has repeated end
for i=0, 1, 0.05 do --repeatedly does this while adding 0.05 to 'i' until --i == 1 end |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 02:19 PM |
| Ok thx, is it any other examples? |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 02:20 PM |
| Well, spleen i still dont get it :P |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 26 Jul 2012 02:20 PM |
Counting down:
for i = 1, 0, -0.1 do -- anything, like part.Transparency = i; end
(Gah I was so tempted to write "for (int i = 1, i >= 0; i -= 0.1)"... oops) |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2012 02:21 PM |
for i=0, 1, 0.05 do print(i) end >0.05 >0.1 >0.15 >0.2 >0.25 ... |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 02:24 PM |
| I saw in a thread where someone explained what the number's difference is so what does they mean, like PUT THE NUMBERS IN WORDS OF WHAT THEY DO |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
| |
|
|
| 26 Jul 2012 02:28 PM |
It basically executes a command i times. i is a variable, but you can use an letter unless you declared it already. |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 02:30 PM |
| Ik that but i me the numbers.. |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 26 Jul 2012 02:43 PM |
for index=1, 10, 2 do
end
What's it say is...
index=1 Add the number 2 to 'index', until index is greater then or equal to 10. Repeat the code between 'do' and 'end', each time you add '2' to 'index'.
So if you say...
for index=10, 1, -2 do
end
It's like saying, go from 10 to 1, subtracting 2.
The first number is the starting number The second number is the target number The third number (Optional) is the number being added to the start number until it reaches the target number. If not provided, this number is 1. |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 02:48 PM |
| I get it, but a loop can be more then that |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2012 02:57 PM |
http://wiki.roblox.com/index.php/Loops#For
:p |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2012 03:02 PM |
You guys aren't explaining this very well.
for variable = startingNumber, endingNumber, incrementNumber do
That is how I define it. variable is a variable that you are declaring solely for the for loop. Its value will be the startingNumber, and it will continue being added by the incrementNumber until it is either equal to the endingNumber, or it simply cannot be incremented again without going past the endingNumber. You don't have to fill in the incrementNumber, and if you don't, it will simply be 1. Example:
for i = 1, 10 do
You declare a variable named i, set it to 1, and keep adding 1 to it until it reaches 10. You can also do:
for i = 1, 10, 2 do
Now it's set to 1, except it will be added by 2 rather than 1. |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 03:15 PM |
| But when we make a circle with bricks, how would the loop be? and can someone explain how that work? |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2012 03:18 PM |
Remember, i is also a variable.
You could make a line like this:
for i = 1, 100 do local p = Instance.new("Part", workspace) p.Size = Vector3.new(1, 1, 1) p.Position = Vector3.new(i, 0, 0) end
That make 100 parts in workspace, each 1 x 1 x 1, and the first one's position would be Vector3.new(1, 0, 0), the second would be Vector3.new(2, 0, 0), the third would be Vector3.new(3, 0, 0), and so on. |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
| |
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 26 Jul 2012 03:28 PM |
| The radius stays constant. The radius DOES NOT CHANGE. You don't need a loop for that. |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 03:42 PM |
So for example, to make 100 messages will it be
for i = 1, 100
doesent it? |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
| |
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
| |
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
|
| 26 Jul 2012 04:23 PM |
| Ur not very helpful...bump |
|
|
| Report Abuse |
|
|
Moolah101
|
  |
| Joined: 22 Sep 2010 |
| Total Posts: 614 |
|
| |
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 27 Jul 2012 06:05 AM |
for i = 1, 100 do m = Instance.new("Message", Workspace) m.Text = "OWNED" end |
|
|
| Report Abuse |
|
|