Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 09:26 AM |
What kind of loop would i use to make a thing always run, like for example:
LOOPKIND() wait(300) --stuff end
Because i want a loop that will always run.I want to put waits inside the loop (and no while wait() is NOT included.Dont suggest that) |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
|
| 04 Mar 2013 09:53 AM |
function LOOPKIND() while wait(300) --stuff end end
LOOPKIND() |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 09:54 AM |
ops, this one is correct
function LOOPKIND() while wait(300) do --stuff end end LOOPKIND() |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 09:55 AM |
| bump (above, oyush i saw you) |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 10:03 AM |
| You're not supposed to bump after you got the answer. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 10:24 AM |
| Neither of you red my thread.Bump ^ i could report that for spam :P |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 04 Mar 2013 11:00 AM |
Why can't we use while wait? o.o Well there's also...
repeat wait() until false
for Loop=1,math.huge do wait()end
function Loop(id) wait()Loop(id+1)end Loop(1)
-- All of these loop forever. But um.. I'm not sure I get what you're asking. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 11:05 AM |
| Could i use repeat without until? |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 04 Mar 2013 11:06 AM |
You can use repeat without until as much as you can use do without end. :P (No, you can't.) Why would you want to? |
|
|
| Report Abuse |
|
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 11:15 AM |
SDSJKFEMFSAJEMTHESKMYHJAS
What else can i use? (while wait cant run forever in what im asking) i dont want to set the seconds in while wait, i just need something to run forever.So i can set normal waits inside that. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 11:20 AM |
| is 'while true do' allowed then for you to use? That is the only one other I know about that not have any wait time |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 11:21 AM |
| I think that crashes you.Anyway if i was to use while wait how would i make it run forever? |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 11:23 AM |
| What makes you think it doesn't run forever? |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 11:24 AM |
| yes, the only way to jump out of the loop is to use 'break' or 'return' |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 04 Mar 2013 11:26 AM |
You want something like...
while(true)do print("bla bla") wait(5) print("ble") wait(5) end
? |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 11:35 AM |
| yeah, a script that runs forever and every 5 seconds it prints something, and it runs forever so... how to do that? |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 11:38 AM |
| You already got the answer, stop spamming. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 04 Mar 2013 11:53 AM |
while true do print("hi") wait(5) end
there |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 04 Mar 2013 12:19 PM |
| Different your a freaking idiot, stop spamming at my thread.@Miz i thought while true do would lag you?? |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 12:47 PM |
| Can't tell if troll or stupid. |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 04 Mar 2013 12:57 PM |
Oh, why not just end this madness. I GUESS he's asking for something like .setTimeout in javascript.
---------------------------------------------------------------------------------
function loop(functionArgument, delayTime, ...) while wait(delayTime) do functionArgument(...) end end
---------------------------------------------------------------------------------
You use the function above like this:
function testFunction(mystring, mynumber, myinstance) print(mystring) print(mynumber) print(myinstance) end
loop(testFunction, 2, "hello, I'm a string!", 1337, workspace)
---------------------------------------------------------------------------------
You can add a coroutine to make it so code after your loop function will still run.
- As, while approval do print("Approved!") wait() end |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 01:04 PM |
@allOfFedorasPosts, *facepalm* *facedesk* *facewall* *facetrain* *faceceiling* *facefloor* *faceeverything* |
|
|
| Report Abuse |
|
|