KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 04 Nov 2013 06:49 PM |
Lost other thread qq
Anyways, can someone explain the blue keyword, "until" Like.. I was wondering if I could do this
game.Workspace.brick.Transparency = game.Worksapce.brick.Transparency + 0.1 until game.Workspace.brick.Transparency = 1 |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 06:51 PM |
repeat script until condition
i = 0
repeat
i = i + 1 print(i) wait(0)
until
i > 500 |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 04 Nov 2013 06:52 PM |
| so its kinda like the opisate of a while loop?(ik im not the one who started this thread, but personally i didnt really know much about this) |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 04 Nov 2013 06:52 PM |
What?! repeat? Never heard of it. Perhaps a loop?
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 06:53 PM |
No, they both work generally the same
repeat i = i + 1 until i == 5
could be written as
while i ~= 5 do i = i + 1 end |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 04 Nov 2013 06:54 PM |
It yields the code, and repeats the given code between repeat and until UNTIL the lines in front of until is true.
Ex.
number = 0 repeat number = number + 1 print(number) until number == 5 |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2013 06:54 PM |
repeat code until conditionmet
ex:
repeat game.Workspace.Value = game.Workspace.Value + 1 until game.Workspace.Value = 5 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 06:56 PM |
Workspace doesn't have a Value property
Unless you used some fenv, like:
setfenv(1, {game.Workspace.Value = 1}) |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 04 Nov 2013 06:58 PM |
Uhh.... where you talking to teh guy who didnt start post, or were you talking to me? |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 04 Nov 2013 06:59 PM |
doesnt roblox often use stuf like repeat wait(.1) until stuff ~= nil |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 07:03 PM |
To devil
Though my code wouldn't work since I did it "psuedo style" |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 04 Nov 2013 07:06 PM |
| puesedo? Wait.. nvm, please focus on my mouse.Hit.p post now :D thank you! |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 07:08 PM |
This is the actual code
setfenv(1, {game = {Workspace = {Value = 1}}, print=print}) repeat print(game.Workspace.Value) game.Workspace.Value = game.Workspace.Value + 1 wait(0) until false |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 04 Nov 2013 07:17 PM |
| Can you go to my other post? Thanks! |
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 04 Nov 2013 07:24 PM |
Using "repeat-until" executes the body before checking the end condition. A "while" loop checks the conditions before executing the body.
repeat-until:
a = 1
repeat a = a+1 -- executed until a > 1 -- would have been false if the same argument was used for a while loop. Body is executed anyway.
print(a)
>2
while loop:
a = 1
while a > 1 do -- a is not equal to 0. Body is skipped. a = a + 1 --skipped end
print(a)
>1
If you know C++, a "repeat-until" is analogous to a "do-while" loop.
|
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 04 Nov 2013 07:25 PM |
Whoops.
while a > 1 do -- a is not greater than 1. Body is skipped.
For the sake of correctness. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 04 Nov 2013 08:19 PM |
so....
game.Workspace.brick.Transparency = game.Workspace.brick.Transparency - 1 repeat
until game.Workspace.brick.Transparency = 1 -- or would I do >1 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 08:20 PM |
repeat game.Workspace.brick.Transparency = game.Workspace.brick.Transparency - 1 until game.Workspace.brick.Transparency = 1 -- or would I do >1
Like logic:
repeat TakeBiteOfFood until DinnerIsDone |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 04 Nov 2013 08:23 PM |
repeat something until condition
repeat code until condition
repeat print("SPAM") Wait(1) until false --true will never be false, so this will keep printing spam ever 1 second until never |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|