Loop Demonstration

By Zerg on Sep 02, 2009

A simple demonstration on how to write a loop script.

Done in status window by typing /loop

The script will end at: 1000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Zerg's Loop Tutorial---------------;;
;;Coded By Zerg----------------------;;
;;Contact on: Irc.swiftirc.net 6667--;;
;;#zergs_list #fender or #gs-pure----;;
;;All rights reserved.---------------;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias Loop {
;starts the application by typing /loop
var %i = 1
;sets variable %i to 1
while (%i <= 1000) {
;while the variable %i is less than or equal to (<=) 1000, do this:
echo -a Looped #= %i
;show in the active window: Looped #= Variable %i
inc %i
;increase the variable, and start the loop again
} 
}
;closing brackets

Comments

Sign in to comment.
Zerg   -  Sep 24, 2009

mIRC Snippet: Loop Demonstration
Posted on Sep 2, 2009 5:40 pm Delete
Jonesy is right. No point in showing 1000 when 10 will do it just as fine. If anything 1000 will spam whatever is your active window (<--Not a great idea).

/clear works fine.

and its meant to be done in the status window. Read the description.

 Respond  
Zerg   -  Sep 24, 2009

and to jonsey

mIRC Snippet: Loop Demonstration
Posted on Sep 2, 2009 4:52 pm Delete
lol. i think 1000's a bit excesive? 10 usually shows the gist of it..

I'm aware that 10 shows the gist, but i was demonstrating that a loop can be endless, or to any set amount. As a matter of fact, three of my scripts that are private and i will not be publishing use while loops to 12k, 17k, and 23k.

in realitive its about 20 seconds.
rather than the .5 seconds 1 - 10 would show.

 Respond  
Zerg   -  Sep 24, 2009

its not for flooding, its just to teach the format of a basic loop, and yes, i forgot the = after if (%i < 1000) so it will go to 999.

it'll be fixed by time you read this.

 Respond  
Jonesy44   -  Sep 04, 2009

if you want to properly flood, you'll need a better script than that. ;)

 Respond  
GlobalAnomaly   -  Sep 03, 2009

I think this would do better in the forum, though. Won't score it :( sorreh

 Respond  
Ghost-writer   -  Sep 03, 2009

lol ^ dont worry, it was just a joke.

 Respond  
Jethro   -  Sep 03, 2009

/me thumbs up | /me rates a 7 | timer 0 0 msg concept FLOOOOOOOOOOOOOOOOOOOODED | NOW I CAN DO IT WITH WHILE LOOPS! WOOHOOO :DDD. nice :P.Sigh...this is how flood kiddies get started in irc.

 Respond  
Jonesy44   -  Sep 03, 2009

And you never thought to /help while .. ?

 Respond  
Ghost-writer   -  Sep 03, 2009

/me thumbs up | /me rates a 7 | timer 0 0 msg concept FLOOOOOOOOOOOOOOOOOOOODED | NOW I CAN DO IT WITH WHILE LOOPS! WOOHOOO :DDD. nice :P.

 Respond  
GlobalAnomaly   -  Sep 02, 2009

Aye, noticed that. Edited to add the space :P I was posting in a hurry.

 Respond  
Jethro   -  Sep 02, 2009

@GlobalAnomaly: I think you posted your example in a hurry that you forgot to space the /while %x and <= 5, without it, you'll get an error. And you should add a timer delay to it, so that they won't come out at the same time in a flooding fashion:

alias mshoot { 
  var %x = 1, %y = $!nick(#,$r(1,$nick(#,0)))
  while (%x <= 5) { 
    .timer 1 $calc(%x * 2) describe $!chan shoots %y dealing $r(1,1000) damage!
    inc %x 
  } 
}
 Respond  
GlobalAnomaly   -  Sep 02, 2009

Nice description of it, and example. But I know a few people would prefer "smaller" code, even though it could kill readability.. Anyways.

alias Loop { var %i = 1 | while (%i < 1000) { echo -a Looped #= %i | inc %i } }

I decided to add to this, to possibly show more (or a different) way loops could work. It's a fun little mass shoot thing, but I'd suggest only doing it in your own channel.

alias mshoot { var %x = 1 | while (%x <= 5) { describe $active shoots $nick(#,$r(1,$nick(#,0))) dealing $r(1,1000) damage! | inc %x  } }
 Respond  
Jonesy44   -  Sep 02, 2009

As a suggestion -- and possible improvement on teaching loops, make the number editable -- this way you can show how to change the number of loops more dynamically.

 Respond  
Firstmate   -  Sep 02, 2009

Jonesy is right. No point in showing 1000 when 10 will do it just as fine. If anything 1000 will spam whatever is your active window (<--Not a great idea).

 Respond  
Jonesy44   -  Sep 02, 2009

i know, i know.. but it's a bit ... pointless to show SO many times. :/

 Respond  
Jethro   -  Sep 02, 2009

It actually loops through lightning fast. It'll be over before you know it. lol

 Respond  
Jonesy44   -  Sep 02, 2009

lol. i think 1000's a bit excesive? 10 usually shows the gist of it..

 Respond  
BlueThen   -  Sep 02, 2009

or

while (%i < 1001){

that'll shed a byte!

 Respond  
Jethro   -  Sep 02, 2009

Nice demonstration, but mirc's help file has shown an example similar to this one you posted, except you've included the explanation. You can change var %i = 1 to var %i = 0 so that it counts from 0 to 999

P.S. Your code will stop at 999; you need to change it to > while (%i <= 1000) {

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.