Loop

How do you make a loop in a script? Like if you want it to do the same cycle over and over again in a script. How do you do that?
 

GoldenRatio

New member
A while loop will look like this

Code:
while(my_inebriety() < 15)
{
     drink(1,$item[shot of tomato schnapps]);
}

It reads pretty much how you'd expect: "while my inebriety is less than 15, drink 1 schnapps."

The part that goes into the () is the stopping condition, and the stuff between the {} is the code you want to happen while the stopping condition doesn't happen.
 
No, just trying to figure out the loop stuff. Is it possible to have multiple while() and if() sections in a script? like say
Code:
 while(my_adventures() < 0) <peak farm>
and then have a
Code:
 if(my_adventures() = 0) <drink ___>
?????
 

macman104

Member
[quote author=GhettoTrucker link=topic=296.msg1576#msg1576 date=1153333969]
No, just trying to figure out the loop stuff. Is it possible to have multiple while() and if() sections in a script? like say
Code:
 while(my_adventures() < 0) <peak farm>
and then have a
Code:
 if(my_adventures() = 0) <drink ___>
?????
[/quote]Yes it is. If you look at the scripts on here, many of them have multiple ifs, whiles, and such all over the place.
 

jw8191

New member
what's the proper syntax for a for loop? would anybody be kind enough to write me a 3 line example?
something along the lines

for x goes from 1 to 7 step 1
{
print("hi");
}

(attempts to print hi 7 times)
I know the first line of this is wrong, but i cant seem to find the right one.

thanks

edit: just so you know, i have searched for this, but searching the word "for" gives way too many results
 
Top