Sign in to follow this  
Followers 0
Pixel

For loop

9 posts in this topic

In my script I've tried using hide(); notsolid(); show(); and solid(); but if I overuse them to create a script, it looks messy, complex, and does not even work.

 

I want a for loop which shows a brush for 2 seconds, disappears for 2 seconds, shows for 2 seconds etc.

 

I kind of know how a for loop works, my only confusion is determining the number here: i < (number). 

 

Also how fast it increments (i++)

 

Thanks for any help.

0

Share this post


Link to post
Share on other sites

for( i = 0 ; i < 5 ; i++ )
{
iPrintLnBold( "loop" );
}
 
OUTPUT: 
loop
loop
loop
loop
loop

 

So basically, 

i = 0 means i starts off at 0

i < 5 means i needs to be LESS THAN 5

i++ means each time it loops i is increased by 1

 

Lets think about this logically:

if i is increasing by each time "loop" is printed AND i needs to be less than 5 then it can only be printed 5 times.

 

So, it would be like this:

 


i = 0
print( "loop" );
i is increased by one
<GO BACK TO START>
i = 1
print( "loop" );
i is increased by one
<GO BACK TO START>
i = 2
print( "loop" );
i is increased by one
<GO BACK TO START>
i = 3
print( "loop" );
i is increased by one
<GO BACK TO START>
i = 4
print( "loop" );
i is increased by one
<GO BACK TO START>
i = 5
Since i is no longer LESS THAN 5 the loops stops.

 

Feel free to upvote if this helps ;)

0

Share this post


Link to post
Share on other sites

For what you want you can use a simple while loop since you want it to be infinite.

 

while( 1 )
{
brush hide();
wait 2;
brush show();
wait 2;
}
0

Share this post


Link to post
Share on other sites

It's because I am working with four different groups of brushes, plus turning and turning off triggers, making brushes non solid, solid, hidden and visible at all different times

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0