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
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.
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.
@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
}
}
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 } }