Top

Loop Demonstration


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.0 (of 1 scores)
Date Added  Sep 02, 2009
Last Updated  Sep 24, 2009
Tags  do  how  i  loop  loops  to  tutorial  while 

Description

A simple demonstration on how to write a loop script.

Done in status window by typing /loop

The script will end at: 1000

Grab the Code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;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

  (19)  RSS
Jethro_
Comments: 943
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 2:15 pm
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
Quote:
while (%i <= 1000) {

BlueThen
Comments: 395
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 4:19 pm
or
Code:
while (%i < 1001){

that'll shed a byte!
jonesy44
Comments: 1,892
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 4:52 pm
lol. i think 1000's a bit excesive? 10 usually shows the gist of it..
Jethro_
Comments: 943
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 5:02 pm
It actually loops through lightning fast. It'll be over before you know it. lol
jonesy44
Comments: 1,892
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 5:18 pm
i know, i know.. but it's a bit ... pointless to show SO many times. :/
Firstmate
Comments: 125
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 5:40 pm
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).
jonesy44
Comments: 1,892
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 5:51 pm
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.
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 7:25 pm
Nice description of it, and example. But I know a few people would prefer "smaller" code, even though it could kill readability.. Anyways.

Code:

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.

Code:

alias mshoot { var %x = 1 | while (%x <= 5) { describe $active shoots $nick(#,$r(1,$nick(#,0))) dealing $r(1,1000) damage! | inc %x  } }
Jethro_
Comments: 943
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 10:43 pm
@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:
Code:
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
  }
}
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 2, 2009 10:54 pm
Aye, noticed that. Edited to add the space :P I was posting in a hurry.
Ghost-writer
Comments: 353
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 3, 2009 8:34 am
/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.
jonesy44
Comments: 1,892
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 3, 2009 4:30 pm
And you never thought to /help while .. ?
Jethro_
Comments: 943
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 3, 2009 5:57 pm
Quote:
/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.
Ghost-writer
Comments: 353
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 3, 2009 9:34 pm
lol ^ dont worry, it was just a joke.
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 3, 2009 10:56 pm
I think this would do better in the forum, though. Won't score it :( sorreh
jonesy44
Comments: 1,892
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 4, 2009 3:50 pm
if you want to properly flood, you'll need a better script than that. ;)
Zerg
Comments: 16
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 24, 2009 8:34 am
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.
Zerg
Comments: 16
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 24, 2009 8:36 am
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.
Zerg
Comments: 16
 
mIRC Snippet:  Loop Demonstration
Posted on Sep 24, 2009 8:37 am
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.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom