yair1221 Posted October 14, 2010 Share Posted October 14, 2010 headline Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/ Share on other sites More sharing options...
TheSiggi Posted October 14, 2010 Share Posted October 14, 2010 whats so hard about that? while true wait 0end its a never ending loop.... ever heared of F12 in Sannybuilder = help Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060161719 Share on other sites More sharing options...
yair1221 Posted October 14, 2010 Author Share Posted October 14, 2010 i tried all the coding tutorials in tutorials forum never thought of SB...anyway, does it have to be never-ending? cant something be like "while actor in car, do that and that"...? Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060161724 Share on other sites More sharing options...
TheSiggi Posted October 14, 2010 Share Posted October 14, 2010 You asked about true $var = 10while $var > 11 inc($var)end should answer your (moronic) question read SB help> Coding > Loops first before posting any other question Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060161729 Share on other sites More sharing options...
yair1221 Posted October 14, 2010 Author Share Posted October 14, 2010 hhh kk Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060161734 Share on other sites More sharing options...
Adler Posted October 14, 2010 Share Posted October 14, 2010 should answer your (moronic) question There are no "moronic" questions Sig. Please be a little nicer to newbs... even yair lol. And yeah while true loops indefinitely unless it's stopped by a break or a jump to another label. While <condition> will loop indefinitely until the condition is false. Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162226 Share on other sites More sharing options...
coin-god Posted October 14, 2010 Share Posted October 14, 2010 You asked about true $var = 10while $var > 11 inc($var)end should answer your (moronic) question read SB help> Coding > Loops first before posting any other question Dont be so hard with the guy, high level contructions are not easy for newbs. Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162270 Share on other sites More sharing options...
yair1221 Posted October 15, 2010 Author Share Posted October 15, 2010 what does the inc $var mean in this line? i mean, is it like $var -= 1? so the while structure, is basically like "for" in C++? just the other way arround i think, instead of "for $var == 0..." but you used: $var = 10while $var > 11 so, the var isnt > 10 Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162513 Share on other sites More sharing options...
Donny78 Posted October 15, 2010 Share Posted October 15, 2010 what does the inc $var mean in this line?i mean, is it like $var -= 1? so the while structure, is basically like "for" in C++? just the other way arround i think, instead of "for $var == 0..." but you used: $var = 10while $var > 11 so, the var isnt > 10 That loop will never run as the var is 10 and the condition is "greater than 11" but anyways. It's like so: $var = 10 // set the value of the global variable "$var" to 10while $var > 11 // while the value of the global variable "$var" is greater than 11 The loops are the same as the C++ loops, for/while etc. Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162548 Share on other sites More sharing options...
TheSiggi Posted October 15, 2010 Share Posted October 15, 2010 (edited) Inc($Var) = $Var+=1 (equals [var]++ in C-languages) Dec($Var) = $Var-=1 ( " [var]-- in C-lnguages) I'm sorry yair, I was in a bad moode yesterday! ( I know thats not realy an apology for being sarcastic[in huge circuemstances ] and sometimes realy rude) Don't take it to heart for further features check out SB Help> Coding> Loops (read the whole page) and SB Help> Coding > Additional Commands cheers @Adler: Your MSN brocken or what Edit: Nope, the For loop of Sannybuilder is not equal to the C++/# for (int i = 0; i<[var]; [iteration]{} there is a difference consirdering the condition (SilentPL told me ) Edited October 15, 2010 by The_Siggi Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162550 Share on other sites More sharing options...
yair1221 Posted October 15, 2010 Author Share Posted October 15, 2010 but..while true can be used as a custom timer(not 32@, 33@) $var = 10 while $var >= 1 $var -= 1 end actor.destroyinstantly... I'm sorry yair, I was in a bad moode yesterday! ( I know thats not realy an apology for being sarcastic[in huge circuemstances tounge.gif] and sometimes realy rude) hmm...im getting used to it Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162566 Share on other sites More sharing options...
TheSiggi Posted October 15, 2010 Share Posted October 15, 2010 you need a wait in while loop Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060162573 Share on other sites More sharing options...
Wesser Posted October 15, 2010 Share Posted October 15, 2010 No. The while...end construct can be used as well as a for...end cycle, just make a condition which checks for a var which is constantly updated in the same loop. Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060163006 Share on other sites More sharing options...
yair1221 Posted October 15, 2010 Author Share Posted October 15, 2010 god help me, i didnt understand a damn word written in this topic, not including MY words.... Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060163109 Share on other sites More sharing options...
coin-god Posted October 15, 2010 Share Posted October 15, 2010 Its pretty easy to "convert" a For statment in a While or Repeat. Wich means Incondtional iteration to a Conditional one. But may not be possible (in most cases) to do the opposite, convert a While or Repeat to a For. Thats what you need to know about the diferences between them. Also a While may Not execute its body, but a Repeat will do it atleast once. Link to comment https://gtaforums.com/topic/460998-how-to-use-the-while-true-structure/#findComment-1060163248 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now