|
for i=1,4, 1 do
print(i)
end
This prints 1,2,3,4.
But I want it to print 1,2,3,4,0,-1,-2,-3,-4.
How would I do this?
And i don't want to make it print one by one.
Like:
print(1)
print(2)
ect... |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
You'd use another loop right after it.
for i = 0, -4, -1 do
print(i)
end
0 -1 -2 -3 -4
However, if order doesn't matter, it would be easier to do this:
for i = -4, 4 do
print(i)
end
-4 -3 -2 -1 0 1 2 3 4 |
|
|
Print'1'
Print'2'
Print'3'
Print'4'
Print'0'
Print'-1'
Print'-2'
Print'-3'
Print'-4'
like that..
I want it to be cleaner. :P
for i=1,4, 1 do
print(i)
end
this dose 1-4 but not 1 though -4.
i also tried this..
for i=1,-4, 1 do
print(i)
end
But it did not work.
So idk help me? Also can you tell me how ( for i=1,4, 1 do )
works?
|
|
SasayakiJoin Date: 2007-06-29 Post Count: 33868 |
OMG Agent changed looks! |
|
|
Nvm that top post thanks. :) |
|
|
while true do--This is for a GUI.
for i = -4, 4 do
script.Parent.Rotation = i
wait(.3)
end
for i = 4, 4 do
script.Parent.Rotation = i
wait(.3)
end
end
--I'm trying to make it spin back and forth... :/
--But it's like skipping back and forth. How would i fix this? |
|
SasayakiJoin Date: 2007-06-29 Post Count: 33868 |
Check the numbers on the 2nd loop. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
while true do--This is for a GUI.
for i = -4, 4 do
script.Parent.Rotation = i
wait(.3)
end
for i = 4, -4, 1 do
script.Parent.Rotation = i
wait(.3)
end
end
Do note that Rotation is in degrees. 4 degrees rotation is so small, you'll barely see it. I'd suggest at least 10 degrees. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
for i = 4, -4, -1 do
script.Parent.Rotation = i
wait(.3)
end
Forgot me negative on me step. 1 should be -1. Sorry! ~~ |
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
for i=1,9, 1 do
print(i>5 and "-" .. i % 5 or i % 5)
end
|
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
I really need to start reading the replies... |
|
|
while true do
for i = -4, 4 do
script.Parent.Rotation = i
wait(.3)
end
for i = 4, -4 do
script.Parent.Rotation = i
wait(.3)
end
end
--I tried this but idk how how the for i=4,-4 do thing works 100%.
--Not sure how it works.. :l |
|
SasayakiJoin Date: 2007-06-29 Post Count: 33868 |
2nd loop should be
for i = 4, -4, -1 do --Normally you need the 3rd number, which shows the increment the loop goes by. If it doesnt exist, its implied as 1.
script.Parent.Rotation = i
wait(.3)
end |
|
|