|
| 07 May 2012 01:54 PM |
e.i: "for i=1,5 print(i)" That will count 1 to 5 but "for i=5,0 print(i)" It won't count backwards... .____.
Explain please..... |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 01:56 PM |
for 1 = 10, 1, -1 print(i)
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 02:02 PM |
Mine shows you how to fix it. If you want me to fix it for you just use this
for i = 10, 1, -1 do print("Count down - "..i) wait(1) end
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 02:10 PM |
Move useful
for i = 10, 1, -1 do workspace.Message.Text = ("Count down - "..i) print("Count down - "..i) wait(1) end workspace.Message.Text = ("Happy new year!") print("Happy new year!")
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
juriaan
|
  |
| Joined: 25 Nov 2008 |
| Total Posts: 939 |
|
|
| 07 May 2012 02:53 PM |
Or just simplified.
for i = 1, 10 do Workspace.Message.Text = "Seconds till launch "..10 - i wait(1) end
But I recommend Luanoob way.
|
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:01 PM |
I only added the the prints because he wanted to make it print.
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:06 PM |
local i=10 local m=Instance.new("Message",Workspace) repeat i=i+1 m.Text="Seconds untill launch: "..i until i>=0
Hrm. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:14 PM |
| @wood - That was unnecessarily inefficient. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:18 PM |
@Electris
It's shorter than their scripts; and works better
kk ty |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:19 PM |
SHORTER doesn't matter. EXECUTION matters. You executed more code, therefore you were more inefficient.
kk ty |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:21 PM |
I agree with ElectricBlaze
You guys keep telling me to make my scripts shorter, But if they work fine, Why?
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:22 PM |
local m=Instance.new("Message",Workspace) for i=10,1 do if i~=0 then wait(1) m.Text="Seconds until launch: "..i break end end
Does that really make you happier? Meh. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:23 PM |
local m=Instance.new("Message",Workspace) for i=10,0 do if i~=0 then wait(1) m.Text="Seconds until launch: "..i end break end *
I'm not telling anyone to script shorter, I just like to make mine shorter. Personal quirk. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:24 PM |
Now you actually did it WRONG.
You can't go from 10 to 1 at an increment of 1. The if statement is COMPLETELY unnecessary, and without it the same thing would happen. Same with the break statement.
Corrected, that should be:
local m=Instance.new("Message",Workspace) for i=10,1,-1 do wait(1) m.Text="Seconds until launch: "..i end |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:25 PM |
ya - no
u c cus im speeshal an lua knes that it maek exception fo' me. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:28 PM |
| I'm sorry, this is kind of pathetic. You're corrected, and all of a sudden, you're reduced to a troll with little, if none at all, grammar. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:32 PM |
Yes. I'm that immature.
OWAITTTTTTT
My first script was right. I'm still happy c: |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:35 PM |
| By "first one", do you mean the repeat loop or your [failed] for loop? The repeat loop was a fail because it was ridiculously inefficient for something so simple, and the for loop was a fail because it didn't even work. |
|
|
| Report Abuse |
|
|
|
| 07 May 2012 03:37 PM |
ok bcus of u i put sad fac on all my posts now
:c |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 07 May 2012 04:03 PM |
You could also do this:
for i = -10,-1 do print(math.abs(i)) end
Less efficient, though. I recommend for i = 10,1,-1 do. |
|
|
| Report Abuse |
|
|
| |
|