|
|
Joined: Sep 2006
Posts: 13
Pikka bird
|
OP
Pikka bird
Joined: Sep 2006
Posts: 13 |
Ive made an interesting script that duplicates channels so I could experiment with while loops. Amaze your friends with this!!! --------------
alias chanduper {
var %cd.chan = $?="What channel do you want to copy?"
var %cd.numchan = $?="How many copies?"
var %cd.op = $?!="Deop in all of the channels?"
var %cd.num = 0
if (%cd.op == $true) {
while (%cd.num < %cd.numchan) {
var %cd.chan = $instok(%cd.chan,,2,46)
var %cd.chan = $remove(%cd.chan,.)
join %cd.chan
mode %cd.chan -o $me
inc %cd.num
}
}
else {
while (%cd.num < %cd.numchan) {
var %cd.chan = $instok(%cd.chan,,2,46)
var %cd.chan = $remove(%cd.chan,.)
join %cd.chan
inc %cd.num
}
}
} ------------ c/p that into remotes tab for it to work. Comments?
|
|
|
|
Joined: Feb 2006
Posts: 523
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 523 |
grats, you've passed mircscripting 101 :S in the next course you'll learn how a combination of well placed if statements and use of $+ and $str can make your code about half its size went ahead and made an example:
alias chanduper {
var %cd.chan = $?="What channel do you want to copy?", %cd.numchan = $?="How many copies?", %cd.op = $?!="Deop in all of the channels?"
while (%cd.numchan) {
join %cd.chan $+ $str(,$v1)
if (%cd.op) mode %cd.chan -o $me
dec %cd.numchan
}
}
now you can work on making that send as few commands to the server as possible, such as by sending all the channels to join in a single join command (/join #chan1,#chan2,#chan3...) to avoid floods ;p perhaps add some error checking and such 
Last edited by jaytea; 25/09/06 12:15 PM.
|
|
|
|
Joined: Sep 2006
Posts: 13
Pikka bird
|
OP
Pikka bird
Joined: Sep 2006
Posts: 13 |
man, I should have thought of putting the if inside the while... what is $v1?? I looked in the help file and it doesn't explain very much.
|
|
|
|
Joined: Sep 2006
Posts: 13
Pikka bird
|
OP
Pikka bird
Joined: Sep 2006
Posts: 13 |
OK, I couldnt edit the last post but I redid the code to add only 1 command to the server I didnt use the $str(blah,$v1) because I dont know what $v1 does (and didnt care to find out right now) alias chanduper {
;;variables
var %cd.chan = $?="What channel do you want to copy?"
var %cd.numchan = $?="How many copies?"
var %cd.op = $?!="Deop in all of the channels?"
;;while loop
while (%cd.numchan) {
var %cd.chan = $instok(%cd.chan,,2,46)
var %cd.chan = $remove(%cd.chan,.)
var %cd.join = $addtok(%cd.join,%cd.chan,44)
if (%cd.op) { mode %cd.chan -o $me }
dec %cd.numchan
}
join %cd.join
}
It works, but I get error messages equal to the number of copies I wanted to make. The error says: $chan No such channel (the channels are still joined though...)
|
|
|
|
Joined: Sep 2003
Posts: 4,214
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,214 |
The reason you get the errors is becuase, your writing stupid scripts that do stupid things. This particular error is caused becuase of attempted mode sets on channels that do not exist at the time of the mode set.
PS: u should move this to the scripts and popups.
|
|
|
|
Joined: Sep 2006
Posts: 13
Pikka bird
|
OP
Pikka bird
Joined: Sep 2006
Posts: 13 |
1) The reason you get the errors is becuase, your writing stupid scripts that do stupid things. 2) This particular error is caused becuase of attempted mode sets on channels that do not exist at the time of the mode set.
PS: 3) u should move this to the scripts and popups. 1) Isnt there something in the faq or sticky that says not to say stuff like that? 2) Thanks 3) I did
|
|
|
|
Joined: Sep 2003
Posts: 4,214
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,214 |
1) Isnt there something in the faq or sticky that says not to say stuff like that? I doubt there is any rule saying you can not state facts. 
|
|
|
|
Joined: Mar 2003
Posts: 611
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 611 |
$v1 and $v2 return the first and second parameters of a comparison.
i think the helpfile says something like
if ( text isin sometext ) $v1 is text $v2 is sometext
btk
billythekid
|
|
|
|
Joined: Oct 2006
Posts: 19
Ameglian cow
|
Ameglian cow
Joined: Oct 2006
Posts: 19 |
"I doubt there is any rule saying you can not state facts. "
How about being a butthead?
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Stating facts is one thing, calling people names is another, and doing the second is a really good way to go about having the helpers ignore you and all of your posts. Additionally, I believe, that multiple posts similar to that can cause you to lose your account on the forum and possibly get you banned.
|
|
|
|
Joined: Sep 2003
Posts: 4,214
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,214 |
How about being a butthead? No your welcome to being one  And have a nice day.
|
|
|
|
|
|